[IMP] account_payment_order_notification: pre-commit auto fixes

This commit is contained in:
Antoni Marroig Campomar
2024-08-15 12:53:06 +02:00
parent fee598305d
commit f386f70447
15 changed files with 110 additions and 87 deletions

View File

@@ -17,18 +17,19 @@ Account Payment Order Notification
: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/16.0/account_payment_order_notification
:target: https://github.com/OCA/bank-payment/tree/17.0/account_payment_order_notification
: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-16-0/bank-payment-16-0-account_payment_order_notification
:target: https://translation.odoo-community.org/projects/bank-payment-17-0/bank-payment-17-0-account_payment_order_notification
: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=16.0
:target: https://runboat.odoo-community.org/builds?repo=OCA/bank-payment&target_branch=17.0
:alt: Try me on Runboat
|badge1| |badge2| |badge3| |badge4| |badge5|
This module adds a button on debit / payment orders to send an email to each related partner with the details of their transactions.
This module adds a button on debit / payment orders to send an email to
each related partner with the details of their transactions.
**Table of contents**
@@ -40,30 +41,40 @@ Configuration
To configure this module, you need to:
#. Go to *Invoicing > Configuration > Payment Modes* and create a payment mode, if you wish.
1. Go to *Invoicing > Configuration > Payment Modes* and create a
payment mode, if you wish.
#. Go to *Invoicing > Customers > Customers* and create a new record as follows:
* Name: Test customer 1
* Email: customer1@test.com
2. Go to *Invoicing > Customers > Customers* and create a new record as
follows:
#. Go to *Invoicing > Customers > Customers* and create a new record as follows:
* Name: Test customer 2
* Email: (empty)
- Name: Test customer 1
- Email: customer1@test.com
3. Go to *Invoicing > Customers > Customers* and create a new record as
follows:
- Name: Test customer 2
- Email: (empty)
Usage
=====
#. Go to *Invoicing > Customers > Invoices* and create one or more invoices linked to the payment mode.
#. Go to *Invoicing > Customers > Invoices* select the invoices created and execute the action called "Post entries".
#. Go to *Invoicing > Customers > Invoices* select the invoices created and execute the action called "Add to Payment/Debit Order" and create a payment order.
#. Click on "Confirm Payments" button.
#. Click on "Generate Payment File" button.
#. Click on "File Successfully Uploaded" button.
#. Click on "Send mails" button.
#. Any involved partner with no email will appear with the column "To send" not checked.
#. Click on "Confirm" button.
#. An email will have been sent to the selected partners.
#. A reminder note will have been created.
1. Go to *Invoicing > Customers > Invoices* and create one or more
invoices linked to the payment mode.
2. Go to *Invoicing > Customers > Invoices* select the invoices created
and execute the action called "Post entries".
3. Go to *Invoicing > Customers > Invoices* select the invoices created
and execute the action called "Add to Payment/Debit Order" and
create a payment order.
4. Click on "Confirm Payments" button.
5. Click on "Generate Payment File" button.
6. Click on "File Successfully Uploaded" button.
7. Click on "Send mails" button.
8. Any involved partner with no email will appear with the column "To
send" not checked.
9. Click on "Confirm" button.
10. An email will have been sent to the selected partners.
11. A reminder note will have been created.
Bug Tracker
===========
@@ -71,7 +82,7 @@ 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 to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/bank-payment/issues/new?body=module:%20account_payment_order_notification%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/bank-payment/issues/new?body=module:%20account_payment_order_notification%0Aversion:%2017.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.
@@ -79,20 +90,20 @@ Credits
=======
Authors
~~~~~~~
-------
* Tecnativa
Contributors
~~~~~~~~~~~~
------------
* `Tecnativa <https://www.tecnativa.com>`_:
- `Tecnativa <https://www.tecnativa.com>`__:
* Víctor Martínez
* Pedro M. Baeza
- Víctor Martínez
- Pedro M. Baeza
Maintainers
~~~~~~~~~~~
-----------
This module is maintained by the OCA.
@@ -112,6 +123,6 @@ Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
|maintainer-victoralmau|
This module is part of the `OCA/bank-payment <https://github.com/OCA/bank-payment/tree/16.0/account_payment_order_notification>`_ project on GitHub.
This module is part of the `OCA/bank-payment <https://github.com/OCA/bank-payment/tree/17.0/account_payment_order_notification>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

View File

@@ -26,7 +26,7 @@ class AccountPaymentOrder(models.Model):
def action_view_notifications(self):
self.ensure_one()
xml_id = "%s.%s" % (
xml_id = "{}.{}".format(
"account_payment_order_notification",
"account_payment_order_notification_action",
)

View File

@@ -29,9 +29,7 @@ class AccountPaymentOrderNotification(models.Model):
@api.depends("order_id", "partner_id")
def _compute_display_name(self):
for item in self:
item.display_name = "[{}] {}".format(
item.order_id.name, item.partner_id.display_name
)
item.display_name = f"[{item.order_id.name}] {item.partner_id.display_name}"
@api.model_create_multi
def create(self, vals_list):

View File

@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"

View File

@@ -0,0 +1,12 @@
To configure this module, you need to:
1. Go to *Invoicing \> Configuration \> Payment Modes* and create a
payment mode, if you wish.
2. Go to *Invoicing \> Customers \> Customers* and create a new record as follows:
- Name: Test customer 1
- Email: <customer1@test.com>
3. Go to *Invoicing \> Customers \> Customers* and create a new record as follows:
- Name: Test customer 2
- Email: (empty)

View File

@@ -1,11 +0,0 @@
To configure this module, you need to:
#. Go to *Invoicing > Configuration > Payment Modes* and create a payment mode, if you wish.
#. Go to *Invoicing > Customers > Customers* and create a new record as follows:
* Name: Test customer 1
* Email: customer1@test.com
#. Go to *Invoicing > Customers > Customers* and create a new record as follows:
* Name: Test customer 2
* Email: (empty)

View File

@@ -0,0 +1,3 @@
- [Tecnativa](https://www.tecnativa.com):
- Víctor Martínez
- Pedro M. Baeza

View File

@@ -1,4 +0,0 @@
* `Tecnativa <https://www.tecnativa.com>`_:
* Víctor Martínez
* Pedro M. Baeza

