summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models/mrp_production.py
diff options
context:
space:
mode:
authorAzka Nathan <darizkyfaz@gmail.com>2025-03-27 16:20:05 +0700
committerAzka Nathan <darizkyfaz@gmail.com>2025-03-27 16:20:05 +0700
commitb105f669873645f29314be55aac45d95d0556970 (patch)
treeba934dfaaf3e3adba0f42598c432cddd6ee1fa98 /indoteknik_custom/models/mrp_production.py
parent1e3da858c3d924a8fc61c83115ffce654198b10b (diff)
fix bug
Diffstat (limited to 'indoteknik_custom/models/mrp_production.py')
-rw-r--r--indoteknik_custom/models/mrp_production.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/indoteknik_custom/models/mrp_production.py b/indoteknik_custom/models/mrp_production.py
index 1813dbeb..d80df2ce 100644
--- a/indoteknik_custom/models/mrp_production.py
+++ b/indoteknik_custom/models/mrp_production.py
@@ -11,6 +11,7 @@ class MrpProduction(models.Model):
desc = fields.Text(string='Description')
sale_order = fields.Many2one('sale.order', string='Sale Order', required=True, 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')
def action_confirm(self):
"""Override action_confirm untuk mengirim pesan ke Sale Order jika state berubah menjadi 'confirmed'."""
@@ -31,6 +32,9 @@ class MrpProduction(models.Model):
if not self.state == 'confirmed':
raise UserError('Harus Di Approve oleh Merchandiser')
+ if self.is_po == True:
+ raise UserError('Sudah pernah di buat PO')
+
if not self.move_raw_ids:
raise UserError('Tidak ada Lines, belum bisa create PO')
# if self.is_po:
@@ -115,7 +119,8 @@ class MrpProduction(models.Model):
'production_id': self.id,
'order_id': new_po.id
}])
- # self.is_po = True
+
+ self.is_po = True
return po_ids