From d4fe5a47f3eda19d77b9c96318c3f7363f09504f Mon Sep 17 00:00:00 2001 From: Rifakat Date: Wed, 23 Jan 2013 16:09:11 +0530 Subject: [PATCH] [FIX] account: put a restriction to re-open a period which belongs to > the closed fiscal year, it must not be possible to re-open a period and post journal items when its fiscal year is closed bzr revid: rha@tinyerp.com-20130123103911-trxfkv0kemltvdv5 --- addons/account/account.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/addons/account/account.py b/addons/account/account.py index 8c7f058acc6..dd9e869ae4a 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -1026,6 +1026,9 @@ class account_period(osv.osv): def action_draft(self, cr, uid, ids, *args): mode = 'draft' + for period in self.browse(cr, uid, ids): + if period.fiscalyear_id.state == 'done': + raise osv.except_osv(_('Warning !'), _('You can not re-open a period which belongs to closed fiscal year')) cr.execute('update account_journal_period set state=%s where period_id in %s', (mode, tuple(ids),)) cr.execute('update account_period set state=%s where id in %s', (mode, tuple(ids),)) return True