details: https://code.tryton.org/tryton/commit/0071dec557e0
branch: 7.6
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
(grafted from 8f94ef8b63afba81ac8e18b79ee2ba1e41df87ac)
diffstat:
modules/product/product.py | 18 ++++++++++++++++--
1 files changed, 16 insertions(+), 2 deletions(-)
diffs (42 lines):
diff -r 70d667ad6de5 -r 0071dec557e0 modules/product/product.py
--- a/modules/product/product.py Mon Dec 01 16:14:29 2025 +0100
+++ b/modules/product/product.py Mon Dec 01 09:59:15 2025 +0100
@@ -21,7 +21,7 @@
from trytond.pool import Pool
from trytond.pyson import Eval, Get
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:
@@ -365,6 +365,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):
@@ -420,7 +434,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'),