Hello,
I've been adding some functionality to Odoo 13's SaleOrderLine's discount-field. My goal is to add a discount from a field in res.partner, but I want to implement a feature that gives the partner discount as default to sale.order.line's discount-field and then if this field's value is changed, calculates the new discount percentage by the old and new values. I've managed to do all of this and now I'm calculating the discount with an @api.onchange('discount') -method. The problem with this onchange is that when I calculate the percentage and add it to the self.discount, I trigger another onchange for the discount. This happens at least if the user gives a new discount and then presses enter or tab to move to another row.
My question is, is there a way to prevent the retriggering of the onchange or set a flag that prevents the recalculation of discount? I haven't been able to do anything with the context and my last resort is to add a field into the model that I set to True and False during the update and after...