summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorit-fixcomart <it@fixcomart.co.id>2025-03-14 10:08:50 +0700
committerit-fixcomart <it@fixcomart.co.id>2025-03-14 10:08:50 +0700
commit72bf5f78f3503f2a14c3a329653d0726a14d93c8 (patch)
treec2b4b14221ffb33b0dbe6112c68f6ebfecf7cf4f
parent29a64fa64c72c4cb263806b099775a18124a5da7 (diff)
<iman> update code
-rwxr-xr-xindoteknik_custom/models/sale_order.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py
index b311abda..aed0c1df 100755
--- a/indoteknik_custom/models/sale_order.py
+++ b/indoteknik_custom/models/sale_order.py
@@ -984,14 +984,14 @@ class SaleOrder(models.Model):
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")
+ if 'bom' in line.product_id.default_code.lower() or 'bom-it' in line.name.lower():
+ search_bom = self.env['mrp.production'].search([('product_id', '=', line.product_id.id)],order='name desc')
+ if search_bom:
+ confirmed_bom = search_bom.filtered(lambda x: x.state == 'confirmed')
+ if not confirmed_bom:
+ raise UserError("Product BOM belum dikonfirmasi di Manufacturing Orders. Silakan hubungi MD.")
else:
- if search_bom.state != 'confirmed':
- raise UserError("Product BOM belum di confirm di manufacturing orders, silahkan hubungi MD")
-
+ 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()