summaryrefslogtreecommitdiff
path: root/addons/sale/data/mail_data.xml
blob: fc13b95414e9ff1b5aa3c7902289774476b17295 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
<?xml version="1.0" encoding="utf-8"?>
<odoo>
    <data noupdate="1">
        <!-- Activities -->
        <record id="mail_act_sale_upsell" model="mail.activity.type">
            <field name="name">Order Upsell</field>
            <field name="icon">fa-line-chart</field>
            <field name="res_model_id" ref="sale.model_sale_order"/>
        </record>

        <!-- Sale-related subtypes for messaging / Chatter -->
        <record id="mt_order_sent" model="mail.message.subtype">
            <field name="name">Quotation sent</field>
            <field name="res_model">sale.order</field>
            <field name="default" eval="False"/>
            <field name="description">Quotation sent</field>
        </record>
        <record id="mt_order_confirmed" model="mail.message.subtype">
            <field name="name">Sales Order Confirmed</field>
            <field name="res_model">sale.order</field>
            <field name="default" eval="False"/>
            <field name="description">Quotation confirmed</field>
        </record>

        <!-- Salesteam-related subtypes for messaging / Chatter -->
        <record id="mt_salesteam_order_sent" model="mail.message.subtype">
            <field name="name">Quotation sent</field>
            <field name="sequence">20</field>
            <field name="res_model">crm.team</field>
            <field name="default" eval="True"/>
            <field name="parent_id" ref="sale.mt_order_sent"/>
            <field name="relation_field">team_id</field>
        </record>
        <record id="mt_salesteam_order_confirmed" model="mail.message.subtype">
            <field name="name">Sales Order Confirmed</field>
            <field name="sequence">21</field>
            <field name="res_model">crm.team</field>
            <field name="default" eval="True"/>
            <field name="parent_id" ref="sale.mt_order_confirmed"/>
            <field name="relation_field">team_id</field>
        </record>
        <record id="mt_salesteam_invoice_created" model="mail.message.subtype">
            <field name="name">Invoice Created</field>
            <field name="sequence">22</field>
            <field name="res_model">crm.team</field>
            <field name="parent_id" ref="account.mt_invoice_created"/>
            <field name="relation_field">team_id</field>
        </record>
        <record id="mt_salesteam_invoice_confirmed" model="mail.message.subtype">
            <field name="name">Invoice Confirmed</field>
            <field name="sequence">23</field>
            <field name="res_model">crm.team</field>
            <field name="parent_id" ref="account.mt_invoice_validated"/>
            <field name="relation_field">team_id</field>
        </record>
    </data>
    <!-- Template and notification section -->
    <data noupdate="1">
        <template id="mail_notification_paynow_online" inherit_id="mail.mail_notification_paynow"
            name="Quotation: Sign and Pay mail notification template">
            <xpath expr="//t[@t-set='access_name']" position="after">
                <t t-if="record._name == 'sale.order'">
                    <t t-set="is_transaction_pending" t-value="record.get_portal_last_transaction().state == 'pending'"/>
                    <t t-if="record.has_to_be_signed(include_draft=True)">
                        <t t-if="record.has_to_be_paid()" t-set="access_name">
                            <t t-if="is_transaction_pending">View Quotation</t>
                            <t t-else="">Sign &amp; Pay Quotation</t>
                        </t>
                        <t t-else="" t-set="access_name">Accept &amp; Sign Quotation</t>
                    </t>
                    <t t-elif="record.has_to_be_paid(include_draft=True) and not is_transaction_pending">
                        <t t-set="access_name">Accept &amp; Pay Quotation</t>
                    </t>
                    <t t-elif="record.state in ('draft', 'sent')">
                        <t t-set="access_name">View Quotation</t>
                    </t>
                </t>
            </xpath>
        </template>

        <record id="email_template_edi_sale" model="mail.template">
            <field name="name">Sales Order: Send by email</field>
            <field name="model_id" ref="sale.model_sale_order"/>
            <field name="subject">${object.company_id.name} ${object.state in ('draft', 'sent') and (ctx.get('proforma') and 'Proforma' or 'Quotation') or 'Order'} (Ref ${object.name or 'n/a' })</field>
            <field name="email_from">${(object.user_id.email_formatted or user.email_formatted) | safe}</field>
            <field name="partner_to">${object.partner_id.id}</field>
            <field name="body_html" type="html">
