Merge PR #1288 into 16.0

Signed-off-by JordiBForgeFlow
This commit is contained in:
OCA-git-bot
2024-06-17 08:59:52 +00:00
18 changed files with 1442 additions and 0 deletions

View File

@@ -0,0 +1,85 @@
===========================
Account Payment Order Email
===========================
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fbank--payment-lightgray.png?logo=github
:target: https://github.com/OCA/bank-payment/tree/14.0/account_payment_order_vendor_email
:alt: OCA/bank-payment
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/bank-payment-14-0/bank-payment-14-0-account_payment_order_vendor_email
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/173/14.0
:alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5|
Add fields to Account Payment Mode.
**Table of contents**
.. contents::
:local:
Usage
=====
Add `send_email_to_partner` on Account Payment Mode records.
Add 'email_temp_id' on Account Payment Mode records.
Add Email templated to send the Payment Details on Mail
Bug Tracker
===========
Bugs are tracked on `GitHub Issues <https://github.com/OCA/bank-payment/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/bank-payment/issues/new?body=module:%20account_payment_order_vendor_email%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Do not contact contributors directly about support or help with technical issues.
Credits
=======
Authors
~~~~~~~
* Open Source Integrators
Contributors
~~~~~~~~~~~~
* Murtaza Mithaiwala <mmithaiwala@opensourceintegrators.com>
* Maxime Chambreuil <mchambreuil@opensourceintegrators.com>
* Serpent Consulting Services Pvt. Ltd. <support@serpentcs.com>
* Daniel Reis <dreis@opensourceintegrators.com>
Maintainers
~~~~~~~~~~~
This module is maintained by the OCA.
.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org
OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.
This module is part of the `OCA/bank-payment <https://github.com/OCA/bank-payment/tree/14.0/account_payment_order_vendor_email>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

View File

@@ -0,0 +1 @@
from . import models

View File

@@ -0,0 +1,19 @@
# Copyright (C) 2020 Open Source Integrators
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Account Payment Order Email",
"version": "16.0.1.0.0",
"license": "AGPL-3",
"author": "Open Source Integrators, Odoo Community Association (OCA)",
"maintainers": ["ursais"],
"website": "https://github.com/OCA/bank-payment",
"category": "Accounting",
"depends": ["account_payment_order", "account_payment_mode"],
"data": [
"data/mail_template.xml",
"views/account_payment_mode_view.xml",
"views/account_payment_order_view.xml",
],
"installable": True,
}

View File

@@ -0,0 +1,350 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo noupdate="1">
<record id="ach_payment_email_template" model="mail.template">
<field name="name">Email for ACH Payments</field>
<field
name="model_id"
ref="account_payment_order.model_account_payment_order"
/>
<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" 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">
<span style="font-size: 10px;">Remittance
Advice
</span>
<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}"
/>
</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;"
/>
</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 <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,
<t t-if="user.signature">
<br />
<t t-out="user.signature or ''" />
</t>
</div>
</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>
<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;"
>
<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
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&amp;utm_medium=auth"
style="color: #875A7B;"
>Odoo</a>
</td>
</tr>
</table>
</td>
</tr>
</table>
</field>
</record>
</odoo>

View File

