diff --git a/sale_order_line_variant_description_extension/README.rst b/sale_order_line_variant_description_extension/README.rst new file mode 100644 index 000000000..c57156873 --- /dev/null +++ b/sale_order_line_variant_description_extension/README.rst @@ -0,0 +1,66 @@ +============================================= +Sale order line variant description extension +============================================= + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:2ed3a63493b0b9399f9ba447994dc4dfd90c1f51bd1d702620d1fb781fd176cb + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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-NuoBiT%2Fodoo--addons-lightgray.png?logo=github + :target: https://github.com/NuoBiT/odoo-addons/tree/18.0/sale_order_line_variant_description_extension + :alt: NuoBiT/odoo-addons + +|badge1| |badge2| |badge3| + +This module extends the OCA module sale_order_line_variant_description +and makes it compatible with having internal product references between +brackets. Also replaces the template sale description with the product +variant description. + +**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 +------- + +* NuoBiT Solutions SL + +Contributors +------------ + +- `NuoBiT `__: + + - Eric Antones eantones@nuobit.com + - Deniz Gallo dgallo@nuobit.com + +Maintainers +----------- + +This module is part of the `NuoBiT/odoo-addons `_ project on GitHub. + +You are welcome to contribute. diff --git a/sale_order_line_variant_description_extension/__init__.py b/sale_order_line_variant_description_extension/__init__.py new file mode 100644 index 000000000..b6876cdcc --- /dev/null +++ b/sale_order_line_variant_description_extension/__init__.py @@ -0,0 +1,22 @@ +from . import models + + +def _monkey_patch_sale_order_line_description(): + # Import the "bad" class — the one you want to patch + from odoo.addons.sale_order_line_variant_description.models.sale_order_line import ( + SaleOrderLine as BadSOLine, + ) + + # Define your replacement function + def _get_sale_order_line_multiline_description_sale(self): + # just call the next one up in the chain + return super(BadSOLine, self)._get_sale_order_line_multiline_description_sale() + + # Monkey-patch: replace their method + BadSOLine._get_sale_order_line_multiline_description_sale = ( + _get_sale_order_line_multiline_description_sale + ) + + +# Run patch immediately when your module loads +_monkey_patch_sale_order_line_description() diff --git a/sale_order_line_variant_description_extension/__manifest__.py b/sale_order_line_variant_description_extension/__manifest__.py new file mode 100644 index 000000000..9bfa23813 --- /dev/null +++ b/sale_order_line_variant_description_extension/__manifest__.py @@ -0,0 +1,15 @@ +# Copyright 2025 NuoBiT Solutions SL - Eric Antones +# Copyright 2026 NuoBit Solutions SL - Deniz Gallo +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) + +{ + "name": "Sale order line variant description extension", + "version": "18.0.1.0.0", + "category": "Sales", + "author": "NuoBiT Solutions SL", + "website": "https://github.com/NuoBiT/odoo-addons", + "license": "AGPL-3", + "depends": [ + "sale_order_line_variant_description", + ], +} diff --git a/sale_order_line_variant_description_extension/models/__init__.py b/sale_order_line_variant_description_extension/models/__init__.py new file mode 100644 index 000000000..5c74c8c30 --- /dev/null +++ b/sale_order_line_variant_description_extension/models/__init__.py @@ -0,0 +1 @@ +from . import product_product diff --git a/sale_order_line_variant_description_extension/models/product_product.py b/sale_order_line_variant_description_extension/models/product_product.py new file mode 100644 index 000000000..20aaca065 --- /dev/null +++ b/sale_order_line_variant_description_extension/models/product_product.py @@ -0,0 +1,33 @@ +# Copyright 2025 NuoBiT Solutions SL - Eric Antones +# Copyright 2026 NuoBit Solutions SL - Deniz Gallo +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) + +import re + +from odoo import _, models +from odoo.exceptions import ValidationError + + +class ProductProduct(models.Model): + _inherit = "product.product" + + def get_product_multiline_description_sale(self): + name = super().get_product_multiline_description_sale() + if name: + if self.variant_description_sale: + if self.description_sale: + name = name.replace( + self.description_sale, self.variant_description_sale + ) + else: + m = re.match( + rf"^({re.escape(self.display_name)})(.*)$", + name, + re.DOTALL, + ) + if not m: + raise ValidationError( + _("Unexpected format in product name: %s") % name + ) + name = f"{m.group(1)}\n{self.variant_description_sale}{m.group(2)}" + return name diff --git a/sale_order_line_variant_description_extension/pyproject.toml b/sale_order_line_variant_description_extension/pyproject.toml new file mode 100644 index 000000000..4231d0ccc --- /dev/null +++ b/sale_order_line_variant_description_extension/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/sale_order_line_variant_description_extension/readme/CONTRIBUTORS.md b/sale_order_line_variant_description_extension/readme/CONTRIBUTORS.md new file mode 100644 index 000000000..909507cba --- /dev/null +++ b/sale_order_line_variant_description_extension/readme/CONTRIBUTORS.md @@ -0,0 +1,3 @@ +- [NuoBiT](https://www.nuobit.com): + - Eric Antones + - Deniz Gallo diff --git a/sale_order_line_variant_description_extension/readme/DESCRIPTION.md b/sale_order_line_variant_description_extension/readme/DESCRIPTION.md new file mode 100644 index 000000000..6f2c910e7 --- /dev/null +++ b/sale_order_line_variant_description_extension/readme/DESCRIPTION.md @@ -0,0 +1,4 @@ +This module extends the OCA module sale_order_line_variant_description +and makes it compatible with having internal product references between +brackets. Also replaces the template sale description with the product +variant description. diff --git a/sale_order_line_variant_description_extension/static/description/icon.png b/sale_order_line_variant_description_extension/static/description/icon.png new file mode 100644 index 000000000..1cd641e79 Binary files /dev/null and b/sale_order_line_variant_description_extension/static/description/icon.png differ diff --git a/sale_order_line_variant_description_extension/static/description/index.html b/sale_order_line_variant_description_extension/static/description/index.html new file mode 100644 index 000000000..227e8dcf6 --- /dev/null +++ b/sale_order_line_variant_description_extension/static/description/index.html @@ -0,0 +1,423 @@ + + + + + +Sale order line variant description extension + + + +
+

Sale order line variant description extension

+ + +

Beta License: AGPL-3 NuoBiT/odoo-addons

+

This module extends the OCA module sale_order_line_variant_description +and makes it compatible with having internal product references between +brackets. Also replaces the template sale description with the product +variant description.

+

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

+
    +
  • NuoBiT Solutions SL
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is part of the NuoBiT/odoo-addons project on GitHub.

+

You are welcome to contribute.

+
+
+
+ +