diff options
| -rwxr-xr-x | indoteknik_custom/models/sale_order.py | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index e6fc4732..d42aefcc 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -2601,12 +2601,22 @@ class SaleOrder(models.Model): 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)) + # Skip section & note + if line.display_type: + continue + + if line.product_id and not line.product_id.active: + 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.display_type: + continue 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)) |