<div style="margin: 0px; padding: 0px;">
    <p style="margin: 0px; padding: 0px; font-size: 13px;">
        % set doc_name = 'quotation' if object.state in ('draft', 'sent') else 'order'
        Hello,
        <br/><br/>
        Your
        % if ctx.get('proforma'):
            Pro forma invoice for ${doc_name} <strong>${object.name}</strong>
            % if object.origin:
                (with reference: ${object.origin} )
            % endif
            amounting in <strong>${format_amount(object.amount_total, object.pricelist_id.currency_id)}</strong> is available.
        % else:
            ${doc_name} <strong>${object.name}</strong>
            % if object.origin:
                (with reference: ${object.origin} )
            % endif
            amounting in <strong>${format_amount(object.amount_total, object.pricelist_id.currency_id)}</strong> is ready for review.
        % endif
        <br/><br/>
        Do not hesitate to contact us if you have any questions.
        <br/>
    </p>
</div>
            </field>
            <field name="report_template" ref="action_report_saleorder"/>
            <field name="report_name">${(object.name or '').replace('/','_')}</field>
            <field name="lang">${object.partner_id.lang}</field>
            <field name="auto_delete" eval="True"/>
        </record>

        <record id="mail_template_sale_confirmation" model="mail.template">
            <field name="name">Sales Order: Confirmation Email</field>
            <field name="model_id" ref="sale.model_sale_order"/>
            <field name="subject">${object.company_id.name} ${(object.get_portal_last_transaction().state == 'pending') and 'Pending Order' or 'Order'} (Ref ${object.name or 'n/a' })</field>
            <field name="email_from">${(object.user_id.email_formatted or user.email_formatted) | safe}</field>
            <field name="partner_to">${object.partner_id.id}</field>
            <field name="body_html" type="html">
<div style="margin: 0px; padding: 0px;">
    <p style="margin: 0px; padding: 0px; font-size: 12px;">
        Hello,
        <br/><br/>
        % set transaction = object.get_portal_last_transaction()
        Your order <strong>${object.name}</strong> amounting in <strong>${format_amount(object.amount_total, object.currency_id)}</strong>
        % if object.state == 'sale' or (transaction and transaction.state in ('done', 'authorized')) :
            has been confirmed.<br/>
            Thank you for your trust!
        % elif transaction and transaction.state == 'pending' :
            is pending. It will be confirmed when the payment is received.
            % if object.reference:
                Your payment reference is <strong>${object.reference}</strong>.
            % endif
        % endif
        <br/><br/>
        Do not hesitate to contact us if you have any questions.
        <br/><br/>
    </p>
