What is the diiference between onchange function and related attribute?
in which case i should use onchange?
in which case i should use related?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
What is the diiference between onchange function and related attribute?
in which case i should use onchange?
in which case i should use related?
Hi,
If you can achieve the things using the related field concept, then you can use it and if not possible you can use onchange.
Here you should understand the working of the related field, by default the related fields will be readonly field and if the end user need to edit the field, the readonly attribute has to set to False.
But once the readonly field is made editable and if the end user change the value, it will update the master record also.
Suppose if you add related field in sale.order model for a new field phone, lets say
phone = fields.Chat(related='partner_id.phone', readonly=False)
once user change value in this field, it will also update the phone field in the partner master also. But if you you use onchange here, it will not update the master.
So finally its the choice of the developer to understand the working of onchange and related field and to use according to the situation.
Thanks
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign upRelated Posts | Replies | Views | Activity | |
---|---|---|---|---|
|
0
Jul 24
|
2 | ||
Odoo App
Solved
|
|
1
Nov 23
|
734 | |
|
0
Nov 23
|
362 | ||
|
0
May 24
|
572 | ||
|
0
Sep 23
|
1451 |