[MERGE] OPW: 584197: account: Re-Opening periods from closed fiscal years is no longer allowed.

bzr revid: cbi@openerp.com-20130326132724-87pv2ri849fbochf
This commit is contained in:
Chris Biersbach 2013-03-26 14:27:24 +01:00
commit 41954e2609
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