Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions sale_order_line_variant_description_extension/README.rst
Original file line number Diff line number Diff line change
@@ -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 <https://github.com/NuoBiT/odoo-addons/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 <https://github.com/NuoBiT/odoo-addons/issues/new?body=module:%20sale_order_line_variant_description_extension%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

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

Credits
=======

Authors
-------

* NuoBiT Solutions SL

Contributors
------------

- `NuoBiT <https://www.nuobit.com>`__:

- Eric Antones eantones@nuobit.com
- Deniz Gallo dgallo@nuobit.com

Maintainers
-----------

This module is part of the `NuoBiT/odoo-addons <https://github.com/NuoBiT/odoo-addons/tree/18.0/sale_order_line_variant_description_extension>`_ project on GitHub.

You are welcome to contribute.
22 changes: 22 additions & 0 deletions sale_order_line_variant_description_extension/__init__.py
Original file line number Diff line number Diff line change
@@ -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()
15 changes: 15 additions & 0 deletions sale_order_line_variant_description_extension/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright 2025 NuoBiT Solutions SL - Eric Antones <eantones@nuobit.com>
# Copyright 2026 NuoBit Solutions SL - Deniz Gallo <dgallo@nuobit.com>
# 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",
],
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import product_product
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Copyright 2025 NuoBiT Solutions SL - Eric Antones <eantones@nuobit.com>
# Copyright 2026 NuoBit Solutions SL - Deniz Gallo <dgallo@nuobit.com>
# 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
3 changes: 3 additions & 0 deletions sale_order_line_variant_description_extension/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- [NuoBiT](https://www.nuobit.com):
- Eric Antones <eantones@nuobit.com>
- Deniz Gallo <dgallo@nuobit.com>
Original file line number Diff line number Diff line change
@@ -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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading