I want to make a field in the same model product.product
let A, which depends on lst_price of product.product
.
if the user did not set the value of A, and then took lst_price, but if the user sets the value of A, then it will be set as it is. The value of the field will also change at a given option price.
amount = fields.Float (Compute = "_ compute_amount", inverse = "_ set_amount", store = True)
@api.depends('lst_price')
def _compute_amount(self):
for product in self:
if product.amount<product.lst_price:
product.amount = product.lst_price
@api.one
def _set_amount(self):
return True
source
share