← Back to team overview

openerp-community-reviewer team mailing list archive

[Merge] lp:~alhashash/ocb-addons/7.0-bug-1219204 into lp:ocb-addons

 

Mohammad Alhashash has proposed merging lp:~alhashash/ocb-addons/7.0-bug-1219204 into lp:ocb-addons.

Requested reviews:
  OpenERP Community Backports Team (ocb)
Related bugs:
  Bug #1219204 in OpenERP Community Backports (Addons): "[7.0/trunk] error when re-generating opening entries"
  https://bugs.launchpad.net/ocb-addons/+bug/1219204

For more details, see:
https://code.launchpad.net/~alhashash/ocb-addons/7.0-bug-1219204/+merge/217676
-- 
https://code.launchpad.net/~alhashash/ocb-addons/7.0-bug-1219204/+merge/217676
Your team OpenERP Community Backports Team is requested to review the proposed merge of lp:~alhashash/ocb-addons/7.0-bug-1219204 into lp:ocb-addons.
=== modified file 'account/account.py'
--- account/account.py	2014-04-22 13:50:12 +0000
+++ account/account.py	2014-04-29 19:58:32 +0000
@@ -1647,7 +1647,7 @@
     # you should use the generate opening entries wizard for that
     def unlink(self, cr, uid, ids, context=None):
         for move_rec in self.browse(cr, uid, ids, context=context):
-            if move_rec.opening_reconciliation:
+            if move_rec.opening_reconciliation and not context['regenerate_opening']:
                 raise osv.except_osv(_('Error!'), _('You cannot unreconcile journal items if they has been generated by the \
                                                         opening/closing fiscal year process.'))
         return super(account_move_reconcile, self).unlink(cr, uid, ids, context=context)

=== modified file 'account/account_move_line.py'
--- account/account_move_line.py	2014-04-23 14:17:43 +0000
+++ account/account_move_line.py	2014-04-29 19:58:32 +0000
@@ -1029,9 +1029,8 @@
         all_moves = obj_move_line.search(cr, uid, ['|',('reconcile_id', 'in', unlink_ids),('reconcile_partial_id', 'in', unlink_ids)])
         all_moves = list(set(all_moves) - set(move_ids))
         if unlink_ids:
-            if opening_reconciliation:
-                obj_move_rec.write(cr, uid, unlink_ids, {'opening_reconciliation': False})
-            obj_move_rec.unlink(cr, uid, unlink_ids)
+            ctx = {'regenerate_opening':True} if opening_reconciliation else None
+            obj_move_rec.unlink(cr, uid, unlink_ids, ctx)
             if all_moves:
                 obj_move_line.reconcile_partial(cr, uid, all_moves, 'auto',context=context)
         return True


Follow ups