-
-
Notifications
You must be signed in to change notification settings - Fork 715
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
[16.0][MIG+IMP] product_category_code_unique: restriciton options #1829
base: 16.0
Are you sure you want to change the base?
[16.0][MIG+IMP] product_category_code_unique: restriciton options #1829
Conversation
Currently translated at 100.0% (2 of 2 strings) Translation: product-attribute-15.0/product-attribute-15.0-product_category_code_unique Translate-URL: https://translation.odoo-community.org/projects/product-attribute-15-0/product-attribute-15-0-product_category_code_unique/it/
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.
Functional Review: LGTM 👍🏻
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.
Technical review.
Some comments
3df71c1
to
49d1df1
Compare
@Tisho99 Could you reviw again, please? |
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.
LGTM
This PR has the |
/ocabot migration product_category_code_unique |
@manuelregidor Could you maybe split the migration changes from improvements in commits ? |
self.ensure_one() | ||
return self._get_parents() + self._get_children() | ||
|
||
def _code_restriction(self, restriction=False): |
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.
IMHO, the restriction
attribute is not useful.
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.
The restriction attribute has been added so it can be passed when the method is called from _check_product_cat_code_unique_restriction in res.config.settings model. _check_product_cat_code_unique_restriction in res.config.settings is executed before the system parameter is modified changed, so we need to pass the selected restriction to the _code_restriction method in product.category to check whether the restriction option can be changed.
to_check = cat._get_hierarchy_cats() | ||
domain = [("code", "=", cat.code), ("id", "in", to_check.ids)] | ||
within = _("category hierarchy") | ||
if self.search_count(domain) > 1: |
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.
IMHO, this should be avoided for performance reasons.
A query to get all the categories should be done outside the loop. Then, compare the recordset values.
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.
Sorry, but I don't know exactly what you mean here.
49d1df1
to
d7949da
Compare
@rousseldenis Thanks for your feedback. I've already split the changes into 2 commits. |
Based on #1750
T-6836