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') 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