[MIG] account_payment_order_grouped_output: Migration to 15.0

This commit is contained in:
Pedro M. Baeza
2023-03-04 20:12:14 +01:00
committed by ferran-73
parent 344153b7e8
commit 93991fd60e
6 changed files with 125 additions and 21 deletions

View File

@@ -14,14 +14,14 @@ Account Payment Order - Generate grouped moves
: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_grouped_output
:target: https://github.com/OCA/bank-payment/tree/15.0/account_payment_order_grouped_output
: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_grouped_output
:target: https://translation.odoo-community.org/projects/bank-payment-15-0/bank-payment-15-0-account_payment_order_grouped_output
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/webui/builds.html?repo=OCA/bank-payment&target_branch=14.0
:alt: Try me on Runboat
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/173/15.0
:alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -42,7 +42,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 smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/bank-payment/issues/new?body=module:%20account_payment_order_grouped_output%0Aversion:%2014.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_grouped_output%0Aversion:%2015.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.
@@ -70,6 +70,6 @@ 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_grouped_output>`_ project on GitHub.
This module is part of the `OCA/bank-payment <https://github.com/OCA/bank-payment/tree/15.0/account_payment_order_grouped_output>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

View File

@@ -2,7 +2,7 @@
{
"name": "Account Payment Order - Generate grouped moves",
"version": "14.0.1.0.0",
"version": "15.0.1.0.0",
"license": "AGPL-3",
"author": "ACSONE SA/NV, Therp BV, Tecnativa, Akretion, "
"Odoo Community Association (OCA)",

View File

@@ -0,0 +1,92 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_payment_order_grouped_output
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 15.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_grouped_output
#: code:addons/account_payment_order_grouped_output/models/account_payment_order.py:0
#, python-format
msgid "Debit bank line %s"
msgstr ""
#. module: account_payment_order_grouped_output
#: code:addons/account_payment_order_grouped_output/models/account_payment_order.py:0
#: code:addons/account_payment_order_grouped_output/models/account_payment_order.py:0
#, python-format
msgid "Debit order %s"
msgstr ""
#. module: account_payment_order_grouped_output
#: model:ir.model.fields,field_description:account_payment_order_grouped_output.field_account_payment_mode__generate_move
msgid "Generate Grouped Accounting Entries On File Upload"
msgstr ""
#. module: account_payment_order_grouped_output
#: model_terms:ir.ui.view,arch_db:account_payment_order_grouped_output.account_payment_mode_form
msgid "Grouped Accounting Entries Options"
msgstr ""
#. module: account_payment_order_grouped_output
#: model_terms:ir.ui.view,arch_db:account_payment_order_grouped_output.account_payment_order_form
msgid "Grouped Entries"
msgstr ""
#. module: account_payment_order_grouped_output
#: model:ir.model.fields,field_description:account_payment_order_grouped_output.field_account_payment_order__grouped_move_ids
msgid "Journal Entries (Grouped)"
msgstr ""
#. module: account_payment_order_grouped_output
#: model:ir.model,name:account_payment_order_grouped_output.model_account_move
msgid "Journal Entry"
msgstr ""
#. module: account_payment_order_grouped_output
#: model:ir.model.fields,field_description:account_payment_order_grouped_output.field_account_payment_order__grouped_move_count
msgid "Number of Grouped Journal Entries"
msgstr ""
#. module: account_payment_order_grouped_output
#: model:ir.model,name:account_payment_order_grouped_output.model_account_payment_mode
msgid "Payment Modes"
msgstr ""
#. module: account_payment_order_grouped_output
#: model:ir.model,name:account_payment_order_grouped_output.model_account_payment_order
msgid "Payment Order"
msgstr ""
#. module: account_payment_order_grouped_output
#: model:ir.model.fields,field_description:account_payment_order_grouped_output.field_account_bank_statement_line__grouped_payment_order_id
#: model:ir.model.fields,field_description:account_payment_order_grouped_output.field_account_move__grouped_payment_order_id
#: model:ir.model.fields,field_description:account_payment_order_grouped_output.field_account_payment__grouped_payment_order_id
msgid "Payment Order (Grouped)"
msgstr ""
#. module: account_payment_order_grouped_output
#: code:addons/account_payment_order_grouped_output/models/account_payment_order.py:0
#, python-format
msgid "Payment bank line %s"
msgstr ""
#. module: account_payment_order_grouped_output
#: code:addons/account_payment_order_grouped_output/models/account_payment_order.py:0
#: code:addons/account_payment_order_grouped_output/models/account_payment_order.py:0
#, python-format
msgid "Payment order %s"
msgstr ""
#. module: account_payment_order_grouped_output
#: model:ir.model.fields,field_description:account_payment_order_grouped_output.field_account_payment_mode__post_move
msgid "Post Move"
msgstr ""

View File

@@ -42,10 +42,11 @@ class AccountPaymentOrder(models.Model):
def generated2uploaded(self):
"""Generate grouped moves if configured that way."""
super().generated2uploaded()
res = super().generated2uploaded()
for order in self:
if order.payment_mode_id.generate_move:
order.generate_move()
return res
def generate_move(self):
"""Create the moves that pay off the move lines from the payment/debit order."""
@@ -77,11 +78,12 @@ class AccountPaymentOrder(models.Model):
def reconcile_grouped_payments(self, move, payments):
lines_to_rec = move.line_ids[:-1]
for payment in payments:
journal = payment.journal_id
lines_to_rec += payment.move_id.line_ids.filtered(
lambda x: x.account_id
in (
payment.journal_id.payment_debit_account_id,
payment.journal_id.payment_credit_account_id,
journal._get_journal_inbound_outstanding_payment_accounts()
+ journal._get_journal_inbound_outstanding_payment_accounts()
)
)
lines_to_rec.reconcile()
@@ -113,15 +115,26 @@ class AccountPaymentOrder(models.Model):
vals["line_ids"].append((0, 0, trf_ml_vals))
return vals
def _prepare_move_line_partner_account(self, payment):
if self.payment_type == "inbound":
account = payment.journal_id.payment_debit_account_id
def _get_grouped_output_liquidity_account(self, payment):
domain = [
("journal_id", "=", self.journal_id.id),
("payment_method_id", "=", payment.payment_method_id.id),
("payment_type", "=", self.payment_type),
]
apml = self.env["account.payment.method.line"].search(domain)
if apml.payment_account_id:
return apml.payment_account_id
elif self.payment_type == "inbound":
return payment.company_id.account_journal_payment_debit_account_id
else:
account = payment.journal_id.payment_credit_account_id
return payment.company_id.account_journal_payment_credit_account_id
def _prepare_move_line_partner_account(self, payment):
if self.payment_type == "outbound":
name = _("Payment bank line %s") % payment.name
else:
name = _("Debit bank line %s") % payment.name
account = self._get_grouped_output_liquidity_account(payment)
sign = self.payment_type == "inbound" and -1 or 1
amount_company_currency = abs(payment.move_id.line_ids[0].balance)
vals = {
@@ -144,12 +157,11 @@ class AccountPaymentOrder(models.Model):
):
if self.payment_type == "outbound":
name = _("Payment order %s") % self.name
account = self.journal_id.payment_credit_account_id
else:
name = _("Debit order %s") % self.name
account = self.journal_id.payment_debit_account_id
partner = self.env["res.partner"]
for index, payment in enumerate(payments):
account = self._get_grouped_output_liquidity_account(payment)
if index == 0:
partner = payment.payment_line_ids[0].partner_id
elif payment.payment_line_ids[0].partner_id != partner:

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

View File

@@ -3,7 +3,7 @@
<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: http://docutils.sourceforge.net/" />
<meta name="generator" content="Docutils 0.15.1: http://docutils.sourceforge.net/" />
<title>Account Payment Order - Generate grouped moves</title>
<style type="text/css">
@@ -367,7 +367,7 @@ ul.auto-toc {
!! 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_grouped_output"><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_grouped_output"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runboat.odoo-community.org/webui/builds.html?repo=OCA/bank-payment&amp;target_branch=14.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<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/15.0/account_payment_order_grouped_output"><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-15-0/bank-payment-15-0-account_payment_order_grouped_output"><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/15.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p>This module adds an option to generate extra grouped moves for the payment
orders since the refactoring done to use native Odoo payments.</p>
<p>This serves for easing the reconciliation on bank statements of large payment
@@ -388,7 +388,7 @@ orders, handling them as one or several journal entries according payment date.<
<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_grouped_output%0Aversion:%2014.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_grouped_output%0Aversion:%2015.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">
@@ -409,7 +409,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
<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_grouped_output">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/15.0/account_payment_order_grouped_output">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>