diff options
| author | AndriFP <andrifebriyadiputra@gmail.com> | 2025-04-28 14:42:51 +0700 |
|---|---|---|
| committer | AndriFP <andrifebriyadiputra@gmail.com> | 2025-04-28 14:42:51 +0700 |
| commit | 082a4cf4c1f109644cb5c7a45ed1d3ffa69b1b06 (patch) | |
| tree | 4c0308065ab749cdbf40e84a56c4f6e0fd2d3380 | |
| parent | a2a05e1183f9829b09d2e065815cb3618cc05049 (diff) | |
(andri) Add validation: BOM cannot be mark done if SO has not been confirmed
| -rw-r--r-- | indoteknik_custom/models/manufacturing.py | 7 |
1 files changed, 7 insertions, 0 deletions
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') |
