diff options
| author | IT Fixcomart <it@fixcomart.co.id> | 2024-05-10 07:43:40 +0000 |
|---|---|---|
| committer | IT Fixcomart <it@fixcomart.co.id> | 2024-05-10 07:43:40 +0000 |
| commit | e2cf27c1fc540ad24b457d23c89ddd1ea4e6034a (patch) | |
| tree | a635964dbd0b9729c1d161e16ca7e8dabb02a3c8 /indoteknik_custom/models/sale_order.py | |
| parent | cb9ae6021dd4858372ed78d16ab491226c95f1d2 (diff) | |
| parent | 844339e517540826f6990456a63945dc879e37d5 (diff) | |
Merged in dev/request-by-abl (pull request #141)
Dev/request by abl
Diffstat (limited to 'indoteknik_custom/models/sale_order.py')
| -rwxr-xr-x | indoteknik_custom/models/sale_order.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index 620953b9..aa34b0f4 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -93,7 +93,8 @@ 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") @@ -458,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() @@ -467,8 +474,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 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') @@ -483,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() |
