From 184aa4c82808e0afcc13ccf7391059da0389b593 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Bidoul=20=28ACSONE=29?= Date: Thu, 4 May 2017 13:59:42 +0200 Subject: [PATCH] [FIX] account_journal_lock_date test on travis The test failed on travis (not on a local install) because the admin users if part of the Adviser group. Make sure we have the right group and add a test for that feature too. --- .../tests/test_journal_lock_date.py | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/account_journal_lock_date/tests/test_journal_lock_date.py b/account_journal_lock_date/tests/test_journal_lock_date.py index 88acdbc2..7b1d1bd4 100644 --- a/account_journal_lock_date/tests/test_journal_lock_date.py +++ b/account_journal_lock_date/tests/test_journal_lock_date.py @@ -29,6 +29,12 @@ class TestJournalLockDate(common.TransactionCase): self.journal = self.browse_ref("account.bank_journal") def test_journal_lock_date(self): + self.env.user.write({ + 'groups_id': [(3, self.ref('account.group_account_manager'))], + }) + self.assertFalse(self.env.user.has_group( + 'account.group_account_manager')) + # create a move and post it move = self.account_move_obj.create({ 'date': fields.Date.today(), @@ -86,3 +92,29 @@ class TestJournalLockDate(common.TransactionCase): })] }) move3.post() + + def test_journal_lock_date_adviser(self): + """ The journal lock date is ignored for Advisers """ + self.env.user.write({ + 'groups_id': [(4, self.ref('account.group_account_manager'))], + }) + self.assertTrue(self.env.user.has_group( + 'account.group_account_manager')) + + # lock journal + self.journal.journal_lock_date = fields.Date.today() + + # advisers can create moves before or on the lock date + self.account_move_obj.create({ + 'date': fields.Date.today(), + 'journal_id': self.journal.id, + 'line_ids': [(0, 0, { + 'account_id': self.account.id, + 'credit': 1000.0, + 'name': 'Credit line', + }), (0, 0, { + 'account_id': self.account2.id, + 'debit': 1000.0, + 'name': 'Debit line', + })] + })