details:   https://code.tryton.org/tryton/commit/8f94ef8b63af
branch:    default
user:      Cédric Krier <[email protected]>
date:      Mon Dec 01 09:59:15 2025 +0100
description:
        Do not apply inactive test when searching product through replacing 
products

        The replacing products are most of the time inactive but the replacing 
link
        should include them.

        Closes #14403
diffstat:

 modules/product/product.py |  18 ++++++++++++++++--
 1 files changed, 16 insertions(+), 2 deletions(-)

diffs (42 lines):

diff -r 51db78d9e3b7 -r 8f94ef8b63af modules/product/product.py
--- a/modules/product/product.py        Fri Dec 05 10:03:01 2025 +0100
+++ b/modules/product/product.py        Mon Dec 01 09:59:15 2025 +0100
@@ -22,7 +22,7 @@
 from trytond.pool import Pool
 from trytond.pyson import Eval, Get, If
 from trytond.tools import is_full_text, lstrip_wildcard
-from trytond.transaction import Transaction
+from trytond.transaction import Transaction, inactive_records
 from trytond.wizard import Button, StateTransition, StateView, Wizard
 
 try:
@@ -392,6 +392,20 @@
         return expression & Coalesce(product.active, expression)
 
 
+class _One2ManyWithInactive(fields.One2Many):
+    @inactive_records
+    def get(self, *args, **kwargs):
+        return super().get(*args, **kwargs)
+
+    @inactive_records
+    def set(self, *args, **kwargs):
+        return super().set(*args, **kwargs)
+
+    @inactive_records
+    def convert_domain(self, *args, **kwargs):
+        return super().convert_domain(*args, **kwargs)
+
+
 class Product(
         TemplateDeactivatableMixin, tree('replaced_by'), ModelSQL, ModelView,
         CompanyMultiValueMixin):
@@ -463,7 +477,7 @@
             'invisible': ~Eval('replaced_by'),
             },
         help="The product replacing this one.")
-    replacing = fields.One2Many(
+    replacing = _One2ManyWithInactive(
         'product.product', 'replaced_by', "Replacing", readonly=True,
         states={
             'invisible': ~Eval('replacing'),

Reply via email to