diff --git a/account_payment_order_grouped_output/README.rst b/account_payment_order_grouped_output/README.rst index 157587efd..32b14f349 100644 --- a/account_payment_order_grouped_output/README.rst +++ b/account_payment_order_grouped_output/README.rst @@ -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 `_. 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 `_. +`feedback `_. 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 `_ project on GitHub. +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_grouped_output/__manifest__.py b/account_payment_order_grouped_output/__manifest__.py index 233548200..81550fcca 100644 --- a/account_payment_order_grouped_output/__manifest__.py +++ b/account_payment_order_grouped_output/__manifest__.py @@ -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)", diff --git a/account_payment_order_grouped_output/i18n/account_payment_order_grouped_output.pot b/account_payment_order_grouped_output/i18n/account_payment_order_grouped_output.pot new file mode 100644 index 000000000..3915de3d2 --- /dev/null +++ b/account_payment_order_grouped_output/i18n/account_payment_order_grouped_output.pot @@ -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 "" diff --git a/account_payment_order_grouped_output/models/account_payment_order.py b/account_payment_order_grouped_output/models/account_payment_order.py index d72835d29..b3f384ce1 100644 --- a/account_payment_order_grouped_output/models/account_payment_order.py +++ b/account_payment_order_grouped_output/models/account_payment_order.py @@ -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: diff --git a/account_payment_order_grouped_output/static/description/icon.png b/account_payment_order_grouped_output/static/description/icon.png new file mode 100644 index 000000000..3a0328b51 Binary files /dev/null and b/account_payment_order_grouped_output/static/description/icon.png differ diff --git a/account_payment_order_grouped_output/static/description/index.html b/account_payment_order_grouped_output/static/description/index.html index 0ff14a5c9..3fb9ea457 100644 --- a/account_payment_order_grouped_output/static/description/index.html +++ b/account_payment_order_grouped_output/static/description/index.html @@ -3,7 +3,7 @@ - + Account Payment Order - Generate grouped moves