diff --git a/account_payment_order_vendor_email/README.rst b/account_payment_order_vendor_email/README.rst new file mode 100644 index 00000000000..8941984381c --- /dev/null +++ b/account_payment_order_vendor_email/README.rst @@ -0,0 +1,98 @@ +=========================== +Account Payment Order Email +=========================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:e140fcddccecb19696e2b3b17a7c1f438dd2344a68a1d94428a4c6355996a576 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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/18.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-18-0/bank-payment-18-0-account_payment_order_vendor_email + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/builds?repo=OCA/bank-payment&target_branch=18.0 + :alt: Try me on Runboat + +|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 `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us to smash it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +------- + +* Open Source Integrators + +Contributors +------------ + +- Murtaza Mithaiwala +- Maxime Chambreuil +- Serpent Consulting Services Pvt. Ltd. +- Daniel Reis +- Nikul Chaudhary +- Do Anh Duy + +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. + +.. |maintainer-ursais| image:: https://github.com/ursais.png?size=40px + :target: https://github.com/ursais + :alt: ursais + +Current `maintainer `__: + +|maintainer-ursais| + +This module is part of the `OCA/bank-payment `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/account_payment_order_vendor_email/__init__.py b/account_payment_order_vendor_email/__init__.py new file mode 100644 index 00000000000..0650744f6bc --- /dev/null +++ b/account_payment_order_vendor_email/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/account_payment_order_vendor_email/__manifest__.py b/account_payment_order_vendor_email/__manifest__.py new file mode 100644 index 00000000000..dee4e2d0071 --- /dev/null +++ b/account_payment_order_vendor_email/__manifest__.py @@ -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": "18.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, +} diff --git a/account_payment_order_vendor_email/data/mail_template.xml b/account_payment_order_vendor_email/data/mail_template.xml new file mode 100644 index 00000000000..6673179d000 --- /dev/null +++ b/account_payment_order_vendor_email/data/mail_template.xml @@ -0,0 +1,331 @@ + + + + Email for ACH Payments + + {{ object.company_id.email_formatted or user.email_formatted }} + + Remittance Advice + + {{ object.generated_user_id.lang }} + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + +
+ Remittance + Advice + +
+ + + +
+ +
+
+
+
+ + + + + + + +
+
+ Dear , +

+ A payment was processed on + for in the amount of + with reference + .

+ + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ Thanks, + +
+ + +
+
+
+
+
+ + + + + + + +
+ +
+ + + | + + + + | + + +
+
+ + + + +
+ Powered by + Odoo +
+
+ + + diff --git a/account_payment_order_vendor_email/i18n/account_payment_order_vendor_email.pot b/account_payment_order_vendor_email/i18n/account_payment_order_vendor_email.pot new file mode 100644 index 00000000000..fc666c777bd --- /dev/null +++ b/account_payment_order_vendor_email/i18n/account_payment_order_vendor_email.pot @@ -0,0 +1,253 @@ +# 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 16.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" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +"
\n" +" \n" +"
\n" +"
\n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +"
\n" +" Remittance\n" +" Advice\n" +" \n" +"
\n" +" \n" +" \n" +" \n" +"
\n" +" \"${object.company_id.name}\"\n" +"
\n" +"
\n" +"
\n" +"
\n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +"
\n" +"
\n" +" Dear ,\n" +"

\n" +" A payment was processed on \n" +" for in the amount of\n" +" with reference\n" +" .

\n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +"
\n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +"
\n" +"
\n" +" Thanks,\n" +" \n" +"
\n" +" \n" +"
\n" +"
\n" +"
\n" +"
\n" +"
\n" +"
\n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +"
\n" +" \n" +"
\n" +" \n" +" \n" +" |\n" +" \n" +" \n" +" \n" +" |\n" +" \n" +" \n" +"
\n" +"
\n" +" \n" +" \n" +" \n" +" \n" +"
\n" +" Powered by\n" +" Odoo\n" +"
\n" +"
\n" +" " +msgstr "" + +#. module: account_payment_order_vendor_email +#. odoo-python +#: code:addons/account_payment_order_vendor_email/models/account_payment_mode.py:0 +#: 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 +#: 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_mode__email_temp_id +msgid "Email Template" +msgstr "" + +#. module: account_payment_order_vendor_email +#: model:mail.template,name:account_payment_order_vendor_email.ach_payment_email_template +msgid "Email for ACH Payments" +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 "" diff --git a/account_payment_order_vendor_email/i18n/it.po b/account_payment_order_vendor_email/i18n/it.po new file mode 100644 index 00000000000..bf99055c20a --- /dev/null +++ b/account_payment_order_vendor_email/i18n/it.po @@ -0,0 +1,521 @@ +# 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 16.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2024-09-19 17:06+0000\n" +"Last-Translator: mymage \n" +"Language-Team: none\n" +"Language: it\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 5.6.2\n" + +#. module: account_payment_order_vendor_email +#: model:mail.template,body_html:account_payment_order_vendor_email.ach_payment_email_template +msgid "" +"\n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +"
\n" +" \n" +"
\n" +"
\n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +"
\n" +" Remittance\n" +" Advice\n" +" \n" +"
\n" +" \n" +" \n" +" \n" +"
\n" +" \"${object.company_id.name}\"\n" +"
\n" +"
\n" +"
\n" +"
\n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +"
\n" +"
\n" +" Dear ,\n" +"

\n" +" A payment was processed on \n" +" for in the amount of\n" +" with reference\n" +" .

\n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +"
\n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +"
\n" +"
\n" +" Thanks,\n" +" \n" +"
\n" +" \n" +"
\n" +"
\n" +"
\n" +"
\n" +"
\n" +"
\n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +"
\n" +" \n" +"
\n" +" \n" +" \n" +" |\n" +" \n" +" \n" +" \n" +" |\n" +" \n" +" \n" +"
\n" +"
\n" +" \n" +" \n" +" \n" +" \n" +"
\n" +" Powered by\n" +" Odoo\n" +"
\n" +"
\n" +" " +msgstr "" +"\n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +"
\n" +" \n" +"
\n" +"
\n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +"
\n" +" \n" +" Avviso rimessa\n" +" \n" +"
\n" +" \n" +" \n" +" \n" +"
\n" +" \"${object.company_id.name}\"\n" +"
\n" +"
\n" +"
\n" +"
\n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +"
\n" +"
\n" +" Spettabile ,\n" +"

\n" +" Un pagamento è stato " +"elaborato il \n" +" per del valore di\n" +" con riferimento\n" +" .

\n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +"
\n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +"
\n" +"
\n" +" Grazie,\n" +" \n" +"
\n" +" \n" +"
\n" +"
\n" +"
\n" +"
\n" +"
\n" +"
\n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +"
\n" +" \n" +"
\n" +" \n" +" " +"\n" +" |\n" +" \n" +" \n" +" \n" +" |\n" +" \n" +" \n" +"
\n" +"
\n" +" \n" +" \n" +" \n" +" \n" +"
\n" +" Powered by\n" +" Odoo\n" +"
\n" +"
\n" +" " + +#. module: account_payment_order_vendor_email +#. odoo-python +#: code:addons/account_payment_order_vendor_email/models/account_payment_mode.py:0 +#: 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 "Non è possibile inviare una e-mail al fornitore %s." + +#. 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 "Importo sconto" + +#. 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 "Modello e-mail" + +#. module: account_payment_order_vendor_email +#: model:mail.template,name:account_payment_order_vendor_email.ach_payment_email_template +msgid "Email for ACH Payments" +msgstr "E-mail per pagamenti ACH" + +#. module: account_payment_order_vendor_email +#: model:ir.model,name:account_payment_order_vendor_email.model_account_payment_line +msgid "Payment Lines" +msgstr "Righe di pagamento" + +#. module: account_payment_order_vendor_email +#: model:ir.model,name:account_payment_order_vendor_email.model_account_payment_mode +msgid "Payment Modes" +msgstr "Modi di pagamento" + +#. module: account_payment_order_vendor_email +#: model:ir.model,name:account_payment_order_vendor_email.model_account_payment_order +msgid "Payment Order" +msgstr "Ordine di pagamento" + +#. module: account_payment_order_vendor_email +#: model:mail.template,subject:account_payment_order_vendor_email.ach_payment_email_template +msgid "Remittance Advice" +msgstr "Avviso rimessa" + +#. 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 "Invia e-mail" + +#. 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 "Invia e-mail al partner" diff --git a/account_payment_order_vendor_email/models/__init__.py b/account_payment_order_vendor_email/models/__init__.py new file mode 100644 index 00000000000..715a4994f72 --- /dev/null +++ b/account_payment_order_vendor_email/models/__init__.py @@ -0,0 +1 @@ +from . import account_payment_mode diff --git a/account_payment_order_vendor_email/models/account_payment_mode.py b/account_payment_order_vendor_email/models/account_payment_mode.py new file mode 100644 index 00000000000..bad3089c6bd --- /dev/null +++ b/account_payment_order_vendor_email/models/account_payment_mode.py @@ -0,0 +1,108 @@ +# 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.filtered(lambda r: r.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, # noqa: E501 + "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=self.env._( + "An email is sent successfully to %s vendor.", partner_name + ) # noqa: E501 + ) + else: + rec.message_post( + body=self.env._( + "An email is not able to send to %s vendor.", partner_name + ) # noqa: E501 + ) + + def generated2uploaded(self): + res = super().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") diff --git a/account_payment_order_vendor_email/pyproject.toml b/account_payment_order_vendor_email/pyproject.toml new file mode 100644 index 00000000000..4231d0cccb3 --- /dev/null +++ b/account_payment_order_vendor_email/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/account_payment_order_vendor_email/readme/CONTRIBUTORS.md b/account_payment_order_vendor_email/readme/CONTRIBUTORS.md new file mode 100644 index 00000000000..452bd664992 --- /dev/null +++ b/account_payment_order_vendor_email/readme/CONTRIBUTORS.md @@ -0,0 +1,6 @@ +- Murtaza Mithaiwala \<\> +- Maxime Chambreuil \<\> +- Serpent Consulting Services Pvt. Ltd. \<\> +- Daniel Reis \<\> +- Nikul Chaudhary \<\> +- Do Anh Duy \<\> diff --git a/account_payment_order_vendor_email/readme/DESCRIPTION.md b/account_payment_order_vendor_email/readme/DESCRIPTION.md new file mode 100644 index 00000000000..7107f7077d3 --- /dev/null +++ b/account_payment_order_vendor_email/readme/DESCRIPTION.md @@ -0,0 +1 @@ +Add fields to Account Payment Mode. diff --git a/account_payment_order_vendor_email/readme/USAGE.md b/account_payment_order_vendor_email/readme/USAGE.md new file mode 100644 index 00000000000..1727d2fd3b1 --- /dev/null +++ b/account_payment_order_vendor_email/readme/USAGE.md @@ -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 diff --git a/account_payment_order_vendor_email/static/description/icon.png b/account_payment_order_vendor_email/static/description/icon.png new file mode 100644 index 00000000000..3a0328b516c Binary files /dev/null and b/account_payment_order_vendor_email/static/description/icon.png differ diff --git a/account_payment_order_vendor_email/static/description/index.html b/account_payment_order_vendor_email/static/description/index.html new file mode 100644 index 00000000000..237ab3af7ff --- /dev/null +++ b/account_payment_order_vendor_email/static/description/index.html @@ -0,0 +1,437 @@ + + + + + +Account Payment Order Email + + + +
+

Account Payment Order Email

+ + +

Beta License: AGPL-3 OCA/bank-payment Translate me on Weblate Try me on Runboat

+

Add fields to Account Payment Mode.

+

Table of contents

+ +
+

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. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us to smash it by providing a detailed and welcomed +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Open Source Integrators
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+ +Odoo Community Association + +

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.

+

Current maintainer:

+

ursais

+

This module is part of the OCA/bank-payment project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/account_payment_order_vendor_email/tests/__init__.py b/account_payment_order_vendor_email/tests/__init__.py new file mode 100644 index 00000000000..587b33984db --- /dev/null +++ b/account_payment_order_vendor_email/tests/__init__.py @@ -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 diff --git a/account_payment_order_vendor_email/tests/test_account_payment_order_vendor_mail.py b/account_payment_order_vendor_email/tests/test_account_payment_order_vendor_mail.py new file mode 100644 index 00000000000..80393e747f4 --- /dev/null +++ b/account_payment_order_vendor_email/tests/test_account_payment_order_vendor_mail.py @@ -0,0 +1,67 @@ +# 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): + @classmethod + def setUpClass(cls): + super().setUpClass() + + # Company + cls.company = cls.env.ref("base.main_company") + + cls.journal_c1 = cls.env["account.journal"].create( + { + "name": "Journal 1", + "code": "J1", + "type": "bank", + "company_id": cls.company.id, + } + ) + + cls.manual_out = cls.env.ref("account.account_payment_method_manual_out") + + cls.email_template = cls.env.ref( + "account_payment_order_vendor_email.ach_payment_email_template" + ) + + cls.partner_id = cls.env.ref("base.res_partner_12") + + cls.payment_mode_c1 = cls.env["account.payment.mode"].create( + { + "name": "Direct Debit of suppliers from Bank 1", + "bank_account_link": "variable", + "payment_method_id": cls.manual_out.id, + "company_id": cls.company.id, + "fixed_journal_id": cls.journal_c1.id, + "variable_journal_ids": [(6, 0, [cls.journal_c1.id])], + "send_email_to_partner": True, + "email_temp_id": cls.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() diff --git a/account_payment_order_vendor_email/views/account_payment_mode_view.xml b/account_payment_order_vendor_email/views/account_payment_mode_view.xml new file mode 100644 index 00000000000..4b3cf106b89 --- /dev/null +++ b/account_payment_order_vendor_email/views/account_payment_mode_view.xml @@ -0,0 +1,17 @@ + + + account_payment_mode_email_inherit + account.payment.mode + + + + + + + + + diff --git a/account_payment_order_vendor_email/views/account_payment_order_view.xml b/account_payment_order_vendor_email/views/account_payment_order_view.xml new file mode 100644 index 00000000000..6c2692351a7 --- /dev/null +++ b/account_payment_order_vendor_email/views/account_payment_order_view.xml @@ -0,0 +1,21 @@ + + + account_payment_order_manual_email_form + account.payment.order + + + + + +