Validate product-boms relation when deleting bom outputs.

The bom output that contains the product used on production-bom defines on
which products the bom can be used so it can not be deleted if used on the
relation otherwise it invalidates the domain and causes domain validation
errors when creating productions from the stock_supply_production wizard.

issue5495
review18021002
This commit is contained in:
Sergi Almacellas Abellana committed 2016-04-25 09:15:07 +02:00
1 parent 1319df075e
commit b286b5d01a
1 file changed
+9
+9
View File
@@ -129,6 +129,15 @@ class BOMOutput(BOMInput):
__name__ = 'production.bom.output'
_table = 'production_bom_output' # Needed to override BOMInput._table
@classmethod
def delete(cls, outputs):
pool = Pool()
ProductBOM = pool.get('product.product-production.bom')
bom_products = [b for o in outputs for b in o.product.boms]
super(BOMOutput, cls).delete(outputs)
# Validate that output_products domain on bom is still valid
ProductBOM._validate(bom_products, ['bom'])
class BOMTree(ModelView):
'BOM Tree'