Skip to Content
Menu
This question has been flagged
1813 Views

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 ! 



Avatar
Discard

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.

Related Posts Replies Views Activity
1
Jan 22
1730
3
Apr 23
8369
0
Dec 22
1520
1
Sep 22
2349
0
Sep 22
1503