[FIX] account_lock_date_update: Fix tests
This commit is contained in:
parent
0adb678e40
commit
fcd280c6a1
@ -9,11 +9,12 @@ class TestAccountLockDateUpdate(TransactionCase):
|
|||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestAccountLockDateUpdate, self).setUp()
|
super(TestAccountLockDateUpdate, self).setUp()
|
||||||
self.UpdateLockDateUpdateObj = self.env['account.update.lock_date']
|
|
||||||
|
|
||||||
self.company = self.env.ref('base.main_company')
|
self.company = self.env.ref('base.main_company')
|
||||||
self.demo_user = self.env.ref('base.user_demo')
|
self.demo_user = self.env.ref('base.user_demo')
|
||||||
self.adviser_group = self.env.ref('account.group_account_manager')
|
self.adviser_group = self.env.ref('account.group_account_manager')
|
||||||
|
self.UpdateLockDateUpdateObj = self.env[
|
||||||
|
'account.update.lock_date'
|
||||||
|
].sudo(self.demo_user)
|
||||||
|
|
||||||
def create_account_lock_date_update(self):
|
def create_account_lock_date_update(self):
|
||||||
return self.UpdateLockDateUpdateObj.create({
|
return self.UpdateLockDateUpdateObj.create({
|
||||||
@ -26,23 +27,21 @@ class TestAccountLockDateUpdate(TransactionCase):
|
|||||||
'period_lock_date': '2000-01-01',
|
'period_lock_date': '2000-01-01',
|
||||||
'fiscalyear_lock_date': '2000-01-01',
|
'fiscalyear_lock_date': '2000-01-01',
|
||||||
})
|
})
|
||||||
|
|
||||||
self.demo_user.write({
|
self.demo_user.write({
|
||||||
'groups_id': [(3, self.adviser_group.id)],
|
'groups_id': [(3, self.adviser_group.id)],
|
||||||
})
|
})
|
||||||
|
|
||||||
with self.assertRaises(UserError):
|
with self.assertRaises(UserError):
|
||||||
wizard.sudo(self.demo_user.id).execute()
|
wizard.sudo(self.demo_user.id).execute()
|
||||||
|
|
||||||
def test_02_update_with_access(self):
|
def test_02_update_with_access(self):
|
||||||
wizard = self.create_account_lock_date_update()
|
wizard = self.create_account_lock_date_update()
|
||||||
wizard.write({
|
wizard.write({
|
||||||
'period_lock_date': '2000-01-01',
|
'period_lock_date': '2000-02-01',
|
||||||
'fiscalyear_lock_date': '2000-01-01',
|
'fiscalyear_lock_date': '2000-01-01',
|
||||||
})
|
})
|
||||||
|
|
||||||
self.demo_user.write({
|
self.demo_user.write({
|
||||||
'groups_id': [(4, self.adviser_group.id)],
|
'groups_id': [(4, self.adviser_group.id)],
|
||||||
})
|
})
|
||||||
|
|
||||||
wizard.sudo(self.demo_user.id).execute()
|
wizard.sudo(self.demo_user.id).execute()
|
||||||
|
self.assertEqual(self.company.period_lock_date, '2000-02-01')
|
||||||
|
self.assertEqual(self.company.fiscalyear_lock_date, '2000-01-01')
|
||||||
|
Loading…
Reference in New Issue
Block a user