On 22 Jan 10:41, Gmail - Iasmini wrote:
> Hi,
> 
> I created the same new fields on account_tax and account_invoice_tax.
> I created a new tax and filled those fields.
> What I want is: when I insert a new product on a invoice those fields
> must to be filled with the same information that was registered when
> I configured the tax of this product.
> 
> To get this I need to modify Invoice._compute_tax and
> InvoiceTax.on_change_tax. I did this on core (to test) and it worked.
> To do this on my module I saw that Invoice._compute_tax is called by
> Invoice.on_change_lines and I try to call this method on my module
> for when user alters a line all the tax information will be
> automatically filled. I did this:
> 
> class Invoice:
>     __name__ = 'account.invoice'
> 
> ...
> 
>     def on_change_lines(self):
>         super(Invoice, self).on_change_lines()

on_change methods return changed values (dict) for the client so you
must return them:

    def on_change_lines(self):
        changes = super(Invoice, self).on_change_lines()
        # put your code here
        return changes

-- 
Cédric Krier - B2CK SPRL
Email/Jabber: [email protected]
Tel: +32 472 54 46 59
Website: http://www.b2ck.com/

Attachment: pgp6jmSzh9qgU.pgp
Description: PGP signature

Reply via email to