Prevent setting a phantom BoM on the BOM input and output with a product already set

Closes #14536
This commit is contained in:
Cédric Krier
2026-01-22 18:53:34 +01:00
parent dd1cdfe656
commit a7fe75478b
+6 -4
View File
@@ -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),
]