[IMP] apps_product_creator: Update module version#97
Merged
OCA-git-bot merged 1 commit intoOCA:14.0from Sep 17, 2025
Merged
Conversation
b50aa2e to
5eb9b13
Compare
bizzappdev
reviewed
Sep 15, 2025
Comment on lines
+97
to
+108
| 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.
Not blockers, but just a suggestion for better readability.
Suggested change
| 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 |
Member
There was a problem hiding this comment.
Maybe even with a
variants = product.praduct_variant_ids.filtered(...)
for variant in variants:
# (... )
Author
There was a problem hiding this comment.
Thanks for the review!
Agreed, it is very nested; I removed one indentation level, please check if that looks better.
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
Member
|
/ocabot merge minor |
Contributor
|
This PR looks fantastic, let's merge it! |
Contributor
|
Congratulations, your PR was merged at e968759. Thanks a lot for contributing to OCA. ❤️ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.