[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
This commit is contained in:
Rifakat 2013-01-23 16:09:11 +05:30 committed by Chris Biersbach
parent 6c8bbc50e4
commit d4fe5a47f3
1 changed files with 3 additions and 0 deletions

View File

@ -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