On 23 Jan 10:34, Gmail - Iasmini wrote: > On 22 Jan 16:55, Gmail - Iasmini wrote: > >Hi, > > > >As I've said before, 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. > > > >Invoice._compute_tax is static. But I need to override this method to > >include the new fields. How can I do? > > >You can see all staticmethod as classmethod which don't need in the > >code the cls, so you can override them using a classmethod. > > This way I'll have to copy the method to my module and modify it, right? > Because when I try to do: > > @classmethod > def _compute_tax(cls, invoice_tax, invoice_type): > super(Invoice)._compute_tax(invoice_tax, invoice_type) > > It gives me the error: AttributeError: 'super' object has no > attribute '_compute_tax'
It must be:
@classmethod
def _compute_tax(cls, invoice_tax, invoice_type):
super(Invoice, cls)._compute_tax(invoice_tax, invoice_type)
--
Cédric Krier - B2CK SPRL
Email/Jabber: [email protected]
Tel: +32 472 54 46 59
Website: http://www.b2ck.com/
pgp18Mt_L0CEy.pgp
Description: PGP signature