View File

@@ -0,0 +1,2 @@
This module adds a button on debit / payment orders to send an email to
each related partner with the details of their transactions.

View File

@@ -1 +0,0 @@
This module adds a button on debit / payment orders to send an email to each related partner with the details of their transactions.

View File

@@ -0,0 +1,16 @@
1. Go to *Invoicing \> Customers \> Invoices* and create one or more
invoices linked to the payment mode.
2. Go to *Invoicing \> Customers \> Invoices* select the invoices
created and execute the action called "Post entries".
3. Go to *Invoicing \> Customers \> Invoices* select the invoices
created and execute the action called "Add to Payment/Debit Order"
and create a payment order.
4. Click on "Confirm Payments" button.
5. Click on "Generate Payment File" button.
6. Click on "File Successfully Uploaded" button.
7. Click on "Send mails" button.
8. Any involved partner with no email will appear with the column "To
send" not checked.
9. Click on "Confirm" button.
10. An email will have been sent to the selected partners.
11. A reminder note will have been created.

View File

@@ -1,11 +0,0 @@
#. Go to *Invoicing > Customers > Invoices* and create one or more invoices linked to the payment mode.
#. Go to *Invoicing > Customers > Invoices* select the invoices created and execute the action called "Post entries".
#. Go to *Invoicing > Customers > Invoices* select the invoices created and execute the action called "Add to Payment/Debit Order" and create a payment order.
#. Click on "Confirm Payments" button.
#. Click on "Generate Payment File" button.
#. Click on "File Successfully Uploaded" button.
#. Click on "Send mails" button.
#. Any involved partner with no email will appear with the column "To send" not checked.
#. Click on "Confirm" button.
#. An email will have been sent to the selected partners.
#. A reminder note will have been created.

View File

