changeset 0e8e200bb25b in modules/production:default
details:
https://hg.tryton.org/modules/production?cmd=changeset&node=0e8e200bb25b
description:
Validate product-boms relation when changing product of bom output
issue10776
review355541002
diffstat:
bom.py | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
diffs (24 lines):
diff -r 704497a46c62 -r 0e8e200bb25b bom.py
--- a/bom.py Sun Oct 03 13:45:32 2021 +0200
+++ b/bom.py Wed Oct 06 00:50:19 2021 +0200
@@ -132,6 +132,20 @@
# Validate that output_products domain on bom is still valid
ProductBOM._validate(bom_products, ['bom'])
+ @classmethod
+ def write(cls, *args):
+ pool = Pool()
+ ProductBOM = pool.get('product.product-production.bom')
+ actions = iter(args)
+ bom_products = []
+ for outputs, values in zip(actions, actions):
+ if 'product' in values:
+ bom_products.extend(
+ [b for o in outputs for b in o.product.boms])
+ super().write(*args)
+ # Validate that output_products domain on bom is still valid
+ ProductBOM._validate(bom_products, ['bom'])
+
class BOMTree(ModelView):
'BOM Tree'