From 5dc329c18c278d8eaed23cfb0ea060ac7685cea2 Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Tue, 23 Apr 2024 10:40:18 +0700 Subject: Add customer procurement on sale order approval --- indoteknik_custom/models/sale_order.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'indoteknik_custom/models/sale_order.py') diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index f9f849ca..6f140072 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -95,6 +95,7 @@ class SaleOrder(models.Model): ('company', 'Company'), ('cust_manager', 'Customer Manager'), ('cust_director', 'Customer Director') + ('cust_procurement', 'Customer Procurement') ], string='Web Approval', copy=False) compute_fullfillment = fields.Boolean(string='Compute Fullfillment', compute="_compute_fullfillment") @@ -468,8 +469,8 @@ class SaleOrder(models.Model): 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 FROM_WEBSITE and main_parent.use_so_approval and order.web_approval != 'cust_procurement': + raise UserError("This order not yet approved by customer procurement") 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') -- cgit v1.2.3 From 175ee679cbd2af2245bc9468312a6ad28419e110 Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Thu, 25 Apr 2024 09:13:22 +0700 Subject: Fix sale order field syntax --- indoteknik_custom/models/sale_order.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indoteknik_custom/models/sale_order.py') diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index 6f140072..3b6879cd 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -94,7 +94,7 @@ class SaleOrder(models.Model): web_approval = fields.Selection([ ('company', 'Company'), ('cust_manager', 'Customer Manager'), - ('cust_director', 'Customer Director') + ('cust_director', 'Customer Director'), ('cust_procurement', 'Customer Procurement') ], string='Web Approval', copy=False) compute_fullfillment = fields.Boolean(string='Compute Fullfillment', compute="_compute_fullfillment") -- cgit v1.2.3 From d026ce987698790c8424a1b88d7bfacf1508dad6 Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Fri, 26 Apr 2024 11:12:56 +0700 Subject: Update approval by procurement --- indoteknik_custom/models/sale_order.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indoteknik_custom/models/sale_order.py') diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index 3b6879cd..88d9aec7 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -469,8 +469,8 @@ class SaleOrder(models.Model): 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_procurement': - raise UserError("This order not yet approved by customer procurement") + if FROM_WEBSITE and main_parent.use_so_approval and order.web_approval not in ['cust_procurement', 'cust_director']: + raise UserError("This order not yet approved by customer procurement or 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') -- cgit v1.2.3 From 3e2166de0c8ef7da2e22d060fce23e4f0d18cc95 Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Mon, 29 Apr 2024 13:24:54 +0700 Subject: Add email notification on sale order --- indoteknik_custom/models/sale_order.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'indoteknik_custom/models/sale_order.py') diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index 1c85914e..055b545a 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -459,6 +459,12 @@ class SaleOrder(models.Model): raise UserError("Bisa langsung Confirm") + def send_notif_to_salesperson(self): + for rec in self: + if not rec.partner_id.main_parent_id.use_so_approval: continue + template = self.env.ref('indoteknik_custom.mail_template_sale_order_notification_to_salesperson') + template.send_mail(rec.id, force_send=True) + def action_confirm(self): for order in self: order._validate_order() @@ -484,6 +490,7 @@ class SaleOrder(models.Model): order.approval_status = 'approved' order._set_sppkp_npwp_contact() order.calculate_line_no() + order.send_notif_to_salesperson() # order.order_line.get_reserved_from() res = super(SaleOrder, self).action_confirm() -- cgit v1.2.3