mirror of
https://github.com/OCA/bank-payment.git
synced 2025-02-02 10:37:31 +02:00
[MIG] account_payment_order_vendor_email: Migrated to v16
This commit is contained in:
committed by
Jordi Ballester Alomar
parent
b5aa3d54e1
commit
67ebba1ca2
@@ -3,10 +3,10 @@
|
||||
|
||||
{
|
||||
"name": "Account Payment Order Email",
|
||||
"version": "14.0.2.0.0",
|
||||
"version": "16.0.1.0.0",
|
||||
"license": "AGPL-3",
|
||||
"author": "Open Source Integrators, Odoo Community Association (OCA)",
|
||||
"maintainers": [],
|
||||
"maintainers": ["ursais"],
|
||||
"website": "https://github.com/OCA/bank-payment",
|
||||
"category": "Accounting",
|
||||
"depends": ["account_payment_order", "account_payment_mode"],
|
||||
|
||||
@@ -7,245 +7,343 @@
|
||||
name="model_id"
|
||||
ref="account_payment_order.model_account_payment_order"
|
||||
/>
|
||||
<field
|
||||
name="email_from"
|
||||
>${object.company_id.name | safe} <${(object.company_id.email or user.email) | safe}></field>
|
||||
<field name="email_from"> {{ object.company_id.email or user.email }}</field>
|
||||
<field name="email_cc" />
|
||||
<field name="subject">Remittance Advice</field>
|
||||
<field name="auto_delete" eval="True" />
|
||||
<field name="lang">${object.generated_user_id.lang}</field>
|
||||
<field
|
||||
name="body_html"
|
||||
><![CDATA[
|
||||
<field name="lang">{{ object.generated_user_id.lang }}</field>
|
||||
<field name="body_html" type="html">
|
||||
<table
|
||||
border="0"
|
||||
cellpadding="0"
|
||||
cellspacing="0"
|
||||
style="padding-top: 16px; background-color: white; font-family:Verdana, Arial,sans-serif; color: #454748; min-width:800px; border-collapse:separate;"
|
||||
><tr><td align="center">
|
||||
<table
|
||||
border="0"
|
||||
cellpadding="0"
|
||||
cellspacing="0"
|
||||
width="800"
|
||||
style="padding: 16px; background-color: white; color: #454748; border-collapse:separate;"
|
||||
>
|
||||
</table>
|
||||
</td></tr>
|
||||
<tbody>
|
||||
<!-- HEADER -->
|
||||
<tr>
|
||||
<td align="center" style="min-width: 800px;">
|
||||
<table
|
||||
border="0"
|
||||
cellpadding="0"
|
||||
cellspacing="0"
|
||||
width="590"
|
||||
style="min-width: 800px; background-color: white; padding: 0px 8px 0px 8px; border-collapse:collapse;"
|
||||
>
|
||||
<tr><td style="min-width:750px;" valign="middle">
|
||||
border="0"
|
||||
cellpadding="0"
|
||||
cellspacing="0"
|
||||
style="padding-top: 16px; background-color: white; font-family:Verdana, Arial,sans-serif; color: #454748; min-width:800px; border-collapse:separate;"
|
||||
>
|
||||
<tr>
|
||||
<td align="center">
|
||||
<table
|
||||
border="0"
|
||||
cellpadding="0"
|
||||
cellspacing="0"
|
||||
width="800"
|
||||
style="padding: 16px; background-color: white; color: #454748; border-collapse:separate;"
|
||||
>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tbody>
|
||||
<!-- HEADER -->
|
||||
<tr>
|
||||
<td align="center" style="min-width: 800px;">
|
||||
<table
|
||||
border="0"
|
||||
cellpadding="0"
|
||||
cellspacing="0"
|
||||
width="590"
|
||||
style="min-width: 800px; background-color: white; padding: 0px 8px 0px 8px; border-collapse:collapse;"
|
||||
>
|
||||
<tr>
|
||||
<td style="min-width:750px;" valign="middle">
|
||||
<span style="font-size: 10px;">Remittance
|
||||
Advice</span><br/>
|
||||
<span
|
||||
style="font-size: 20px; font-weight: bold;"
|
||||
>
|
||||
${object.name}
|
||||
Advice
|
||||
</span>
|
||||
</td><td valign="middle" align="right">
|
||||
<br />
|
||||
<span
|
||||
style="font-size: 20px; font-weight: bold;"
|
||||
>
|
||||
<t t-out="object.name or ''" />
|
||||
</span>
|
||||
</td>
|
||||
<td valign="middle" align="right">
|
||||
<img
|
||||
src="/logo.png?company=${object.company_id.id}"
|
||||
style="padding: 0px; margin: 0px; height: auto; width: 80px;"
|
||||
alt="${object.company_id.name}"
|
||||
src="/logo.png?company=${object.company_id.id}"
|
||||
style="padding: 0px; margin: 0px; height: auto; width: 80px;"
|
||||
alt="${object.company_id.name}"
|
||||
/>
|
||||
</td></tr>
|
||||
<tr><td colspan="2" style="text-align:center;min-width:750px;"">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td
|
||||
colspan="2"
|
||||
style="text-align:center;min-width:750px;"
|
||||
>
|
||||
<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;"
|
||||
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>
|
||||
<tr>
|
||||
<td align="center" style="min-width: 800px;">
|
||||
<table
|
||||
border="0"
|
||||
cellpadding="0"
|
||||
cellspacing="0"
|
||||
width="590"
|
||||
style="min-width: 800px; background-color: white; padding: 0px 8px 0px 8px; border-collapse:collapse;"
|
||||
>
|
||||
<tr><td valign="top" style="font-size: 13px;">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center" style="min-width: 800px;">
|
||||
<table
|
||||
border="0"
|
||||
cellpadding="0"
|
||||
cellspacing="0"
|
||||
width="590"
|
||||
style="min-width: 800px; background-color: white; padding: 0px 8px 0px 8px; border-collapse:collapse;"
|
||||
>
|
||||
<tr>
|
||||
<td valign="top" style="font-size: 13px;">
|
||||
<div>
|
||||
Dear ${object.name},<br/><br/>
|
||||
A payment was processed on ${ctx['date']}
|
||||
for ${ctx['partner_name']} in the amount of
|
||||
${ctx['total_amount']} with reference
|
||||
${ctx['payment_ref']}.<br/><br/>
|
||||
% set line_dict = ctx.get('line_data',False)
|
||||
% for line in line_dict:
|
||||
<table style="min-width:800px;background-color: white; padding: 0px 8px 0px 8px; border-collapse: collapse;" width="800">
|
||||
<tr>
|
||||
<td style="border:1px solid #000000;width:80px; min-width:80px; max-width: 80px;">
|
||||
% if line == line_dict[0]:
|
||||
<b>
|
||||
${line.get("inv_date") or ''}
|
||||
</b>
|
||||
% else:
|
||||
${line.get("inv_date") or ''}
|
||||
% endif
|
||||
</td>
|
||||
<td style="border:1px solid #000000;width:150px; min-width:150px; max-width: 150px;" >
|
||||
% if line == line_dict[0]:
|
||||
<b>
|
||||
${line.get("inv_no") or ''}
|
||||
</b>
|
||||
% else:
|
||||
${line.get("inv_no") or ''}
|
||||
% endif
|
||||
</td>
|
||||
<td style="border:1px solid #000000;width:70px; min-width:70px; max-width: 70px;" >
|
||||
% if line == line_dict[0]:
|
||||
<b>
|
||||
${line.get("credit_ref") or ''}
|
||||
</b>
|
||||
% else:
|
||||
${line.get("credit_ref") or ''}
|
||||
% endif
|
||||
</td>
|
||||
<td style="border:1px solid #000000;width:150px; min-width:150px; max-width: 150px;" >
|
||||
% if line == line_dict[0]:
|
||||
<b>
|
||||
${line.get("supp_inv") or ''}
|
||||
</b>
|
||||
% else:
|
||||
${line.get("supp_inv") or ''}
|
||||
% endif
|
||||
</td>
|
||||
<td style="border:1px solid #000000;width:70px; min-width:70px; max-width: 70px;" >
|
||||
% if line == line_dict[0]:
|
||||
<b>
|
||||
${line.get("payment_amount") or ''}
|
||||
</b>
|
||||
% else:
|
||||
${'%.2f' % line.get("payment_amount") or ''}
|
||||
% endif
|
||||
</td>
|
||||
<td style="border:1px solid #000000;width:70px; min-width:70px; max-width: 70px;" >
|
||||
% if line == line_dict[0]:
|
||||
<b>
|
||||
${line.get("inv_amount") or ''}
|
||||
</b>
|
||||
% else:
|
||||
${'%.2f' %line.get("inv_amount") or ''}
|
||||
% endif
|
||||
</td>
|
||||
<td style="border:1px solid #000000;width:70px; min-width:70px; max-width: 70px;">
|
||||
% if line == line_dict[0]:
|
||||
<b>
|
||||
${line.get("credit_amount") or ''}
|
||||
</b>
|
||||
% else:
|
||||
${'%.2f' % line.get("credit_amount") or ''}
|
||||
% endif
|
||||
</td>
|
||||
<td style="border:1px solid #000000;width:70px; min-width:70px; max-width: 70px;">
|
||||
% if line == line_dict[0]:
|
||||
<b>
|
||||
${line.get("discount") or ''}
|
||||
</b>
|
||||
% else:
|
||||
${line.get("discount") or ''}
|
||||
% endif
|
||||
</td>
|
||||
<td style="border:1px solid #000000;width:70px; min-width:70px; max-width: 70px;">
|
||||
% if line == line_dict[0]:
|
||||
<b>
|
||||
${line.get("due_amount") or ''}
|
||||
</b>
|
||||
% else:
|
||||
${'%.2f' % line.get("due_amount") or ''}
|
||||
% endif
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
% endfor
|
||||
Dear <t t-out="object.name or ''" /> ,
|
||||
<br /> <br />
|
||||
A payment was processed on <t
|
||||
t-out="ctx['date']"
|
||||
/>
|
||||
for <t
|
||||
t-out="ctx['partner_name']"
|
||||
/> in the amount of
|
||||
<t
|
||||
t-out="ctx['total_amount']"
|
||||
/> with reference
|
||||
<t t-out="ctx['payment_ref']" />.<br /><br
|
||||
/>
|
||||
<t
|
||||
t-set="line_dict"
|
||||
t-value="ctx.get('line_data',False)"
|
||||
/>
|
||||
<t t-foreach="line_dict" t-as="line">
|
||||
<table
|
||||
style="min-width:800px;background-color: white; padding: 0px 8px 0px 8px; border-collapse: collapse;"
|
||||
width="800"
|
||||
>
|
||||
<tr>
|
||||
<td
|
||||
style="border:1px solid #000000;width:80px; min-width:80px; max-width: 80px;"
|
||||
>
|
||||
<t
|
||||
t-if="line == line_dict[0]"
|
||||
>
|
||||
<t
|
||||
t-out="line.get('inv_date') or ''"
|
||||
/>
|
||||
</t>
|
||||
<t t-else="">
|
||||
<t
|
||||
t-out="line.get('inv_date') or ''"
|
||||
/>
|
||||
</t>
|
||||
</td>
|
||||
<td
|
||||
style="border:1px solid #000000;width:150px; min-width:150px; max-width: 150px;"
|
||||
>
|
||||
<t
|
||||
t-if="line == line_dict[0]"
|
||||
>
|
||||
<t
|
||||
t-out="line.get('inv_no') or ''"
|
||||
/>
|
||||
</t>
|
||||
<t t-else="">
|
||||
<t
|
||||
t-out="line.get('inv_no') or ''"
|
||||
/>
|
||||
</t>
|
||||
</td>
|
||||
<td
|
||||
style="border:1px solid #000000;width:70px; min-width:70px; max-width: 70px;"
|
||||
>
|
||||
<t
|
||||
t-if="line == line_dict[0]"
|
||||
>
|
||||
<t
|
||||
t-out="line.get('credit_ref') or ''"
|
||||
/>
|
||||
</t>
|
||||
<t t-else="">
|
||||
<t
|
||||
t-out="line.get('credit_ref') or ''"
|
||||
/>
|
||||
</t>
|
||||
</td>
|
||||
<td
|
||||
style="border:1px solid #000000;width:150px; min-width:150px; max-width: 150px;"
|
||||
>
|
||||
<t
|
||||
t-if="line == line_dict[0]"
|
||||
>
|
||||
<t
|
||||
t-out="line.get('supp_inv') or ''"
|
||||
/>
|
||||
</t>
|
||||
<t t-else="">
|
||||
<t
|
||||
t-out="line.get('supp_inv') or ''"
|
||||
/>
|
||||
</t>
|
||||
</td>
|
||||
<td
|
||||
style="border:1px solid #000000;width:70px; min-width:70px; max-width: 70px;"
|
||||
>
|
||||
<t
|
||||
t-if="line == line_dict[0]"
|
||||
>
|
||||
<t
|
||||
t-out="line.get('payment_amount') or ''"
|
||||
/>
|
||||
</t>
|
||||
<t t-else="">
|
||||
<t
|
||||
t-out="line.get('payment_amount') or ''"
|
||||
/>
|
||||
</t>
|
||||
</td>
|
||||
<td
|
||||
style="border:1px solid #000000;width:70px; min-width:70px; max-width: 70px;"
|
||||
>
|
||||
<t
|
||||
t-if="line == line_dict[0]"
|
||||
>
|
||||
<t
|
||||
t-out="line.get('inv_amount') or ''"
|
||||
/>
|
||||
</t>
|
||||
<t t-else="">
|
||||
<t
|
||||
t-out="line.get('inv_amount') or ''"
|
||||
/>
|
||||
</t>
|
||||
</td>
|
||||
<td
|
||||
style="border:1px solid #000000;width:70px; min-width:70px; max-width: 70px;"
|
||||
>
|
||||
<t
|
||||
t-if="line == line_dict[0]"
|
||||
>
|
||||
<t
|
||||
t-out="line.get('credit_amount') or ''"
|
||||
/>
|
||||
</t>
|
||||
<t t-else="">
|
||||
<t
|
||||
t-out="line.get('credit_amount') or ''"
|
||||
/>
|
||||
</t>
|
||||
</td>
|
||||
<td
|
||||
style="border:1px solid #000000;width:70px; min-width:70px; max-width: 70px;"
|
||||
>
|
||||
<t
|
||||
t-if="line == line_dict[0]"
|
||||
>
|
||||
<t
|
||||
t-out="line.get('discount') or ''"
|
||||
/>
|
||||
</t>
|
||||
<t t-else="">
|
||||
<t
|
||||
t-out="line.get('discount') or ''"
|
||||
/>
|
||||
</t>
|
||||
</td>
|
||||
<td
|
||||
style="border:1px solid #000000;width:70px; min-width:70px; max-width: 70px;"
|
||||
>
|
||||
<t
|
||||
t-if="line == line_dict[0]"
|
||||
>
|
||||
<t
|
||||
t-out="line.get('due_amount') or ''"
|
||||
/>
|
||||
</t>
|
||||
<t t-else="">
|
||||
<t
|
||||
t-out="line.get('due_amount') or ''"
|
||||
/>
|
||||
</t>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</t>
|
||||
Thanks,
|
||||
% if user.signature:
|
||||
<br/>
|
||||
${user.signature | safe}
|
||||
% endif
|
||||
<t t-if="user.signature">
|
||||
<br />
|
||||
<t t-out="user.signature or ''" />
|
||||
</t>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td style="text-align:center;">
|
||||
</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;"
|
||||
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>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center" style="min-width: 800px;">
|
||||
<table
|
||||
border="0"
|
||||
cellpadding="0"
|
||||
cellspacing="0"
|
||||
width="800"
|
||||
style="min-width: 800px; background-color: white; font-size: 11px; padding: 0px 8px 0px 8px; border-collapse:separate;"
|
||||
>
|
||||
<tr><td valign="middle" align="left">
|
||||
${object.company_id.name}
|
||||
</td></tr>
|
||||
<tr><td
|
||||
valign="middle"
|
||||
align="left"
|
||||
style="opacity: 0.7;"
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center" style="min-width: 800px;">
|
||||
<table
|
||||
border="0"
|
||||
cellpadding="0"
|
||||
cellspacing="0"
|
||||
width="800"
|
||||
style="min-width: 800px; background-color: white; font-size: 11px; padding: 0px 8px 0px 8px; border-collapse:separate;"
|
||||
>
|
||||
<tr>
|
||||
<td valign="middle" align="left">
|
||||
<t t-out="object.company_id.name or ''" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td
|
||||
valign="middle"
|
||||
align="left"
|
||||
style="opacity: 0.7;"
|
||||
>
|
||||
${object.company_id.phone}
|
||||
% if object.company_id.email
|
||||
| <a
|
||||
href="'mailto:%s' % ${object.company_id.email}"
|
||||
style="text-decoration:none; color: #454748;"
|
||||
>
|
||||
${object.company_id.email}</a>
|
||||
% endif
|
||||
% if object.company_id.website
|
||||
| <a
|
||||
href="'%s' % ${object.company_id.website}"
|
||||
style="text-decoration:none; color: #454748;"
|
||||
>
|
||||
${object.company_id.website}
|
||||
</a>
|
||||
% endif
|
||||
</td></tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<t t-out="object.company_id.phone or ''" />
|
||||
<t t-if="object.company_id.email">
|
||||
|
|
||||
<a
|
||||
t-att-href="'mailto:%s' % object.company_id.email"
|
||||
style="text-decoration:none; color: #454748;"
|
||||
t-out="object.company_id.email or ''"
|
||||
/>
|
||||
</t>
|
||||
<t t-if="object.company_id.website">
|
||||
|
|
||||
<a
|
||||
t-att-href="'%s' % object.company_id.website"
|
||||
style="text-decoration:none; color: #454748;"
|
||||
t-out="object.company_id.website or ''"
|
||||
/>
|
||||
</t>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<!-- POWERED BY -->
|
||||
<tr><td align="center" style="min-width: 800px;">
|
||||
<table
|
||||
<tr>
|
||||
<td align="center" style="min-width: 800px;">
|
||||
<table
|
||||
border="0"
|
||||
cellpadding="0"
|
||||
cellspacing="0"
|
||||
width="800"
|
||||
style="min-width: 800px; background-color: white; color: #454748; padding: 8px; border-collapse:separate;"
|
||||
>
|
||||
<tr><td style="text-align: center; font-size: 13px;">
|
||||
Powered by <a
|
||||
target="_blank"
|
||||
href="https://www.odoo.com?utm_source=db&utm_medium=auth"
|
||||
style="color: #875A7B;"
|
||||
>Odoo</a>
|
||||
</td></tr>
|
||||
</table>
|
||||
</td></tr>
|
||||
>
|
||||
<tr>
|
||||
<td style="text-align: center; font-size: 13px;">
|
||||
Powered by
|
||||
<a
|
||||
target="_blank"
|
||||
href="https://www.odoo.com?utm_source=db&utm_medium=auth"
|
||||
style="color: #875A7B;"
|
||||
>Odoo</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
]]>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ class PaymentOrder(models.Model):
|
||||
_inherit = "account.payment.order"
|
||||
|
||||
def send_vendor_email(self):
|
||||
context = dict(self._context)
|
||||
for rec in self:
|
||||
if rec.payment_mode_id.send_email_to_partner:
|
||||
date_generated = rec.date_generated
|
||||
@@ -73,7 +74,7 @@ class PaymentOrder(models.Model):
|
||||
partner_email_id = payment.partner_id.email
|
||||
if partner_email_id:
|
||||
template.write({"email_to": partner_email_id})
|
||||
template.with_context(
|
||||
context.update(
|
||||
{
|
||||
"date": date_generated,
|
||||
"partner_name": partner_name,
|
||||
@@ -81,19 +82,18 @@ class PaymentOrder(models.Model):
|
||||
"payment_ref": payment_ref,
|
||||
"line_data": line_data,
|
||||
}
|
||||
).send_mail(rec.id, force_send=True)
|
||||
)
|
||||
template.with_context(**context).send_mail(
|
||||
rec.id, force_send=True
|
||||
)
|
||||
rec.message_post(
|
||||
body=_(
|
||||
"An email is sent successfully to %s vendor."
|
||||
% partner_name
|
||||
)
|
||||
body=_("An email is not able to send to %s vendor.")
|
||||
% partner_name
|
||||
)
|
||||
else:
|
||||
rec.message_post(
|
||||
body=_(
|
||||
"An email is not able to send to %s vendor."
|
||||
% partner_name
|
||||
)
|
||||
body=_("An email is not able to send to %s vendor.")
|
||||
% partner_name
|
||||
)
|
||||
|
||||
def generated2uploaded(self):
|
||||
|
||||
@@ -2,3 +2,4 @@
|
||||
* Maxime Chambreuil <mchambreuil@opensourceintegrators.com>
|
||||
* Serpent Consulting Services Pvt. Ltd. <support@serpentcs.com>
|
||||
* Daniel Reis <dreis@opensourceintegrators.com>
|
||||
* Nikul Chaudhary <nchaudhary@opensourceintegrators.com>
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
../../../../account_payment_order_vendor_email
|
||||
6
setup/account_payment_order_vendor_email/setup.py
Normal file
6
setup/account_payment_order_vendor_email/setup.py
Normal file
@@ -0,0 +1,6 @@
|
||||
import setuptools
|
||||
|
||||
setuptools.setup(
|
||||
setup_requires=['setuptools-odoo'],
|
||||
odoo_addon=True,
|
||||
)
|
||||
Reference in New Issue
Block a user