mirror of
https://github.com/OCA/bank-payment.git
synced 2025-02-02 10:37:31 +02:00
[MIG] account_payment_order_grouped_output: Migration to 15.0
This commit is contained in:
@@ -14,13 +14,13 @@ 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
|
||||
:target: https://runboat.odoo-community.org/webui/builds.html?repo=OCA/bank-payment&target_branch=15.0
|
||||
:alt: Try me on Runboat
|
||||
|
||||
|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.
|
||||
|
||||
@@ -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)",
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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&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://runboat.odoo-community.org/webui/builds.html?repo=OCA/bank-payment&target_branch=15.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-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>
|
||||
|
||||
Reference in New Issue
Block a user