openerp-dev-web team mailing list archive
-
openerp-dev-web team
-
Mailing list archive
-
Message #04921
[Merge] lp:~openerp-dev/openobject-addons/trunk-bug-746544-ara into lp:openobject-addons
Ashvin Rathod (OpenERP) has proposed merging lp:~openerp-dev/openobject-addons/trunk-bug-746544-ara into lp:openobject-addons.
Requested reviews:
OpenERP Core Team (openerp)
Related bugs:
Bug #746544 in OpenERP Addons: "Cancel of invoice throws error, validate of move_id is invalid"
https://bugs.launchpad.net/openobject-addons/+bug/746544
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-746544-ara/+merge/55924
Hello,
Fix: Cancel of invoice throws error, validate of move_id is invalid
Thanks,
ara
--
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-746544-ara/+merge/55924
Your team OpenERP R&D Team is subscribed to branch lp:~openerp-dev/openobject-addons/trunk-bug-746544-ara.
=== modified file 'account/account_move_line.py'
--- account/account_move_line.py 2011-03-25 15:38:54 +0000
+++ account/account_move_line.py 2011-04-01 12:51:24 +0000
@@ -1085,15 +1085,26 @@
if context is None:
context = {}
move_obj = self.pool.get('account.move')
+ analytic_obj = self.pool.get('account.analytic.line')
self._update_check(cr, uid, ids, context)
result = False
move_ids = set()
+ analytic_ids = set()
+ move_line_ids = set()
for line in self.browse(cr, uid, ids, context=context):
move_ids.add(line.move_id.id)
context['journal_id'] = line.journal_id.id
context['period_id'] = line.period_id.id
- result = super(account_move_line, self).unlink(cr, uid, [line.id], context=context)
+ move_line_ids.add(line.id)
+ for obj in line.analytic_lines:
+ analytic_ids.add(obj.id)
+
+ analytic_ids = list(analytic_ids)
move_ids = list(move_ids)
+
+ if analytic_ids:
+ analytic_obj.unlink(cr,uid, analytic_ids, context=context)
+ result = super(account_move_line, self).unlink(cr, uid, list(move_line_ids), context=context)
if check and move_ids:
move_obj.validate(cr, uid, move_ids, context=context)
return result
Follow ups