This question has been flagged
3 Replies
3741 Views

I'm using Odoo 12. From the XMLRPC API, I am adding a single route_id to a single product.product entry with the following params object according to the official documentation:

{ route_id: [[4, 18, false]] }

It is working fine. However, when I add the route to one variant, then it gets automatically added to all variants. The same thing happens when I use the UI to add a route to single variant.

I do not want this and I do not see the benefit of automatically updating all variants.

Is there some configuration setting I need to change?

Avatar
Discard

I would like to know the answer to this as well.

Hi, did you get any solution for this?

Best Answer

Hi, James


"route_ids" belongs to the "product.template" model not from "product.product" and as you know "product.product" inherits all the properties from "product.template".

https://github.com/odoo/odoo/blob/cc0f6e205262f73fe83b39c6ea0e29e3ae1cf355/addons/stock/models/product.py#L598 

So you update any field which belongs "product.template" not from "product.product" then value will be updated inside all the variants. 
In order to achieve this part you need to define same field inside the "product.product" model. Like Odoo manages other fields of "product.product".

https://github.com/odoo/odoo/blob/fa852ba1c5707b71469c410063f338eef261ab2b/addons/product/models/product.py#L135 

But I recommend you to follow this step only if you have complete idea of Odoo routing flow.

Feel free to ask in case you have any confusion related to the above point.


Thanks,
Ashish Singh (Team Lead)
Webkul Software Private Limited

Avatar
Discard