[FIX] account_voucher: do not unlink records in onchange method
authorRaphael Collet <rco@openerp.com>
Thu, 25 Sep 2014 12:30:22 +0000 (14:30 +0200)
committerRaphael Collet <rco@openerp.com>
Thu, 25 Sep 2014 13:37:50 +0000 (15:37 +0200)
commitb3a74f37491dc4bceb19a6d519fa12f2de753c68
tree5b397f81e66eaaa8017c651af0488660652b857f
parent932eccc7a7c0a48d7758048b0035593543cc8014
[FIX] account_voucher: do not unlink records in onchange method

The method recompute_voucher_lines() is used by several onchange methods of
account.voucher.  It used to unlink() the voucher lines before recomputing new
voucher lines.  As a side effect, if you edit a voucher and discard your
changes, your voucher has lost its lines, although you did not save your
changes!  Moreover, the call to unlink() is invalidating the record cache,
which screws up completely the onchange() method.

So, instead of unlinking the existing lines, the onchange generates commands
[(2, id), ...] to remove the existing lines only when saving the changes.
addons/account_voucher/account_voucher.py