summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafi Zadanly <zadanlyr@gmail.com>2024-04-23 10:40:18 +0700
committerRafi Zadanly <zadanlyr@gmail.com>2024-04-23 10:40:18 +0700
commit5dc329c18c278d8eaed23cfb0ea060ac7685cea2 (patch)
tree0768aae2952871247a26274ddaddb4665a48fee5
parent7856f737e40c39eefa0f27d2247a649c5381d3c3 (diff)
Add customer procurement on sale order approval
-rw-r--r--indoteknik_api/controllers/api_v1/sale_order.py2
-rw-r--r--indoteknik_custom/models/res_partner.py5
-rwxr-xr-xindoteknik_custom/models/sale_order.py5
3 files changed, 7 insertions, 5 deletions
diff --git a/indoteknik_api/controllers/api_v1/sale_order.py b/indoteknik_api/controllers/api_v1/sale_order.py
index 382a90f4..40936a82 100644
--- a/indoteknik_api/controllers/api_v1/sale_order.py
+++ b/indoteknik_api/controllers/api_v1/sale_order.py
@@ -160,7 +160,7 @@ class SaleOrder(controller.Controller):
if partner.web_role:
sale_order.web_approval = 'cust_%s' % partner.web_role
- if sale_order.web_approval == 'cust_director':
+ if sale_order.web_approval == 'cust_procurement':
sale_order.approval_status = 'pengajuan1'
return self.response('success')
diff --git a/indoteknik_custom/models/res_partner.py b/indoteknik_custom/models/res_partner.py
index 5a62596d..ad6fd6ec 100644
--- a/indoteknik_custom/models/res_partner.py
+++ b/indoteknik_custom/models/res_partner.py
@@ -28,7 +28,8 @@ class ResPartner(models.Model):
use_only_ready_stock = fields.Boolean(string='Use Only Ready Stock')
web_role = fields.Selection([
('manager', 'Manager'),
- ('director', 'Director')
+ ('director', 'Director'),
+ ('procurement', 'Procurement'),
], string='Web Role')
def get_child_ids(self):
@@ -41,7 +42,7 @@ class ResPartner(models.Model):
def get_approve_partner_ids(self, type=False):
parent = self.parent_id or self
- partners = self.search([('parent_id', '=', parent.id), ('web_role', 'in', ['manager', 'director'])])
+ partners = self.search([('parent_id', '=', parent.id), ('web_role', '!=', False)])
if type == 'email_comma_sep':
return ",".join([x.email for x in partners])
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')