diff options
| -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) |
