From 082a4cf4c1f109644cb5c7a45ed1d3ffa69b1b06 Mon Sep 17 00:00:00 2001 From: AndriFP Date: Mon, 28 Apr 2025 14:42:51 +0700 Subject: (andri) Add validation: BOM cannot be mark done if SO has not been confirmed --- indoteknik_custom/models/manufacturing.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/indoteknik_custom/models/manufacturing.py b/indoteknik_custom/models/manufacturing.py index 24a8b8c3..715d8513 100644 --- a/indoteknik_custom/models/manufacturing.py +++ b/indoteknik_custom/models/manufacturing.py @@ -26,6 +26,13 @@ class Manufacturing(models.Model): # Check product category if self.product_id.categ_id.name != 'Finish Good': raise UserError('Tidak bisa di complete karna product category bukan Unit / Finish Good') + + if self.sale_order and self.sale_order.state != 'sale': + raise UserError( + ('Tidak bisa Mark as Done.\nSales Order "%s" (Nomor: %s) belum dikonfirmasi.') + % (self.sale_order.partner_id.name, self.sale_order.name) + ) + for line in self.move_raw_ids: # if line.quantity_done > 0 and line.quantity_done != self.product_uom_qty: # raise UserError('Qty Consume per Line tidak sama dengan Qty to Produce') -- cgit v1.2.3