Issue with the related field.

Asked by Vivek poddar

Hi,

I have a related field in model for this field the store attribute is a dictionary which triggers a function for the changes in the product field. Now my question is that it works well when my model is already there and I change some product attribute. But when I create a new model and relate a product to it then the fields are not filled automatically only the fields which have store=False are filled. Now, why there is such differences in the functionality of similar type of field. I consider this as a serious drawback of the framework.

Thanks and Regards!
Vivek Poddar

Question information

Language:
English Edit question
Status:
Solved
For:
Odoo Server (MOVED TO GITHUB) Edit question
Assignee:
No assignee Edit question
Solved by:
Vivek poddar
Solved:
Last query:
Last reply:
Revision history for this message
Vivek poddar (vivekimsit) said :
#1

Hi,

I didn't find an answer to the above question so I decided to solve it myself. So, all we need to do is add an extra key, value pair in the store dict which can track all the changes in the current model and can fire a trigger on change of any field value.
Example:
store: {
'current_model_in_which_this_field_is_defined': lambda self, cr, uid, context=None: ids,
}