summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorit-fixcomart <it@fixcomart.co.id>2025-03-14 08:34:52 +0700
committerit-fixcomart <it@fixcomart.co.id>2025-03-14 08:34:52 +0700
commit29a64fa64c72c4cb263806b099775a18124a5da7 (patch)
treeefd78bc27676ccdec95e9a0ec4f9c400cb54fd67
parent0459c5c45d5b29aa63c00686bd500310c13e78bf (diff)
<iman> cr md bom
-rwxr-xr-xindoteknik_custom/models/sale_order.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py
index 14a8e688..b311abda 100755
--- a/indoteknik_custom/models/sale_order.py
+++ b/indoteknik_custom/models/sale_order.py
@@ -1,3 +1,5 @@
+from re import search
+
from odoo import fields, models, api, _
from odoo.exceptions import UserError, ValidationError
from datetime import datetime, timedelta
@@ -978,8 +980,20 @@ class SaleOrder(models.Model):
raise UserError("Customer Reference kosong, di isi dengan NO PO jika PO tidak ada mohon ditulis Tanpa PO")
if not order.user_id.active:
raise UserError("Salesperson sudah tidak aktif, mohon diisi yang benar pada data SO dan Contact")
-
+
+ def check_product_bom(self):
+ for order in self:
+ for line in order.order_line:
+ if 'bom' in line.product_id.default_code:
+ search_bom = self.env['mrp.production'].search([('product_id', '=', line.id)], limit=1,)
+ if not search_bom:
+ raise UserError("Product BOM belum ada di manufacturing orders, silahkan hubungi MD")
+ else:
+ if search_bom.state != 'confirmed':
+ raise UserError("Product BOM belum di confirm di manufacturing orders, silahkan hubungi MD")
+
def sale_order_approve(self):
+ self.check_product_bom()
self.check_credit_limit()
self.check_limit_so_to_invoice()
if self.validate_different_vendor() and not self.vendor_approval: