I have new field in sale order line as mrp. I need to calculate price_unit as
price_unit= mrp- discount
When
i use this calculation, discount always becomes 0.00 whatever the
discount value is, then price_unit become the mrp value. But when i
put
price _unit= mrp- 25
this gives the actual answer. But i need to make calculation dynamic. How can I make it possible sir
Hi please add your code with the question.
Code:
mrp=fields.Float(string='MRP')
price_unit = fields.Float('Unit Price',compute='compute_unit', required=True, default=0.0)
discount = fields.Float(string='Discount (Rs.)')
@api.depends('mrp','discount','price_unit')
def compute_unit(self):
for line in self
line.price_unit = line.mrp - line.discount