Currently, when the payment is done by the wire transfer or by sepa then the transaction is going to be in the 'pending' state and due to that confirmation mail will display the button as 'Sign and Pay Quotation' but is should be the 'view quotation'. So in this commit we check for the last transaction and if transaction status is 'pending' then display the 'View Quatation' instead of 'Sign and Pay Quatation'. We have not modified method has_to_be_paid because it's used to display the button on portal so still it will display the 'Sign and Pay' on portal. closes odoo/odoo#49389 Taskid: 2210990 Closes: #49389 Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
301 lines
15 KiB
XML
301 lines
15 KiB
XML
<?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 & Pay Quotation</t>
|
|
</t>
|
|
<t t-else="" t-set="access_name">Accept & 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 & 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 '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>
|