details:   https://code.tryton.org/tryton/commit/3dc5cc5d2108
branch:    7.8
user:      Cédric Krier <[email protected]>
date:      Thu Jan 22 18:53:34 2026 +0100
description:
        Prevent setting a phantom BoM on the BOM input and output with a 
product already set

        Closes #14536
        (grafted from f9b275530f28a46d00feb10dc049d9c91cdc5270)
diffstat:

 modules/production/bom.py |  10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diffs (34 lines):

diff -r 255081359322 -r 3dc5cc5d2108 modules/production/bom.py
--- a/modules/production/bom.py Tue Jan 20 18:43:53 2026 +0100
+++ b/modules/production/bom.py Thu Jan 22 18:53:34 2026 +0100
@@ -173,10 +173,6 @@
             })
     phantom_bom = fields.Many2One(
         'production.bom', "Phantom BOM",
-        domain=[If(Eval('product', None),
-                ('id', '=', None),
-                ()),
-            ],
         states={
             'invisible': Bool(Eval('product')),
             'required': ~Bool(Eval('product')),
@@ -199,6 +195,9 @@
     def __setup__(cls):
         super().__setup__()
         cls.phantom_bom.domain = [
+            If(Eval('product', None),
+                ('id', '=', None),
+                ()),
             ('phantom', '=', True),
             ('inputs', '!=', None),
             ]
@@ -325,6 +324,9 @@
     def __setup__(cls):
         super().__setup__()
         cls.phantom_bom.domain = [
+            If(Eval('product', None),
+                ('id', '=', None),
+                ()),
             ('phantom', '=', True),
             ('outputs', '!=', None),
             ]

Reply via email to