@@ -0,0 +1,323 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_payment_order_vendor_email
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: account_payment_order_vendor_email
#: model:mail.template,body_html:account_payment_order_vendor_email.ach_payment_email_template
msgid ""
"\n"
" <table\n"
" border=\"0\"\n"
" cellpadding=\"0\"\n"
" cellspacing=\"0\"\n"
" style=\"padding-top: 16px; background-color: white; font-family:Verdana, Arial,sans-serif; color: #454748; min-width:800px; border-collapse:separate;\"\n"
" ><tr><td align=\"center\">\n"
" <table\n"
" border=\"0\"\n"
" cellpadding=\"0\"\n"
" cellspacing=\"0\"\n"
" width=\"800\"\n"
" style=\"padding: 16px; background-color: white; color: #454748; border-collapse:separate;\"\n"
" >\n"
" </table>\n"
" </td></tr>\n"
" <tbody>\n"
" <!-- HEADER -->\n"
" <tr>\n"
" <td align=\"center\" style=\"min-width: 800px;\">\n"
" <table\n"
" border=\"0\"\n"
" cellpadding=\"0\"\n"
" cellspacing=\"0\"\n"
" width=\"590\"\n"
" style=\"min-width: 800px; background-color: white; padding: 0px 8px 0px 8px; border-collapse:collapse;\"\n"
" >\n"
" <tr><td style=\"min-width:750px;\" valign=\"middle\">\n"
" <span style=\"font-size: 10px;\">Remittance\n"
" Advice</span><br/>\n"
" <span\n"
" style=\"font-size: 20px; font-weight: bold;\"\n"
" >\n"
" ${object.name}\n"
" </span>\n"
" </td><td valign=\"middle\" align=\"right\">\n"
" <img\n"
" src=\"/logo.png?company=${object.company_id.id}\"\n"
" style=\"padding: 0px; margin: 0px; height: auto; width: 80px;\"\n"
" alt=\"${object.company_id.name}\"\n"
" />\n"
" </td></tr>\n"
" <tr><td colspan=\"2\" style=\"text-align:center;min-width:750px;\"\">\n"
" <hr\n"
" width=\"100%\"\n"
" 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;\"\n"
" />\n"
" </td></tr>\n"
" </table>\n"
" </td>\n"
" </tr>\n"
" <tr>\n"
" <td align=\"center\" style=\"min-width: 800px;\">\n"
" <table\n"
" border=\"0\"\n"
" cellpadding=\"0\"\n"
" cellspacing=\"0\"\n"
" width=\"590\"\n"
" style=\"min-width: 800px; background-color: white; padding: 0px 8px 0px 8px; border-collapse:collapse;\"\n"
" >\n"
" <tr><td valign=\"top\" style=\"font-size: 13px;\">\n"
" <div>\n"
" Dear ${object.name},<br/><br/>\n"
" A payment was processed on ${ctx['date']}\n"
" for ${ctx['partner_name']} in the amount of\n"
" ${ctx['total_amount']} with reference\n"
" ${ctx['payment_ref']}.<br/><br/>\n"
" % set line_dict = ctx.get('line_data',False)\n"
" % for line in line_dict:\n"
" <table style=\"min-width:800px;background-color: white; padding: 0px 8px 0px 8px; border-collapse: collapse;\" width=\"800\">\n"
" <tr>\n"
" <td style=\"border:1px solid #000000;width:80px; min-width:80px; max-width: 80px;\">\n"
" % if line == line_dict[0]:\n"
" <b>\n"
" ${line.get(\"inv_date\") or ''}\n"
" </b>\n"
" % else:\n"
" ${line.get(\"inv_date\") or ''}\n"
" % endif\n"
" </td>\n"
" <td style=\"border:1px solid #000000;width:150px; min-width:150px; max-width: 150px;\" >\n"
" % if line == line_dict[0]:\n"
" <b>\n"
" ${line.get(\"inv_no\") or ''}\n"
" </b>\n"
" % else:\n"
" ${line.get(\"inv_no\") or ''}\n"
" % endif\n"
" </td>\n"
" <td style=\"border:1px solid #000000;width:70px; min-width:70px; max-width: 70px;\" >\n"
" % if line == line_dict[0]:\n"
" <b>\n"
" ${line.get(\"credit_ref\") or ''}\n"
" </b>\n"
" % else:\n"
" ${line.get(\"credit_ref\") or ''}\n"
" % endif\n"
" </td>\n"
" <td style=\"border:1px solid #000000;width:150px; min-width:150px; max-width: 150px;\" >\n"
" % if line == line_dict[0]:\n"
" <b>\n"
" ${line.get(\"supp_inv\") or ''}\n"
" </b>\n"
" % else:\n"
" ${line.get(\"supp_inv\") or ''}\n"
" % endif\n"
" </td>\n"
" <td style=\"border:1px solid #000000;width:70px; min-width:70px; max-width: 70px;\" >\n"
" % if line == line_dict[0]:\n"
" <b>\n"
" ${line.get(\"payment_amount\") or ''}\n"
" </b>\n"
" % else:\n"
" ${'%.2f' % line.get(\"payment_amount\") or ''}\n"
" % endif\n"
" </td>\n"
" <td style=\"border:1px solid #000000;width:70px; min-width:70px; max-width: 70px;\" >\n"
" % if line == line_dict[0]:\n"
" <b>\n"
" ${line.get(\"inv_amount\") or ''}\n"
" </b>\n"
" % else:\n"
" ${'%.2f' %line.get(\"inv_amount\") or ''}\n"
" % endif\n"
" </td>\n"
" <td style=\"border:1px solid #000000;width:70px; min-width:70px; max-width: 70px;\">\n"
" % if line == line_dict[0]:\n"
" <b>\n"
" ${line.get(\"credit_amount\") or ''}\n"
" </b>\n"
" % else:\n"
" ${'%.2f' % line.get(\"credit_amount\") or ''}\n"
" % endif\n"
" </td>\n"
" <td style=\"border:1px solid #000000;width:70px; min-width:70px; max-width: 70px;\">\n"
" % if line == line_dict[0]:\n"
" <b>\n"
" ${line.get(\"discount\") or ''}\n"
" </b>\n"
" % else:\n"
" ${line.get(\"discount\") or ''}\n"
" % endif\n"
" </td>\n"
" <td style=\"border:1px solid #000000;width:70px; min-width:70px; max-width: 70px;\">\n"
" % if line == line_dict[0]:\n"
" <b>\n"
" ${line.get(\"due_amount\") or ''}\n"
" </b>\n"
" % else:\n"
" ${'%.2f' % line.get(\"due_amount\") or ''}\n"
" % endif\n"
" </td>\n"
" </tr>\n"
" </table>\n"
" % endfor\n"
" Thanks,\n"
" % if user.signature:\n"
" <br/>\n"
" ${user.signature | safe}\n"
" % endif\n"
" </div>\n"
" </td>\n"
" </tr>\n"
" <tr><td style=\"text-align:center;\">\n"
" <hr\n"
" width=\"100%\"\n"
" 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;\"\n"
" />\n"
" </td></tr>\n"
" </table>\n"
" </td>\n"
" </tr>\n"
" <tr>\n"
" <td align=\"center\" style=\"min-width: 800px;\">\n"
" <table\n"
" border=\"0\"\n"
" cellpadding=\"0\"\n"
" cellspacing=\"0\"\n"
" width=\"800\"\n"
" style=\"min-width: 800px; background-color: white; font-size: 11px; padding: 0px 8px 0px 8px; border-collapse:separate;\"\n"
" >\n"
" <tr><td valign=\"middle\" align=\"left\">\n"
" ${object.company_id.name}\n"
" </td></tr>\n"
" <tr><td\n"
" valign=\"middle\"\n"
" align=\"left\"\n"
" style=\"opacity: 0.7;\"\n"
" >\n"
" ${object.company_id.phone}\n"
" % if object.company_id.email\n"
" | <a\n"
" href=\"'mailto:%s' % ${object.company_id.email}\"\n"
" style=\"text-decoration:none; color: #454748;\"\n"
" >\n"
" ${object.company_id.email}</a>\n"
" % endif\n"
" % if object.company_id.website\n"
" | <a\n"
" href=\"'%s' % ${object.company_id.website}\"\n"
" style=\"text-decoration:none; color: #454748;\"\n"
" >\n"
" ${object.company_id.website}\n"
" </a>\n"
" % endif\n"
" </td></tr>\n"
" </table>\n"
" </td>\n"
" </tr>\n"
" </tbody>\n"
" <!-- POWERED BY -->\n"
" <tr><td align=\"center\" style=\"min-width: 800px;\">\n"
" <table\n"
" border=\"0\"\n"
" cellpadding=\"0\"\n"
" cellspacing=\"0\"\n"
" width=\"800\"\n"
" style=\"min-width: 800px; background-color: white; color: #454748; padding: 8px; border-collapse:separate;\"\n"
" >\n"
" <tr><td style=\"text-align: center; font-size: 13px;\">\n"
" Powered by <a\n"
" target=\"_blank\"\n"
" href=\"https://www.odoo.com?utm_source=db&amp;utm_medium=auth\"\n"
" style=\"color: #875A7B;\"\n"
" >Odoo</a>\n"
" </td></tr>\n"
" </table>\n"
" </td></tr>\n"
" </table>\n"
" \n"
" "
msgstr ""
#. module: account_payment_order_vendor_email
#: code:addons/account_payment_order_vendor_email/models/account_payment_mode.py:0
#, python-format
msgid "An email is not able to send to %s vendor."
msgstr ""
#. module: account_payment_order_vendor_email
#: code:addons/account_payment_order_vendor_email/models/account_payment_mode.py:0
#, python-format
msgid "An email is sent successfully to %s vendor."
msgstr ""
#. module: account_payment_order_vendor_email
#: model:ir.model.fields,field_description:account_payment_order_vendor_email.field_account_payment_line__discount_amount
msgid "Discount Amount"
msgstr ""
#. module: account_payment_order_vendor_email
#: model:ir.model.fields,field_description:account_payment_order_vendor_email.field_account_payment_line__display_name
#: model:ir.model.fields,field_description:account_payment_order_vendor_email.field_account_payment_mode__display_name
#: model:ir.model.fields,field_description:account_payment_order_vendor_email.field_account_payment_order__display_name
msgid "Display Name"
msgstr ""
#. module: account_payment_order_vendor_email
#: model:ir.model.fields,field_description:account_payment_order_vendor_email.field_account_payment_mode__email_temp_id
msgid "Email Template"
msgstr ""
#. module: account_payment_order_vendor_email
#: model:ir.model.fields,field_description:account_payment_order_vendor_email.field_account_payment_line__id
#: model:ir.model.fields,field_description:account_payment_order_vendor_email.field_account_payment_mode__id
#: model:ir.model.fields,field_description:account_payment_order_vendor_email.field_account_payment_order__id
msgid "ID"
msgstr ""
#. module: account_payment_order_vendor_email
#: model:ir.model.fields,field_description:account_payment_order_vendor_email.field_account_payment_line____last_update
#: model:ir.model.fields,field_description:account_payment_order_vendor_email.field_account_payment_mode____last_update
#: model:ir.model.fields,field_description:account_payment_order_vendor_email.field_account_payment_order____last_update
msgid "Last Modified on"
msgstr ""
#. module: account_payment_order_vendor_email
#: model:ir.model,name:account_payment_order_vendor_email.model_account_payment_line
msgid "Payment Lines"
msgstr ""
#. module: account_payment_order_vendor_email
#: model:ir.model,name:account_payment_order_vendor_email.model_account_payment_mode
msgid "Payment Modes"
msgstr ""
#. module: account_payment_order_vendor_email
#: model:ir.model,name:account_payment_order_vendor_email.model_account_payment_order
msgid "Payment Order"
msgstr ""
#. module: account_payment_order_vendor_email
#: model:mail.template,subject:account_payment_order_vendor_email.ach_payment_email_template
msgid "Remittance Advice"
msgstr ""
#. module: account_payment_order_vendor_email
#: model_terms:ir.ui.view,arch_db:account_payment_order_vendor_email.account_payment_order_manual_email_form
msgid "Send Email"
msgstr ""
#. module: account_payment_order_vendor_email
#: model:ir.model.fields,field_description:account_payment_order_vendor_email.field_account_payment_mode__send_email_to_partner
msgid "Send Email to Partner"
msgstr ""

