diff options
| author | Rafi Zadanly <zadanlyr@gmail.com> | 2024-04-29 13:24:54 +0700 |
|---|---|---|
| committer | Rafi Zadanly <zadanlyr@gmail.com> | 2024-04-29 13:24:54 +0700 |
| commit | 3e2166de0c8ef7da2e22d060fce23e4f0d18cc95 (patch) | |
| tree | 83b3bf341cd1bf8b10c374f0b93ba88b567608f2 | |
| parent | 074b99031f5123976bb67aab1cf1a6286464e724 (diff) | |
Add email notification on sale order
| -rwxr-xr-x | indoteknik_custom/models/sale_order.py | 7 | ||||
| -rwxr-xr-x | indoteknik_custom/views/sale_order.xml | 56 |
2 files changed, 63 insertions, 0 deletions
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() diff --git a/indoteknik_custom/views/sale_order.xml b/indoteknik_custom/views/sale_order.xml index 23905ef7..df72f618 100755 --- a/indoteknik_custom/views/sale_order.xml +++ b/indoteknik_custom/views/sale_order.xml @@ -306,4 +306,60 @@ </field> </record> </data> + + <data> + <record id="mail_template_sale_order_notification_to_salesperson" model="mail.template"> + <field name="name">Sale Order: Notification to Salesperson</field> + <field name="model_id" ref="sale.model_sale_order"/> + <field name="subject">Konsolidasi Pengiriman</field> + <field name="email_from">sales@indoteknik.com</field> + <field name="email_to">${object.user_id.login | safe}</field> + <field name="body_html" type="html"> + <table border="0" cellpadding="0" cellspacing="0" style="padding-top: 16px; background-color: #F1F1F1; font-family:Inter, Helvetica, Verdana, Arial,sans-serif; line-height: 24px; color: #454748; width: 100%; border-collapse:separate;"> + <tr><td align="center"> + <table border="0" cellpadding="0" cellspacing="0" width="590" style="font-size: 13px; padding: 16px; background-color: white; color: #454748; border-collapse:separate;"> + <!-- HEADER --> + <tbody> + <tr> + <td align="center" style="min-width: 590px;"> + <table border="0" cellpadding="0" cellspacing="0" width="590" style="min-width: 590px; background-color: white; padding: 0px 8px 0px 8px; border-collapse:separate;"> + <tr> + <td valign="middle"> + <span></span> + </td> + </tr> + + <tr> + <td colspan="2" style="text-align:center;"> + <hr width="100%" style="background-color:rgb(204,204,204);border:medium none;clear:both;display:block;font-size:0px;min-height:1px;line-height:0; margin: 16px 0px 16px 0px;" /> + </td> + </tr> + </table> + </td> + </tr> + <!-- CONTENT --> + <tr> + <td align="center" style="min-width: 590px;"> + <table border="0" cellpadding="0" cellspacing="0" width="590" style="min-width: 590px; background-color: white; padding: 0px 8px 0px 8px; border-collapse:separate;"> + <tr><td style="padding-bottom: 24px;">Dear ${object.user_id.name},</td></tr> + + <tr><td style="padding-bottom: 16px;">Terdapat pesanan ${object.name} dari ${object.partner_id.main_parent_id.name} untuk site ${object.partner_shipping_id.site_id.name | 'X'} dengan total pembelian ${object.grand_total}</td></tr> + + <tr> + <td style="text-align:center;"> + <hr width="100%" + style="background-color:rgb(204,204,204);border:medium none;clear:both;display:block;font-size:0px;min-height:1px;line-height:0; margin: 16px 0px 16px 0px;" /> + </td> + </tr> + </table> + </td> + </tr> + <!-- CONTENT --> + </tbody> + </table> + </td></tr> + </table> + </field> + </record> + </data> </odoo>
\ No newline at end of file |
