In CRM module , in pipeline record, I have added one Float called price_difference
with the help of inheritance. That field is difference between planned_revenue
and sale_amount_total
fields from the CRM module.
when I tired to use method name get_price_diff()
, it is not worked for me. I want to use sale_amount_total
and planned_revenue
with @api.
depends or @api.onchange
, but it is not working now.
Working of my method is simple, it depending upon sale_amount_total
and price_difference
field. If any of the values changed, the method should run.
sale_amount_total
is compute field in base module.
My code is below. How to do it?
class rate_record(models.Model):
_inherit = 'crm.lead'
price_difference = fields.Float(string='Price Difference', readonly=True)
@api.onchange('sale_amount_total', 'planned_revenue')
def get_price_diff(self):
self.price_different = self.planned_revenue - self.sale_amount_total