Skip to Content
Menu
This question has been flagged
1 Reply
1573 Views

How to adapt your Email Template for Invoice vs Refund (customer) ?

Avatar
Discard
Author Best Answer

Hello,


When sending a refund by email, the default template is not update as it should. 

If it is a refund, Odoo still shows Invoice in the email. 

This can mislead the customer. 


Object update: 

${object.company_id.name}  ${object.type in ('out_refund') and 'Refund' or 'Invoice'} (Ref ${object.number or 'n/a'})


Body update:

<div>

<p>Dear ${object.partner_id.name}

% set access_action = object.with_context(force_website=True).get_access_action()

% set is_online = access_action and access_action['type'] == 'ir.actions.act_url'

% set access_url = object.get_mail_url()


% if object.partner_id.parent_id:

    (<i>${object.partner_id.parent_id.name}</i>)

% endif

,</p>

<p>Here is, in attachment, your 

% if object.number:

% if object.type=='out_refund': 

refund <strong>${object.number}</strong>

% else:

invoice <strong>${object.number}</strong>

% endif

% else:

% if object.type=='out_refund':

refund

% else:

invoice

% endif

% endif

% if object.origin:

(with reference: ${object.origin})

% endif

amounting in <strong>${format_amount(object.amount_total, object.currency_id)}</strong>

from ${object.company_id.name}.

</p>


% if is_online:

    <br><br>

    <center>

      <a href="${access_url}" style="background-color: #1abc9c; padding: 20px; text-decoration: none; color: #fff; border-radius: 5px; font-size: 16px;" class="o_default_snippet_text">View Document</a>

    </center>

% endif

    <br><br>


% if object.type=='out_refund':

% if object.partner_id.bank_account_count != 0:

<p> Payment will be done on your bank account.</p>

% else:

<p>Please, send us your bank account details.</p>

%endif

%endif


% if object.state=='paid':

   <p>This invoice has been paid. If you are a direct debit customer we will debit your account on the due date of your invoice.</p> 

% else:

   <p>Please remit payment at your earliest convenience.</p>

% endif


<p>Thank you,</p>

<p style="color:#888888">

% if object.user_id and object.user_id.signature:

    ${object.user_id.signature | safe}

% endif

</p>

</div>

Avatar
Discard
Related Posts Replies Views Activity
2
Sep 24
1446
2
May 24
2787
2
Aug 21
6082
1
May 21
1754
3
Sep 24
2701