diff options
| author | Mqdd <ahmadmiqdad27@gmail.com> | 2026-02-13 09:42:53 +0700 |
|---|---|---|
| committer | Mqdd <ahmadmiqdad27@gmail.com> | 2026-02-13 09:42:53 +0700 |
| commit | 37e0beac646ee2e676ff935e8289cf3189b3c21b (patch) | |
| tree | 4293227b450dff219d831858c9501d07450d94cd | |
| parent | 387334dc0929087ac51cc09a90d2db15d79413f1 (diff) | |
<MIqdad> check archived uom and product in sale order confirm
| -rwxr-xr-x | indoteknik_custom/models/sale_order.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index 49e36279..2548c7b3 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -2598,6 +2598,18 @@ class SaleOrder(models.Model): else: return False + def check_archived_product(self): + for order in self: + for line in order.order_line: + if line.product_id.active == False: + raise UserError("Terdapat Product yang sudah di Archive pada Product: {}".format(line.product_id.display_name)) + + def check_archived_uom(self): + for order in self: + for line in order.order_line: + if line.product_uom.active == False: + raise UserError("Terdapat UoM yang sudah di Archive pada UoM {} di Product {}".format(line.product_uom.name, line.product_id.display_name)) + def action_confirm(self): for order in self: order._validate_delivery_amt() @@ -2614,6 +2626,8 @@ class SaleOrder(models.Model): order._validate_order() order._validate_npwp() order.order_line.validate_line() + order.check_archived_product() + order.check_archived_uom() main_parent = order.partner_id.get_main_parent() SYSTEM_UID = 25 |
