diff options
| author | qdp-odoo <qdp@odoo.com> | 2017-03-28 11:59:00 +0200 |
|---|---|---|
| committer | qdp-odoo <qdp@odoo.com> | 2017-03-28 11:59:00 +0200 |
| commit | e2a239f4a4159ea64cf315164b7050ab1d2240bb (patch) | |
| tree | ba337358ebeb040e21c3bad7ae35b845d679a62d | |
| parent | 925440b7a0dbde85ec9b7a4474f205da0ef96f94 (diff) | |
[FIX] account: fix test.
This was broken since commit 925440b7a0dbde85ec9b7a4474f205da0ef96f94 that was specifically restricting the closing of a FY if any unposted move was left in the system.
| -rw-r--r-- | addons/account/tests/test_account_move_closed_period.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/addons/account/tests/test_account_move_closed_period.py b/addons/account/tests/test_account_move_closed_period.py index d3e9a5b08c2..4dcb8ac777e 100644 --- a/addons/account/tests/test_account_move_closed_period.py +++ b/addons/account/tests/test_account_move_closed_period.py @@ -11,10 +11,15 @@ class TestPeriodState(AccountingTestCase): def setUp(self): super(TestPeriodState, self).setUp() cr, uid = self.cr, self.uid + self.user_id = self.env['res.users'].browse(self.uid) self.day_before_yesterday = datetime.now() - timedelta(2) self.yesterday = datetime.now() - timedelta(1) - self.user_id = self.env['res.users'].browse(self.uid) - self.user_id.company_id.write({'fiscalyear_lock_date': self.yesterday.strftime(DEFAULT_SERVER_DATE_FORMAT)}) + self.yesterday_str = self.yesterday.strftime(DEFAULT_SERVER_DATE_FORMAT) + #make sure there is no unposted entry + draft_entries = self.env['account.move'].search([('date', '<=', self.yesterday_str), ('state', '=', 'draft')]) + if draft_entries: + draft_entries.post() + self.user_id.company_id.write({'fiscalyear_lock_date': self.yesterday_str}) self.sale_journal_id = self.env['account.journal'].search([('type', '=', 'sale')])[0] self.account_id = self.env['account.account'].search([('internal_type', '=', 'receivable')])[0] |
