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