diff --git a/product_merge/wizards/product_merge_wizard_line.py b/product_merge/wizards/product_merge_wizard_line.py index 65991ba2125..0dc12ea4594 100644 --- a/product_merge/wizards/product_merge_wizard_line.py +++ b/product_merge/wizards/product_merge_wizard_line.py @@ -7,6 +7,7 @@ class ProductMergeWizardLine(models.TransientModel): _name = "product.merge.wizard.line" + _description = "Merge Products Wizard Line" wizard_id = fields.Many2one("product.merge.wizard", string="Wizard", required=True) product_id = fields.Many2one( diff --git a/sale_product_merge/README.rst b/sale_product_merge/README.rst new file mode 100644 index 00000000000..b0ed015bd23 --- /dev/null +++ b/sale_product_merge/README.rst @@ -0,0 +1,78 @@ +================== +Sale Product Merge +================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:8a13aba39a9042c42a1b93cfe3345cd2a582245e52628173aef660a58e6d5ee9 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fproduct--attribute-lightgray.png?logo=github + :target: https://github.com/OCA/product-attribute/tree/16.0/sale_product_merge + :alt: OCA/product-attribute +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/product-attribute-16-0/product-attribute-16-0-sale_product_merge + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/builds?repo=OCA/product-attribute&target_branch=16.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module extends the functionality of the product_merge module to +ensure that product sale-related information is appropriately updated +during the merging process. + +**Table of contents** + +.. contents:: + :local: + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us to smash it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +------- + +* ACSONE SA/NV + +Contributors +------------ + +- Souheil Bejaoui souheil.bejaoui@acsone.eu + +Maintainers +----------- + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +This module is part of the `OCA/product-attribute `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/sale_product_merge/__init__.py b/sale_product_merge/__init__.py new file mode 100644 index 00000000000..5cb1c49143f --- /dev/null +++ b/sale_product_merge/__init__.py @@ -0,0 +1 @@ +from . import wizards diff --git a/sale_product_merge/__manifest__.py b/sale_product_merge/__manifest__.py new file mode 100644 index 00000000000..e42486410dc --- /dev/null +++ b/sale_product_merge/__manifest__.py @@ -0,0 +1,13 @@ +# Copyright 2025 ACSONE SA/NV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +{ + "name": "Sale Product Merge", + "version": "16.0.1.0.0", + "license": "AGPL-3", + "author": "ACSONE SA/NV,Odoo Community Association (OCA)", + "website": "https://github.com/OCA/product-attribute", + "depends": ["product_merge", "sale"], + "data": [], + "demo": [], +} diff --git a/sale_product_merge/readme/CONTRIBUTORS.md b/sale_product_merge/readme/CONTRIBUTORS.md new file mode 100644 index 00000000000..dbdd727b4a4 --- /dev/null +++ b/sale_product_merge/readme/CONTRIBUTORS.md @@ -0,0 +1 @@ +- Souheil Bejaoui diff --git a/sale_product_merge/readme/DESCRIPTION.md b/sale_product_merge/readme/DESCRIPTION.md new file mode 100644 index 00000000000..7c21f10a509 --- /dev/null +++ b/sale_product_merge/readme/DESCRIPTION.md @@ -0,0 +1,3 @@ +This module extends the functionality of the product_merge module to ensure +that product sale-related information is appropriately updated during the +merging process. diff --git a/sale_product_merge/static/description/icon.png b/sale_product_merge/static/description/icon.png new file mode 100644 index 00000000000..3a0328b516c Binary files /dev/null and b/sale_product_merge/static/description/icon.png differ diff --git a/sale_product_merge/static/description/index.html b/sale_product_merge/static/description/index.html new file mode 100644 index 00000000000..c934243ad51 --- /dev/null +++ b/sale_product_merge/static/description/index.html @@ -0,0 +1,422 @@ + + + + + +Sale Product Merge + + + +
+

Sale Product Merge

+ + +

Beta License: AGPL-3 OCA/product-attribute Translate me on Weblate Try me on Runboat

+

This module extends the functionality of the product_merge module to +ensure that product sale-related information is appropriately updated +during the merging process.

+

Table of contents

+ +
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us to smash it by providing a detailed and welcomed +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • ACSONE SA/NV
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use.

+

This module is part of the OCA/product-attribute project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/sale_product_merge/tests/__init__.py b/sale_product_merge/tests/__init__.py new file mode 100644 index 00000000000..4f251754684 --- /dev/null +++ b/sale_product_merge/tests/__init__.py @@ -0,0 +1 @@ +from . import test_sale_product_merge diff --git a/sale_product_merge/tests/test_sale_product_merge.py b/sale_product_merge/tests/test_sale_product_merge.py new file mode 100644 index 00000000000..12fbfd265eb --- /dev/null +++ b/sale_product_merge/tests/test_sale_product_merge.py @@ -0,0 +1,42 @@ +# Copyright 2025 ACSONE SA/NV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import Command + +from odoo.addons.product_merge.tests.test_product_merge import TestProductMerge + + +class TestSaleProductMerge(TestProductMerge): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.pricelist = cls.env["product.pricelist"].create( + { + "name": "Test Pricelist", + "item_ids": [ + Command.create( + { + "applied_on": "1_product", + "product_tmpl_id": cls.product_r.id, + "fixed_price": 70.0, + } + ), + Command.create( + { + "applied_on": "1_product", + "product_tmpl_id": cls.product_b.id, + "fixed_price": 50.0, + } + ), + ], + } + ) + + def test_update_price_list(self): + self.test_0() + self.wizard.action_merge_products() + self.assertEqual(self.pricelist.item_ids.product_tmpl_id, self.product_r) + self.assertEqual(self.pricelist.item_ids[0].applied_on, "0_product_variant") + self.assertEqual( + self.pricelist.item_ids.product_id, self.variant_r | self.variant_b + ) diff --git a/sale_product_merge/wizards/__init__.py b/sale_product_merge/wizards/__init__.py new file mode 100644 index 00000000000..006041ea491 --- /dev/null +++ b/sale_product_merge/wizards/__init__.py @@ -0,0 +1 @@ +from . import product_merge_wizard diff --git a/sale_product_merge/wizards/product_merge_wizard.py b/sale_product_merge/wizards/product_merge_wizard.py new file mode 100644 index 00000000000..214eba8b7cf --- /dev/null +++ b/sale_product_merge/wizards/product_merge_wizard.py @@ -0,0 +1,25 @@ +# Copyright 2025 ACSONE SA/NV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import models + + +class ProductMergeWizard(models.TransientModel): + + _inherit = "product.merge.wizard" + + def _move_variant_to_template(self, product_variant, attribute_values): + 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) diff --git a/setup/sale_product_merge/odoo/addons/sale_product_merge b/setup/sale_product_merge/odoo/addons/sale_product_merge new file mode 120000 index 00000000000..c6815022499 --- /dev/null +++ b/setup/sale_product_merge/odoo/addons/sale_product_merge @@ -0,0 +1 @@ +../../../../sale_product_merge \ No newline at end of file diff --git a/setup/sale_product_merge/setup.py b/setup/sale_product_merge/setup.py new file mode 100644 index 00000000000..28c57bb6403 --- /dev/null +++ b/setup/sale_product_merge/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)