-
-
Notifications
You must be signed in to change notification settings - Fork 62
[IMP] apps_product_creator: Update module version #97
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
Conversation
b50aa2e to
5eb9b13
Compare
petrus-v
left a comment
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.
Looks good to me !
| for variant in product.product_variant_ids: | ||
| if not variant.odoo_module_version_id: | ||
| values = ( | ||
| variant.product_template_attribute_value_ids.product_attribute_value_id | ||
| ) | ||
| for value in values: | ||
| version = self.env[ | ||
| "product.product" | ||
| ]._get_version_with_attribute(module.module_version_ids, value) | ||
| if version: | ||
| variant.odoo_module_version_id = version | ||
| break |
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.
Not blockers, but just a suggestion for better readability.
| for variant in product.product_variant_ids: | |
| if not variant.odoo_module_version_id: | |
| values = ( | |
| variant.product_template_attribute_value_ids.product_attribute_value_id | |
| ) | |
| for value in values: | |
| version = self.env[ | |
| "product.product" | |
| ]._get_version_with_attribute(module.module_version_ids, value) | |
| if version: | |
| variant.odoo_module_version_id = version | |
| break | |
| for variant in product.product_variant_ids.filtered(lambda prod: not prod.odoo_module_version_id): | |
| values = ( | |
| variant.product_template_attribute_value_ids.product_attribute_value_id | |
| ) | |
| for value in values: | |
| version = self.env[ | |
| "product.product" | |
| ]._get_version_with_attribute(module.module_version_ids, value) | |
| if not version: | |
| continue | |
| variant.odoo_module_version_id = version | |
| break |
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.
Maybe even with a
variants = product.praduct_variant_ids.filtered(...)
for variant in variants:
# (... )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.
Thanks for the review!
Agreed, it is very nested; I removed one indentation level, please check if that looks better.
yvaucher
left a comment
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
When the link between the variant and the odoo module at a specific version is lost (i.e. product.product.odoo_module_version_id is empty), the odoo.module._update_product() should be able to restore it.
5eb9b13 to
c251982
Compare
|
/ocabot merge minor |
|
This PR looks fantastic, let's merge it! |
|
Congratulations, your PR was merged at e968759. Thanks a lot for contributing to OCA. ❤️ |
When the link between the variant and the odoo module at a specific version is lost (i.e.
product.product.odoo_module_version_idis empty), theodoo.module._update_product()should be able to restore it.Task https://odoo-community.org/my/task/909771.