% if object.website_id:
    <div style="margin: 0px; padding: 0px;">
        <table width="100%" style="color: #454748; font-size: 12px; border-collapse: collapse;">
            <tr style="border-bottom: 2px solid #dee2e6;">
                <td style="width: 150px;"><strong>Products</strong></td>
                <td></td>
                <td width="15%" align="center"><strong>Quantity</strong></td>
                <td width="20%" align="right"><strong>
                % if object.user_id.has_group('account.group_show_line_subtotals_tax_excluded'):
                    VAT Excl.
                % else
                    VAT Incl.
                % endif
                </strong></td>
            </tr>
        </table>
        % for line in object.order_line:
            % if not line.is_delivery and line.display_type in ['line_section', 'line_note']:
                <table width="100%" style="color: #454748; font-size: 12px; border-collapse: collapse;">
                    <tr style="${loop.cycle('background-color: #f2f2f2', 'background-color: #ffffff')}">
                        <td colspan="4">
                            % if line.display_type == 'line_section':
                                <strong>${line.name}</strong>
                            % elif line.display_type == 'line_note':
                                <i>${line.name}</i>
                            % endif
                        </td>
                    </tr>
                </table>
            % elif not line.is_delivery
                <table width="100%" style="color: #454748; font-size: 12px; border-collapse: collapse;">
                    <tr style="${loop.cycle('background-color: #f2f2f2', 'background-color: #ffffff')}">
                        <td style="width: 150px;">
                            <img src="/web/image/product.product/${line.product_id.id}/image_128" style="width: 64px; height: 64px; object-fit: contain;" alt="Product image"></img>
                        </td>
                        <td align="left">${line.product_id.name}</td>
                        <td width="15%" align="center">${line.product_uom_qty}</td>
                        <td width="20%" align="right"><strong>
                        % if object.user_id.has_group('account.group_show_line_subtotals_tax_excluded'):
                            ${format_amount(line.price_reduce_taxexcl, object.currency_id)}
                        % else
                            ${format_amount(line.price_reduce_taxinc, object.currency_id)}
                        % endif
                        </strong></td>
                    </tr>
                </table>
            % endif
        % endfor
    </div>
    % if object.carrier_id:
    <div style="margin: 0px; padding: 0px;">
        <table width="100%" style="color: #454748; font-size: 12px; border-spacing: 0px 4px;" align="right">
            <tr>
                <td style="width: 60%"/>
                <td style="width: 30%; border-top: 1px solid #dee2e6;" align="right"><strong>Delivery:</strong></td>
                <td style="width: 10%; border-top: 1px solid #dee2e6;" align="right">${format_amount(object.amount_delivery, object.currency_id)}</td>
            </tr>
            <tr>
                <td style="width: 60%"/>
                <td style="width: 30%;" align="right"><strong>SubTotal:</strong></td>
                <td style="width: 10%;" align="right">${format_amount(object.amount_untaxed, object.currency_id)}</td>
            </tr>
        </table>
    </div>
    % else:
    <div style="margin: 0px; padding: 0px;">
        <table width="100%" style="color: #454748; font-size: 12px; border-spacing: 0px 4px;" align="right">
            <tr>
                <td style="width: 60%"/>
                <td style="width: 30%; border-top: 1px solid #dee2e6;" align="right"><strong>SubTotal:</strong></td>
                <td style="width: 10%; border-top: 1px solid #dee2e6;" align="right">${format_amount(object.amount_untaxed, object.currency_id)}</td>
            </tr>
        </table>
    </div>
    % endif
    <div style="margin: 0px; padding: 0px;">
        <table width="100%" style="color: #454748; font-size: 12px; border-spacing: 0px 4px;" align="right">
            <tr>
                <td style="width: 60%"/>
                <td style="width: 30%;" align="right"><strong>Taxes:</strong></td>
                <td style="width: 10%;" align="right">${format_amount(object.amount_tax, object.currency_id)}</td>
            </tr>
            <tr>
                <td style="width: 60%"/>
                <td style="width: 30%; border-top: 1px solid #dee2e6;" align="right"><strong>Total:</strong></td>
                <td style="width: 10%; border-top: 1px solid #dee2e6;" align="right">${format_amount(object.amount_total, object.currency_id)}</td>
            </tr>
        </table>
    </div>
    % if object.partner_invoice_id:
    <div style="margin: 0px; padding: 0px;">
        <table width="100%" style="color: #454748; font-size: 12px;">
            <tr>
                <td style="padding-top: 10px;">
                    <strong>Bill to:</strong>
                    ${object.partner_invoice_id.street or ''}
                    ${object.partner_invoice_id.city or ''}
                    ${object.partner_invoice_id.state_id.name or ''}
                    ${object.partner_invoice_id.zip or ''}
                    ${object.partner_invoice_id.country_id.name or ''}
                </td>
            </tr>
            <tr>
                <td>
                    <strong>Payment Method:</strong>
                    % if transaction.payment_token_id:
                        ${transaction.payment_token_id.name}
                    % else:
                        ${transaction.acquirer_id.name}
                    % endif
                     (${format_amount(transaction.amount, object.currency_id)})
                </td>
            </tr>
        </table>
    </div>
    % endif
    % if object.partner_shipping_id and not object.only_services:
    <div style="margin: 0px; padding: 0px;">
        <table width="100%" style="color: #454748; font-size: 12px;">
            <tr>
                <td>
                    <br/>
                    <strong>Ship to:</strong>
                    ${object.partner_shipping_id.street or ''}
                    ${object.partner_shipping_id.city or ''}
                    ${object.partner_shipping_id.state_id.name or ''}
                    ${object.partner_shipping_id.zip or ''}
                    ${object.partner_shipping_id.country_id.name or ''}
                </td>
            </tr>
        </table>
        % if object.carrier_id:
        <table width="100%" style="color: #454748; font-size: 12px;">
            <tr>
                <td>
                    <strong>Shipping Method:</strong>
                    ${object.carrier_id.name}
                    % if object.carrier_id.fixed_price == 0.0:
                        (Free)
                    % else:
                        (${format_amount(object.carrier_id.fixed_price, object.currency_id)})
                    % endif
                </td>
            </tr>
        </table>
        % endif
    </div>
    % endif
% endif
</div></field>
            <field name="report_template" ref="action_report_saleorder"/>
            <field name="report_name">${(object.name or '').replace('/','_')}</field>
            <field name="lang">${object.partner_id.lang}</field>
            <field name="auto_delete" eval="True"/>
        </record>
    </data>
</odoo>