Hello,
I have onchange method who works perfectky from 'title' field.
But, with 'carrier_id' field, my on_change method is not trigerred.... why ? Here is my code :
From 'title' field, it's OK :
class sale_order(models.Model):
_inherit = 'sale.order'
@api.onchange('title')
def _onchange_delivery_set_title(self):
self.incoterm = 1
self.title = 'change_ok'
From 'carrier_id', not trigered :
class sale_order(models.Model):
_inherit = 'sale.order'
@api.onchange('carrier_id')
def _onchange_delivery_set_carrier(self):
self.title='not_changed'
self.incoterm = 2
Thank you for your help !
The onchange method is triggered if any field change in the FORM. so I think the carrier_id is not changed from the FORM. You can override Save method for that purpose.