-
-
Notifications
You must be signed in to change notification settings - Fork 714
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][ADD] product_merge #1830
base: 16.0
Are you sure you want to change the base?
Conversation
This module allows users to efficiently merge multiple product templates into one. This merge process ensures that attributes and variants from all selected products are consolidated into the primary product template, without creating any new variants. This approach is particularly important for maintaining data integrity and avoiding unnecessary database load. By not creating new variants during the merge, the module helps to prevent heavy updates on existing tables, making it ideal for large-scale databases.
This module extends the functionality of the product_merge module to ensure that product sale-related information is appropriately updated during the merging process.
eed5099
to
b3efaff
Compare
pricelist_items = self.env["product.pricelist.item"].search( | ||
[ | ||
("applied_on", "=", "1_product"), | ||
("product_tmpl_id", "=", product_variant.product_tmpl_id.id), | ||
] | ||
) | ||
pricelist_items.write( | ||
{ | ||
"applied_on": "0_product_variant", | ||
"product_id": product_variant.id, | ||
"product_tmpl_id": self.product_tmpl_id.id, | ||
} | ||
) | ||
return super()._move_variant_to_template(product_variant, attribute_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.
This could go in the main module, as that model is in the product
module. Or is there anything else?
self._update_supplier_info(product_variant) | ||
self._move_variant_to_template(product_variant, line.attribute_value_ids) | ||
|
||
other_templates.write({"active": 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.
@sbejaoui IMO something is missing. You should use a generic method to update into the database all the columns where the other_templates.ids are referenced.... The merge_records
from the openupgrade lib could be a good candidate 🤔
Possible duplicate of https://github.com/OCA/stock-logistics-warehouse/tree/16.0/base_product_merge? |
This module emits error logs during the tests. Can you mute the logger when testing the exception?
|
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.
See comments above.
The goal is not the same. This PR propose to merge 2 product templates into one product with 2 variants. |
From what I can see, |
I didn't know that the |
Sounds like there is a strong case to try and improve |
This module allows users to efficiently merge multiple product templates into one. This merge process ensures that attributes and variants from all selected products are consolidated into the primary product template, without creating any new variants. This approach is particularly important for maintaining data integrity and avoiding unnecessary database load.
By not creating new variants during the merge, the module helps to prevent heavy updates on existing tables, making it ideal for large-scale databases.