[FIX] account: better error message when regenarating opening entries (opw 606923)
authorMartin Trigaux <mat@openerp.com>
Wed, 4 Jun 2014 14:33:58 +0000 (16:33 +0200)
committerMartin Trigaux <mat@openerp.com>
Fri, 18 Jul 2014 14:53:01 +0000 (16:53 +0200)
If we try to generate twice entries on the same fiscal year, we can get completly unrelated errors ("You can only reconcile journal items with the same partner").
With this, we make sure people will first cancel the entries before regeneraing the entries.

addons/account/account_move_line.py

index a7fd2ad..bdc1941 100644 (file)
@@ -1030,6 +1030,8 @@ class account_move_line(osv.osv):
         all_moves = list(set(all_moves) - set(move_ids))
         if unlink_ids:
             if opening_reconciliation:
+                raise osv.except_osv(_('Warning!'),
+                    _('Opening Entries have already been generated.  Please run "Cancel Closing Entries" wizard to cancel those entries and then run this wizard.'))
                 obj_move_rec.write(cr, uid, unlink_ids, {'opening_reconciliation': False})
             obj_move_rec.unlink(cr, uid, unlink_ids)
             if len(all_moves) >= 2: