Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
3 Ответы
3717 Представления

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 .

Аватар
Отменить
Лучший ответ

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.

Аватар
Отменить
Автор

so how can use , standard_price

Автор Лучший ответ

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'

Аватар
Отменить
Лучший ответ

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

Аватар
Отменить