@@ -8,10 +8,11 @@
/*
:Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
:Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
Despite the name, some widely supported CSS2 features are used.
See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
customize this style sheet.
@@ -274,7 +275,7 @@ 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 .ln { color: gray; } /* 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 }
@@ -300,7 +301,7 @@ span.option {
span.pre {
white-space: pre }
span.problematic {
span.problematic, pre.problematic {
color: red }
span.section-subtitle {
@@ -368,8 +369,9 @@ ul.auto-toc {
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:e5ad04ecc8cfa4d7eef0547b8b8a62a83f7906228b463c1cf7f1029e8d555a42
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" 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 image-reference" 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 image-reference" href="https://github.com/OCA/bank-payment/tree/16.0/account_payment_order_notification"><img alt="OCA/bank-payment" src="https://img.shields.io/badge/github-OCA%2Fbank--payment-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/bank-payment-16-0/bank-payment-16-0-account_payment_order_notification"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/bank-payment&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module adds a button on debit / payment orders to send an email to each related partner with the details of their transactions.</p>
<p><a class="reference external image-reference" 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 image-reference" 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 image-reference" href="https://github.com/OCA/bank-payment/tree/17.0/account_payment_order_notification"><img alt="OCA/bank-payment" src="https://img.shields.io/badge/github-OCA%2Fbank--payment-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/bank-payment-17-0/bank-payment-17-0-account_payment_order_notification"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/bank-payment&amp;target_branch=17.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module adds a button on debit / payment orders to send an email to
each related partner with the details of their transactions.</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
@@ -388,38 +390,38 @@ ul.auto-toc {
<h1><a class="toc-backref" href="#toc-entry-1">Configuration</a></h1>
<p>To configure this module, you need to:</p>
<ol class="arabic simple">
<li>Go to <em>Invoicing &gt; Configuration &gt; Payment Modes</em> and create a payment mode, if you wish.</li>
<li><dl class="first docutils">
<dt>Go to <em>Invoicing &gt; Customers &gt; Customers</em> and create a new record as follows:</dt>
<dd><ul class="first last">
<li>Go to <em>Invoicing &gt; Configuration &gt; Payment Modes</em> and create a
payment mode, if you wish.</li>
<li>Go to <em>Invoicing &gt; Customers &gt; Customers</em> and create a new record as
follows:<ul>
<li>Name: Test customer 1</li>
<li>Email: <a class="reference external" href="mailto:customer1&#64;test.com">customer1&#64;test.com</a></li>
</ul>
</dd>
</dl>
</li>
<li><dl class="first docutils">
<dt>Go to <em>Invoicing &gt; Customers &gt; Customers</em> and create a new record as follows:</dt>
<dd><ul class="first last">
<li>Go to <em>Invoicing &gt; Customers &gt; Customers</em> and create a new record as
follows:<ul>
<li>Name: Test customer 2</li>
<li>Email: (empty)</li>
</ul>
</dd>
</dl>
</li>
</ol>
</div>
<div class="section" id="usage">
<h1><a class="toc-backref" href="#toc-entry-2">Usage</a></h1>
<ol class="arabic simple">
<li>Go to <em>Invoicing &gt; Customers &gt; Invoices</em> and create one or more invoices linked to the payment mode.</li>
<li>Go to <em>Invoicing &gt; Customers &gt; Invoices</em> select the invoices created and execute the action called “Post entries”.</li>
<li>Go to <em>Invoicing &gt; Customers &gt; Invoices</em> select the invoices created and execute the action called “Add to Payment/Debit Order” and create a payment order.</li>
<li>Go to <em>Invoicing &gt; Customers &gt; Invoices</em> and create one or more
invoices linked to the payment mode.</li>
<li>Go to <em>Invoicing &gt; Customers &gt; Invoices</em> select the invoices created
and execute the action called “Post entries”.</li>
<li>Go to <em>Invoicing &gt; Customers &gt; Invoices</em> select the invoices created
and execute the action called “Add to Payment/Debit Order” and
create a payment order.</li>
<li>Click on “Confirm Payments” button.</li>
<li>Click on “Generate Payment File” button.</li>
<li>Click on “File Successfully Uploaded” button.</li>
<li>Click on “Send mails” button.</li>
<li>Any involved partner with no email will appear with the column “To send” not checked.</li>
<li>Any involved partner with no email will appear with the column “To
send” not checked.</li>
<li>Click on “Confirm” button.</li>
<li>An email will have been sent to the selected partners.</li>
<li>A reminder note will have been created.</li>
@@ -430,7 +432,7 @@ ul.auto-toc {
<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 to smash 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_notification%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<a class="reference external" href="https://github.com/OCA/bank-payment/issues/new?body=module:%20account_payment_order_notification%0Aversion:%2017.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">
@@ -454,13 +456,15 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#toc-entry-7">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>
<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>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p>
<p><a class="reference external image-reference" href="https://github.com/victoralmau"><img alt="victoralmau" src="https://github.com/victoralmau.png?size=40px" /></a></p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/bank-payment/tree/16.0/account_payment_order_notification">OCA/bank-payment</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/bank-payment/tree/17.0/account_payment_order_notification">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>

View File

@@ -58,7 +58,7 @@ class TestAccountPaymentOrderNotification(TransactionCase):
res = wizard.run()
payment_order = self.env[res["res_model"]].browse(res["res_id"])
old_messages = payment_order.message_ids
template_xml_id = "%s.%s" % (
template_xml_id = "{}.{}".format(
"account_payment_order_notification",
"email_account_payment_order_notification",
)

View File

@@ -48,7 +48,7 @@ class WizardAccountPaymentOrderNotification(models.TransientModel):
},
)
]
template_xml_id = "%s.%s" % (
template_xml_id = "{}.{}".format(
"account_payment_order_notification",
"email_account_payment_order_notification",
)
@@ -65,7 +65,8 @@ class WizardAccountPaymentOrderNotification(models.TransientModel):
notifications = []
for item in self.line_ids.filtered("to_send"):
payment_line_ids = self.order_id.payment_line_ids.filtered(
lambda x: x.partner_id == item.partner_id.commercial_partner_id
lambda x, item=item: x.partner_id
== item.partner_id.commercial_partner_id
)
data = {
"partner_id": item.partner_id.id,