View File

@@ -0,0 +1 @@
from . import account_payment_mode

View File

@@ -0,0 +1,109 @@
# Copyright (C) 2020 Open Source Integrators
# Copyright 2022 Tecnativa - Pedro M. Baeza
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from datetime import datetime
from odoo import _, fields, models
class PaymentModeCustom(models.Model):
_inherit = "account.payment.mode"
send_email_to_partner = fields.Boolean(
string="Send Email to Partner", default=False
)
email_temp_id = fields.Many2one(
"mail.template",
string="Email Template",
)
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
for payment in rec.payment_ids:
partner_name = payment.partner_id.name
total_amount = payment.amount
payment_ref = payment.payment_reference
line_data = []
header_data = {
"inv_no": "Invoice No.",
"payment_amount": "Payment (in dollars)",
"discount": "Discount (in dollars)",
"inv_date": "Invoice Date",
"credit_ref": "Credit ref#",
"supp_inv": "Supp. Invoice#",
"inv_amount": "Invoice Amount",
"credit_amount": "Credit Amount",
"due_amount": "Due Amount",
}
line_data.append(header_data)
for payment_line in payment.payment_line_ids:
invoice_date = (
payment_line.move_line_id.move_id.invoice_date
and datetime.strftime(
payment_line.move_line_id.move_id.invoice_date,
"%Y/%m/%d",
)
or ""
)
line_dict = {
"inv_no": payment_line.move_line_id.move_id.name or "",
"payment_amount": payment_line.amount_currency,
"discount": payment_line.discount_amount,
"inv_date": invoice_date or "",
"credit_ref": payment_line.order_id.name,
"supp_inv": payment_line.move_line_id.move_id.name or "",
"inv_amount": payment_line.move_line_id.move_id.amount_total,
"credit_amount": payment_line.move_line_id.move_id.amount_untaxed,
"due_amount": payment_line.move_line_id.move_id.amount_residual,
}
line_data.append(line_dict)
template = rec.payment_mode_id.email_temp_id
if not template:
template = self.env.ref(
"account_payment_order_vendor_email."
"ach_payment_email_template"
)
partner_email_id = payment.partner_id.email
if partner_email_id:
template.write({"email_to": partner_email_id})
context.update(
{
"date": date_generated,
"partner_name": partner_name,
"total_amount": total_amount,
"payment_ref": payment_ref,
"line_data": line_data,
}
)
template.with_context(**context).send_mail(
rec.id, force_send=True
)
rec.message_post(
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
)
def generated2uploaded(self):
res = super(PaymentOrder, self).generated2uploaded()
if self.payment_mode_id.send_email_to_partner:
self.send_vendor_email()
return res
class AccountPaymentLine(models.Model):
_inherit = "account.payment.line"
discount_amount = fields.Monetary(currency_field="currency_id")

