Code review comment for lp:~akretion-team/account-invoicing/70-add-invoice_fiscal_position_update

Revision history for this message
Alexis de Lattre (alexis-via) wrote :

Thanks for all these comments !

I have started to implement the on_change approch, cf the code in this branch :

lp:~akretion-team/account-invoicing/70-invoice_fiscal_position_update-onchange

But, during the implementation, I have been confronted to the following problem :

In the code of the fiscal_position_change function, I do a "write" on all the invoice lines to update the taxes and account. But this is a problem in the following scenario :

1) edit an invoice with fiscal position A
2) add an invoice line with product HDD1
3) change the fiscal position to B
4) click on "save"

=> the invoice line with product HDD1 will not be updated, because it is not "created" in the DB at the time of the execution of the on_change. The solution for this is to update the taxes and account via the 'value' key of the dict that is returned by the on_change, but I don't know if it's possible in OpenERP 7 to update the field of the invoice_lines (one2many) via an on_change of a field that belong to the invoice.

If this is possible in OpenERP 7, please explain me how to implement it and I will do it.

If this is not possible in OpenERP 7, I think it gives a significant advantage to the "button" approach.

« Back to merge proposal