[MERGE] OPW 573839: account: never allow cancelling entries on closed financial periods

bzr revid: xal@openerp.com-20120723081633-oll7ealqpvzyxf4z
This commit is contained in:
Xavier ALT
2012-07-23 10:16:33 +02:00
+3 -1
View File
@@ -1355,7 +1355,9 @@ class account_move(osv.osv):
def button_cancel(self, cr, uid, ids, context=None):
for line in self.browse(cr, uid, ids, context=context):
if not line.journal_id.update_posted:
if line.period_id.state == 'done':
raise osv.except_osv(_('Error !'), _('You can not modify a posted entry of closed periods'))
elif not line.journal_id.update_posted:
raise osv.except_osv(_('Error !'), _('You can not modify a posted entry of this journal !\nYou should set the journal to allow cancelling entries if you want to do that.'))
if ids:
cr.execute('UPDATE account_move '\