← Back to team overview

openerp-community-reviewer team mailing list archive

Re: lp:~akretion-team/account-invoicing/70-add-invoice_fiscal_position_update into lp:account-invoicing

 

Hi Alexis,

It is, there is an ORM function self.resolve_2many_commands which
takes a field name and the argument that was passed (generally these
are the same, one a string, one a variable, but sometimes ids might be
appended to one and not the other).  From there you can perform the
change to the lines without writing returning in value dict.

On Sat, Jan 4, 2014 at 11:38 AM, Alexis de Lattre <alexis@xxxxxxxxxx> 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.
> --
> https://code.launchpad.net/~akretion-team/account-invoicing/70-add-invoice_fiscal_position_update/+merge/200358
> You are reviewing the proposed merge of lp:~akretion-team/account-invoicing/70-add-invoice_fiscal_position_update into lp:account-invoicing.

-- 
https://code.launchpad.net/~akretion-team/account-invoicing/70-add-invoice_fiscal_position_update/+merge/200358
Your team Account Core Editors is subscribed to branch lp:account-invoicing.


References