From a7fe75478bf139cda11c33e3ddee4cbb3ef20bf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 22 Jan 2026 18:53:34 +0100 Subject: [PATCH] Prevent setting a phantom BoM on the BOM input and output with a product already set Closes #14536 --- modules/production/bom.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/modules/production/bom.py b/modules/production/bom.py index cc4a7e1e15..659b0c46a6 100644 --- a/modules/production/bom.py +++ b/modules/production/bom.py @@ -173,10 +173,6 @@ class BOMInput(ModelSQL, ModelView): }) 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 @@ class BOMInput(ModelSQL, ModelView): def __setup__(cls): super().__setup__() cls.phantom_bom.domain = [ + If(Eval('product', None), + ('id', '=', None), + ()), ('phantom', '=', True), ('inputs', '!=', None), ] @@ -325,6 +324,9 @@ class BOMOutput(BOMInput): def __setup__(cls): super().__setup__() cls.phantom_bom.domain = [ + If(Eval('product', None), + ('id', '=', None), + ()), ('phantom', '=', True), ('outputs', '!=', None), ]