View File

@@ -0,0 +1,5 @@
* Murtaza Mithaiwala <mmithaiwala@opensourceintegrators.com>
* Maxime Chambreuil <mchambreuil@opensourceintegrators.com>
* Serpent Consulting Services Pvt. Ltd. <support@serpentcs.com>
* Daniel Reis <dreis@opensourceintegrators.com>
* Nikul Chaudhary <nchaudhary@opensourceintegrators.com>

View File

@@ -0,0 +1 @@
Add fields to Account Payment Mode.

View File

@@ -0,0 +1,5 @@
Add `send_email_to_partner` on Account Payment Mode records.
Add 'email_temp_id' on Account Payment Mode records.
Add Email templated to send the Payment Details on Mail

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

View File

@@ -0,0 +1,429 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.15.1: http://docutils.sourceforge.net/" />
<title>Account Payment Order Email</title>
<style type="text/css">
/*
:Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 7952 2016-07-26 18:15:59Z milde $
:Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
customize this style sheet.
*/
/* used to remove borders from tables and images */
.borderless, table.borderless td, table.borderless th {
border: 0 }
table.borderless td, table.borderless th {
/* Override padding for "table.docutils td" with "! important".
The right padding separates the table cells. */
padding: 0 0.5em 0 0 ! important }
.first {
/* Override more specific margin styles with "! important". */
margin-top: 0 ! important }
.last, .with-subtitle {
margin-bottom: 0 ! important }
.hidden {
display: none }
.subscript {
vertical-align: sub;
font-size: smaller }
.superscript {
vertical-align: super;
font-size: smaller }
a.toc-backref {
text-decoration: none ;
color: black }
blockquote.epigraph {
margin: 2em 5em ; }
dl.docutils dd {
margin-bottom: 0.5em }
object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
overflow: hidden;
}
/* Uncomment (and remove this text!) to get bold-faced definition list terms
dl.docutils dt {
font-weight: bold }
*/
div.abstract {
margin: 2em 5em }
div.abstract p.topic-title {
font-weight: bold ;
text-align: center }
div.admonition, div.attention, div.caution, div.danger, div.error,
div.hint, div.important, div.note, div.tip, div.warning {
margin: 2em ;
border: medium outset ;
padding: 1em }
div.admonition p.admonition-title, div.hint p.admonition-title,
div.important p.admonition-title, div.note p.admonition-title,
div.tip p.admonition-title {
font-weight: bold ;
font-family: sans-serif }
div.attention p.admonition-title, div.caution p.admonition-title,
div.danger p.admonition-title, div.error p.admonition-title,
div.warning p.admonition-title, .code .error {
color: red ;
font-weight: bold ;
font-family: sans-serif }
/* Uncomment (and remove this text!) to get reduced vertical space in
compound paragraphs.
div.compound .compound-first, div.compound .compound-middle {
margin-bottom: 0.5em }
div.compound .compound-last, div.compound .compound-middle {
margin-top: 0.5em }
*/
div.dedication {
margin: 2em 5em ;
text-align: center ;
font-style: italic }
div.dedication p.topic-title {
font-weight: bold ;
font-style: normal }
div.figure {
margin-left: 2em ;
margin-right: 2em }
div.footer, div.header {
clear: both;
font-size: smaller }
div.line-block {
display: block ;
margin-top: 1em ;
margin-bottom: 1em }
div.line-block div.line-block {
margin-top: 0 ;
margin-bottom: 0 ;
margin-left: 1.5em }
div.sidebar {
margin: 0 0 0.5em 1em ;
border: medium outset ;
padding: 1em ;
background-color: #ffffee ;
width: 40% ;
float: right ;
clear: right }
div.sidebar p.rubric {
font-family: sans-serif ;
font-size: medium }
div.system-messages {
margin: 5em }
div.system-messages h1 {
color: red }
div.system-message {
border: medium outset ;
padding: 1em }
div.system-message p.system-message-title {
color: red ;
font-weight: bold }
div.topic {
margin: 2em }
h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
margin-top: 0.4em }
h1.title {
text-align: center }
h2.subtitle {
text-align: center }
hr.docutils {
width: 75% }
img.align-left, .figure.align-left, object.align-left, table.align-left {
clear: left ;
float: left ;
margin-right: 1em }
img.align-right, .figure.align-right, object.align-right, table.align-right {
clear: right ;
float: right ;
margin-left: 1em }
img.align-center, .figure.align-center, object.align-center {
display: block;
margin-left: auto;
margin-right: auto;
}
table.align-center {
margin-left: auto;
margin-right: auto;
}
.align-left {
text-align: left }
.align-center {
clear: both ;
text-align: center }
.align-right {
text-align: right }
/* reset inner alignment in figures */
div.align-right {
text-align: inherit }
/* div.align-center * { */
/* text-align: left } */
.align-top {
vertical-align: top }
.align-middle {
vertical-align: middle }
.align-bottom {
vertical-align: bottom }
ol.simple, ul.simple {
margin-bottom: 1em }
ol.arabic {
list-style: decimal }
ol.loweralpha {
list-style: lower-alpha }
ol.upperalpha {
list-style: upper-alpha }
ol.lowerroman {
list-style: lower-roman }
ol.upperroman {
list-style: upper-roman }
p.attribution {
text-align: right ;
margin-left: 50% }
p.caption {
font-style: italic }
p.credits {
font-style: italic ;
font-size: smaller }
p.label {
white-space: nowrap }
p.rubric {
font-weight: bold ;
font-size: larger ;
color: maroon ;
text-align: center }
p.sidebar-title {
font-family: sans-serif ;
font-weight: bold ;
font-size: larger }
p.sidebar-subtitle {
font-family: sans-serif ;
font-weight: bold }
p.topic-title {
font-weight: bold }
pre.address {
margin-bottom: 0 ;
margin-top: 0 ;
font: inherit }
pre.literal-block, pre.doctest-block, pre.math, pre.code {
margin-left: 2em ;
margin-right: 2em }
pre.code .ln { color: grey; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
pre.code .literal.string, code .literal.string { color: #0C5404 }
pre.code .name.builtin, code .name.builtin { color: #352B84 }
pre.code .deleted, code .deleted { background-color: #DEB0A1}
pre.code .inserted, code .inserted { background-color: #A3D289}
span.classifier {
font-family: sans-serif ;
font-style: oblique }
span.classifier-delimiter {
font-family: sans-serif ;
font-weight: bold }
span.interpreted {
font-family: sans-serif }
span.option {
white-space: nowrap }
span.pre {
white-space: pre }
span.problematic {
color: red }
span.section-subtitle {
/* font-size relative to parent (h1..h6 element) */
font-size: 80% }
table.citation {
border-left: solid 1px gray;
margin-left: 1px }
table.docinfo {
margin: 2em 4em }
table.docutils {
margin-top: 0.5em ;
margin-bottom: 0.5em }
table.footnote {
border-left: solid 1px black;
margin-left: 1px }
table.docutils td, table.docutils th,
table.docinfo td, table.docinfo th {
padding-left: 0.5em ;
padding-right: 0.5em ;
vertical-align: top }
table.docutils th.field-name, table.docinfo th.docinfo-name {
font-weight: bold ;
text-align: left ;
white-space: nowrap ;
padding-left: 0 }
/* "booktabs" style (no vertical lines) */
table.docutils.booktabs {
border: 0px;
border-top: 2px solid;
border-bottom: 2px solid;
border-collapse: collapse;
}
table.docutils.booktabs * {
border: 0px;
}
table.docutils.booktabs th {
border-bottom: thin solid;
text-align: left;
}
h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
font-size: 100% }
ul.auto-toc {
list-style-type: none }
</style>
</head>
<body>
<div class="document" id="account-payment-order-email">
<h1 class="title">Account Payment Order Email</h1>
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/bank-payment/tree/14.0/account_payment_order_vendor_email"><img alt="OCA/bank-payment" src="https://img.shields.io/badge/github-OCA%2Fbank--payment-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/bank-payment-14-0/bank-payment-14-0-account_payment_order_vendor_email"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/173/14.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p>Add fields to Account Payment Mode.</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><a class="reference internal" href="#usage" id="id1">Usage</a></li>
<li><a class="reference internal" href="#bug-tracker" id="id2">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="id3">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="id4">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="id5">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="id6">Maintainers</a></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="usage">
<h1><a class="toc-backref" href="#id1">Usage</a></h1>
<p>Add <cite>send_email_to_partner</cite> on Account Payment Mode records.</p>
<p>Add email_temp_id on Account Payment Mode records.</p>
<p>Add Email templated to send the Payment Details on Mail</p>
</div>
<div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#id2">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/bank-payment/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/bank-payment/issues/new?body=module:%20account_payment_order_vendor_email%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
<h1><a class="toc-backref" href="#id3">Credits</a></h1>
<div class="section" id="authors">
<h2><a class="toc-backref" href="#id4">Authors</a></h2>
<ul class="simple">
<li>Open Source Integrators</li>
</ul>
</div>
<div class="section" id="contributors">
<h2><a class="toc-backref" href="#id5">Contributors</a></h2>
<ul class="simple">
<li>Murtaza Mithaiwala &lt;<a class="reference external" href="mailto:mmithaiwala&#64;opensourceintegrators.com">mmithaiwala&#64;opensourceintegrators.com</a>&gt;</li>
<li>Maxime Chambreuil &lt;<a class="reference external" href="mailto:mchambreuil&#64;opensourceintegrators.com">mchambreuil&#64;opensourceintegrators.com</a>&gt;</li>
<li>Serpent Consulting Services Pvt. Ltd. &lt;<a class="reference external" href="mailto:support&#64;serpentcs.com">support&#64;serpentcs.com</a>&gt;</li>
<li>Daniel Reis &lt;<a class="reference external" href="mailto:dreis&#64;opensourceintegrators.com">dreis&#64;opensourceintegrators.com</a>&gt;</li>
</ul>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#id6">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/bank-payment/tree/14.0/account_payment_order_vendor_email">OCA/bank-payment</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>
</div>
</body>
</html>

View File

@@ -0,0 +1,4 @@
# Copyright (C) 2021 Open Source Integrators
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import test_account_payment_order_vendor_mail

View File

@@ -0,0 +1,66 @@
# Copyright (C) 2021 Open Source Integrators
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo.tests.common import TransactionCase
class TestVendorEmail(TransactionCase):
def setUp(self):
super(TestVendorEmail, self).setUp()
# Company
self.company = self.env.ref("base.main_company")
self.journal_c1 = self.env["account.journal"].create(
{
"name": "Journal 1",
"code": "J1",
"type": "bank",
"company_id": self.company.id,
}
)
self.manual_out = self.env.ref("account.account_payment_method_manual_out")
self.email_template = self.env.ref(
"account_payment_order_vendor_email.ach_payment_email_template"
)
self.partner_id = self.env.ref("base.res_partner_12")
self.payment_mode_c1 = self.env["account.payment.mode"].create(
{
"name": "Direct Debit of suppliers from Bank 1",
"bank_account_link": "variable",
"payment_method_id": self.manual_out.id,
"company_id": self.company.id,
"fixed_journal_id": self.journal_c1.id,
"variable_journal_ids": [(6, 0, [self.journal_c1.id])],
"send_email_to_partner": True,
"email_temp_id": self.email_template.id,
}
)
def test_send_vendor_email(self):
self.payment_order_id = self.env["account.payment.order"].create(
{
"payment_mode_id": self.payment_mode_c1.id,
"journal_id": self.journal_c1.id,
"payment_type": "outbound",
"payment_line_ids": [
(
0,
0,
{
"amount_currency": 200.00,
"partner_id": self.partner_id.id,
"communication": "TEST",
},
)
],
}
)
self.payment_order_id.draft2open()
self.payment_order_id.open2generated()
self.payment_order_id.generated2uploaded()
self.payment_order_id.send_vendor_email()

View File

@@ -0,0 +1,16 @@
<odoo>
<record id="account_payment_mode_inherit_email" model="ir.ui.view">
<field name="name">account_payment_mode_email_inherit</field>
<field name="model">account.payment.mode</field>
<field name="inherit_id" ref="account_payment_mode.account_payment_mode_form" />
<field name="arch" type="xml">
<field name="variable_journal_ids" position="after">
<field name="send_email_to_partner" />
<field
attrs="{'invisible':[('send_email_to_partner','=',False)],'required':[('send_email_to_partner','=',True)]}"
name="email_temp_id"
/>
</field>
</field>
</record>
</odoo>

View File

@@ -0,0 +1,21 @@
<odoo>
<record id="account_payment_order_manual_email_form" model="ir.ui.view">
<field name="name">account_payment_order_manual_email_form</field>
<field name="model">account.payment.order</field>
<field
name="inherit_id"
ref="account_payment_order.account_payment_order_form"
/>
<field name="arch" type="xml">
<button name="action_uploaded_cancel" position="after">
<button
name="send_vendor_email"
string="Send Email"
type="object"
class="oe_highlight"
states="uploaded"
/>
</button>
</field>
</record>
</odoo>

View File

@@ -0,0 +1 @@
../../../../account_payment_order_vendor_email

View File

@@ -0,0 +1,6 @@
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)