odoo/odoo — pull request #2702 by rco-odoo (2014-09-25 12:41:55+00:00)
Title: [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.

This fixes #1989.