I’m using incoterm module from Nan-Tic (https://bitbucket.org/nantic/trytond-incoterm/src). With this module, we could define a default incoterm and incoterm place for a party.
In a custom module, with a model parent-child, i’ve a supplier field in the parent class and i would like to get default values depending of the supplier field on the lines for the fields incoterm and incoterm place. Usually those two fields are updated with a method on_change on the supplier/party. But in my case, supplier become readonly when there is lines, and i would like each new line with default values for both fields.
Thanks for help !
You should use on_change_parent to set the values depending on the supplier field of the parent class. Each time you create a new child model, the parent field will be set automatically by the client and it will call the on_change_ methods which can be used to set the default values reading the parent values.