[FIX] account: prevent removing closing entries for closed period

As the target period is closed, should not be able to delete closing entries.
opw 610428
This commit is contained in:
han-odoo 2014-10-06 11:41:14 +05:30 committed by Martin Trigaux
parent 3cae2c5155
commit 0a1f52ccb5
1 changed files with 3 additions and 0 deletions

View File

@ -38,6 +38,9 @@ class account_open_closed_fiscalyear(osv.osv_memory):
if not period_journal:
raise osv.except_osv(_('Error!'), _("You have to set the 'End of Year Entries Journal' for this Fiscal Year which is set after generating opening entries from 'Generate Opening Entries'."))
if period_journal.period_id.state == 'done':
raise osv.except_osv(_('Error!'), _("You can not cancel closing entries if the 'End of Year Entries Journal' period is closed."))
ids_move = move_obj.search(cr, uid, [('journal_id','=',period_journal.journal_id.id),('period_id','=',period_journal.period_id.id)])
if ids_move:
cr.execute('delete from account_move where id IN %s', (tuple(ids_move),))