From 29dfec334ebf6a15a8a66e4af564fd5d812d8d67 Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Wed, 6 Mar 2024 15:42:12 +0700 Subject: Add validation confirm when partner use approval feature --- indoteknik_custom/models/sale_order.py | 7 +++++++ indoteknik_custom/views/res_partner.xml | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index fb6a457d..0cd7067a 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -450,6 +450,13 @@ class SaleOrder(models.Model): order._validate_order() order.order_line.validate_line() + main_parent = order.partner_id.get_main_parent() + SYSTEM_UID = 25 + FROM_WEBSITE = order.create_uid.id == SYSTEM_UID + + if FROM_WEBSITE and main_parent.use_so_approval and order.web_approval != 'cust_director': + raise UserError("This order not yet approved by customer director") + if order.validate_partner_invoice_due(): return self._create_notification_action('Notification', 'Terdapat invoice yang telah melewati batas waktu, mohon perbarui pada dokumen Due Extension') diff --git a/indoteknik_custom/views/res_partner.xml b/indoteknik_custom/views/res_partner.xml index c050ec62..370fcf7b 100644 --- a/indoteknik_custom/views/res_partner.xml +++ b/indoteknik_custom/views/res_partner.xml @@ -28,7 +28,7 @@ - + -- cgit v1.2.3