This question has been flagged
3 Replies
3207 Views

hi amigos , if someone get hand ,

how can i get the value of field standard_price from product.product class i want to add , a new field in account.invoice.tax Class

'standard_price': fields.function(_get_standard_price , string='standard price', store=True)

if someone can help

thanks .

Avatar
Discard
Best Answer

You must browse the product record and get the field you want. In account.invoice.tax you haven't got a direct relation with product.product because account.invoice.tax is a many2many table.

Avatar
Discard
Author

so how can use , standard_price

Author Best Answer

i have try this ligne

produit = pro_obj.browse(cr, uid, line.product_id) price = 0.0 price = (line.price_unit - produit.standard_price)

but , i have an error message :

TypeError: unsupported operand type(s) for -: 'float' and 'NoneType'

Avatar
Discard
Best Answer

Hi,

Change code like this :

price = ((line.price_unit or 0.0) - (produit.standard_price or 0.0))

Email : info@acespritech.com
Skype : acespritech
Blog : acespritechblog.wordpress.com

Avatar
Discard