diff options
| author | Azka Nathan <darizkyfaz@gmail.com> | 2025-04-30 11:49:18 +0700 |
|---|---|---|
| committer | Azka Nathan <darizkyfaz@gmail.com> | 2025-04-30 11:49:18 +0700 |
| commit | 7b5b79e03e08dff76981dd9734d20c52f90c0b36 (patch) | |
| tree | db2bce5c8695caebdc0feb1ff037d66b337fa02d | |
| parent | 475173ec46981926aa90e99f796e38ef1d46b61e (diff) | |
cr mrp production sale order required
| -rw-r--r-- | indoteknik_custom/models/mrp_production.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/indoteknik_custom/models/mrp_production.py b/indoteknik_custom/models/mrp_production.py index ebbd1c24..87d75faf 100644 --- a/indoteknik_custom/models/mrp_production.py +++ b/indoteknik_custom/models/mrp_production.py @@ -10,7 +10,7 @@ class MrpProduction(models.Model): check_bom_product_lines = fields.One2many('check.bom.product', 'production_id', string='Check Product', auto_join=True, copy=False) desc = fields.Text(string='Description') - sale_order = fields.Many2one('sale.order', string='Sale Order', required=True, copy=False) + sale_order = fields.Many2one('sale.order', string='Sale Order', copy=False) production_purchase_match = fields.One2many('production.purchase.match', 'production_id', string='Purchase Matches', auto_join=True) is_po = fields.Boolean(string='Is PO') @@ -30,6 +30,8 @@ class MrpProduction(models.Model): for record in self: if len(record.check_bom_product_lines) < 1: raise UserError("Check Product Tidak Boleh Kosong") + if not record.sale_order: + raise UserError("Sale Order Tidak Boleh Kosong") if record.sale_order and record.state == 'confirmed': message = _("Manufacturing order telah dibuat dengan nomor %s") % (record.name) record.sale_order.message_post(body=message) @@ -327,6 +329,8 @@ class CheckBomProduct(models.Model): ) for move in moves_to_reset: move.quantity_done = 0.0 + + production.qty_producing = 0 # Also sync remaining products in case their totals changed self._sync_check_product_to_moves(production) |
