-
-
Notifications
You must be signed in to change notification settings - Fork 773
[18.0][MIG] product_variant_route_mto: Migration to 18.0 #1879
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[18.0][MIG] product_variant_route_mto: Migration to 18.0 #1879
Conversation
Define route_ids as computed on the product variant, in order to reuse route_ids from its template and add or remove MTO route according to the setting on the variant. In case MTO route is changed on the template, it must reset any variant specific setting.
"stock.route", | ||
compute="_compute_route_ids", | ||
domain="[('product_selectable', '=', True)]", | ||
store=True, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO we do not want to store this field and must define a search function instead.
The goal with this field is to use the route_ids
from the template - plus/minus the MTO route depending on the setting of the variant - when reading/searching on the product variant. By storing this, the route_ids from the template will not be used anymore, with the possibility to have inconsistencies between product and template as the product variant routes will not reflect anymore the routes from the template.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please point the open PR in v14 fixing this so that it can be ported once finished
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree.
@chaule97 can you please drop the store attribute and add a search function (if necessary)?
Just here, not on v14 for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have updated it, please review my new updates
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Waiting fix on v14
6871f14
to
6ec3dde
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we need a test on the search of route_ids 😬
def _search_route_ids(self, operator, value): | ||
mto_route = self.env.ref("stock.route_warehouse0_mto", raise_if_not_found=False) | ||
if not mto_route: | ||
return [(0, "=", 1)] if operator in ("=", "in") else [(0, "=", 0)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
value
before returning such a domain.
If I search for something like [('route_ids
, in
, buy_route.id)]` I would expect to get the products where the buy route is defined and the MTO being archived or not should not have any influence.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are several issues, i take it over here #1970
OCA/stock-logistics-workflow
toOCA/product-attribute
, rename itproduct_variant_route_mto
route_ids
stored=True
because this code made errorNon-stored field product.product.route_ids cannot be searched.