From 7536f2a830354434c5dd6f68c6ab20e7c8f80714 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ant=C3=B4nio=20Neto?= Date: Thu, 25 Jul 2024 22:41:52 -0300 Subject: [PATCH] [MIG] l10n_br_cnab_structure: Migration to 15.0 --- l10n_br_cnab_structure/README.rst | 10 +++---- l10n_br_cnab_structure/__manifest__.py | 2 +- .../demo/account_journal.xml | 15 +++++++--- .../models/l10n_br_cnab_event.py | 30 +++++++++++++------ .../static/description/index.html | 17 ++++++----- .../tests/test_cnab_structure.py | 2 +- .../tests/test_return_log.py | 4 +-- l10n_br_cnab_structure/views/journal_view.xml | 6 ++-- .../wizard/cnab_import_wizard.py | 6 ++-- 9 files changed, 57 insertions(+), 35 deletions(-) diff --git a/l10n_br_cnab_structure/README.rst b/l10n_br_cnab_structure/README.rst index afea5df9b141..801bd9249400 100644 --- a/l10n_br_cnab_structure/README.rst +++ b/l10n_br_cnab_structure/README.rst @@ -17,13 +17,13 @@ CNAB Structure :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fl10n--brazil-lightgray.png?logo=github - :target: https://github.com/OCA/l10n-brazil/tree/14.0/l10n_br_cnab_structure + :target: https://github.com/OCA/l10n-brazil/tree/15.0/l10n_br_cnab_structure :alt: OCA/l10n-brazil .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/l10n-brazil-14-0/l10n-brazil-14-0-l10n_br_cnab_structure + :target: https://translation.odoo-community.org/projects/l10n-brazil-15-0/l10n-brazil-15-0-l10n_br_cnab_structure :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/l10n-brazil&target_branch=14.0 + :target: https://runboat.odoo-community.org/builds?repo=OCA/l10n-brazil&target_branch=15.0 :alt: Try me on Runboat |badge1| |badge2| |badge3| |badge4| |badge5| @@ -55,7 +55,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 to smash it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -109,6 +109,6 @@ Current `maintainers `__: |maintainer-antoniospneto| |maintainer-felipemotter| -This module is part of the `OCA/l10n-brazil `_ project on GitHub. +This module is part of the `OCA/l10n-brazil `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/l10n_br_cnab_structure/__manifest__.py b/l10n_br_cnab_structure/__manifest__.py index 60d0f6f35b5f..514dc4e4a532 100644 --- a/l10n_br_cnab_structure/__manifest__.py +++ b/l10n_br_cnab_structure/__manifest__.py @@ -6,7 +6,7 @@ "summary": """ This module allows defining the structure for generating the CNAB file. Used to exchange information with Brazilian banks.""", - "version": "14.0.1.2.0", + "version": "15.0.1.0.0", "author": "Engenere, Escodoo, Odoo Community Association (OCA)", "maintainers": ["antoniospneto", "felipemotter"], "website": "https://github.com/OCA/l10n-brazil", diff --git a/l10n_br_cnab_structure/demo/account_journal.xml b/l10n_br_cnab_structure/demo/account_journal.xml index a22e583c7819..e57f2e7c48f6 100644 --- a/l10n_br_cnab_structure/demo/account_journal.xml +++ b/l10n_br_cnab_structure/demo/account_journal.xml @@ -8,10 +8,6 @@ - True oca_processor + + ITAU CNAB 240 + + + diff --git a/l10n_br_cnab_structure/models/l10n_br_cnab_event.py b/l10n_br_cnab_structure/models/l10n_br_cnab_event.py index 60fc60f01f3a..582e6ee40f22 100644 --- a/l10n_br_cnab_structure/models/l10n_br_cnab_event.py +++ b/l10n_br_cnab_structure/models/l10n_br_cnab_event.py @@ -258,10 +258,14 @@ def _get_reconciliation_items(self, move_id): def _create_counterpart_move_line(self, move_id, partner_id): if self.move_line_ids[0].balance < 0: debit_or_credit = "credit" - account_id = self.journal_id.payment_credit_account_id + account_id = ( + self.journal_id.company_id.account_journal_payment_credit_account_id + ) else: debit_or_credit = "debit" - account_id = self.journal_id.payment_debit_account_id + account_id = ( + self.journal_id.company_id.account_journal_payment_debit_account_id + ) move_line_obj = self.env["account.move.line"] counterpart_vals = { "move_id": move_id.id, @@ -282,7 +286,9 @@ def _create_tariff_move_lines(self, move_id): { "name": "Bank Tariff: " + self.your_number, "credit": self.tariff_charge, - "account_id": self.journal_id.payment_credit_account_id.id, + "account_id": ( + self.journal_id.company_id.account_journal_payment_credit_account_id.id + ), "partner_id": self.move_line_ids[0].partner_id.id, "move_id": move_id.id, } @@ -341,7 +347,9 @@ def _create_rebate_move_lines(self, move_id): if self.cnab_return_log_id.type == "inbound": credit_move_line[ "account_id" - ] = self.journal_id.payment_credit_account_id.id + ] = ( + self.journal_id.company_id.account_journal_payment_credit_account_id.id + ) debit_move_line[ "account_id" ] = self.journal_id.inbound_rebate_account_id.id @@ -351,7 +359,7 @@ def _create_rebate_move_lines(self, move_id): ] = self.journal_id.outbound_rebate_account_id.id debit_move_line[ "account_id" - ] = self.journal_id.payment_debit_account_id.id + ] = self.journal_id.company_id.account_journal_payment_debit_account_id move_line_obj.with_context(check_move_validity=False).create( [credit_move_line, debit_move_line] @@ -375,7 +383,9 @@ def _create_discount_move_lines(self, move_id): if self.cnab_return_log_id.type == "inbound": credit_move_line[ "account_id" - ] = self.journal_id.payment_credit_account_id.id + ] = ( + self.journal_id.company_id.account_journal_payment_credit_account_id.id + ) debit_move_line[ "account_id" ] = self.journal_id.inbound_discount_account_id.id @@ -385,7 +395,7 @@ def _create_discount_move_lines(self, move_id): ] = self.journal_id.outbound_discount_account_id.id debit_move_line[ "account_id" - ] = self.journal_id.payment_debit_account_id.id + ] = self.journal_id.company_id.account_journal_payment_debit_account_id move_line_obj.with_context(check_move_validity=False).create( [credit_move_line, debit_move_line] @@ -412,11 +422,13 @@ def _create_fees_move_lines(self, move_id): ] = self.journal_id.inbound_interest_fee_account_id.id debit_move_line[ "account_id" - ] = self.journal_id.payment_debit_account_id.id + ] = self.journal_id.company_id.account_journal_payment_debit_account_id else: credit_move_line[ "account_id" - ] = self.journal_id.payment_credit_account_id.id + ] = ( + self.journal_id.company_id.account_journal_payment_credit_account_id.id + ) debit_move_line[ "account_id" ] = self.journal_id.outbound_interest_fee_account_id.id diff --git a/l10n_br_cnab_structure/static/description/index.html b/l10n_br_cnab_structure/static/description/index.html index 9dcaec6b600d..1341285a69d2 100644 --- a/l10n_br_cnab_structure/static/description/index.html +++ b/l10n_br_cnab_structure/static/description/index.html @@ -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 @@ 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.pre { white-space: pre } -span.problematic { +span.problematic, pre.problematic { color: red } span.section-subtitle { @@ -368,7 +369,7 @@

CNAB Structure

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! source digest: sha256:96ca0f1eb804341d0e36d4d79df0162d6a5e3be4ee9f214c6e217d9a00027048 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

Beta License: AGPL-3 OCA/l10n-brazil Translate me on Weblate Try me on Runboat

+

Beta License: AGPL-3 OCA/l10n-brazil Translate me on Weblate Try me on Runboat

This module adds functionality for implementing brazilian banking automation by CNAB file exchange.

Table of contents

@@ -405,7 +406,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 to smash it by providing a detailed and welcomed -feedback.

+feedback.

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

@@ -438,13 +439,15 @@

Other credits

Maintainers

This module is maintained by the OCA.

-Odoo Community Association + +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 maintainers:

antoniospneto felipemotter

-

This module is part of the OCA/l10n-brazil project on GitHub.

+

This module is part of the OCA/l10n-brazil project on GitHub.

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

diff --git a/l10n_br_cnab_structure/tests/test_cnab_structure.py b/l10n_br_cnab_structure/tests/test_cnab_structure.py index d3d761137c31..1f230a8af518 100644 --- a/l10n_br_cnab_structure/tests/test_cnab_structure.py +++ b/l10n_br_cnab_structure/tests/test_cnab_structure.py @@ -342,7 +342,7 @@ def test_field_select_wizard(self): field_select_wizard = ( self.env[wiz_action["res_model"]] - .with_context(wiz_action["context"]) + .with_context(**wiz_action["context"]) .create({}) ) diff --git a/l10n_br_cnab_structure/tests/test_return_log.py b/l10n_br_cnab_structure/tests/test_return_log.py index 9c65dd942502..09c6e9129896 100644 --- a/l10n_br_cnab_structure/tests/test_return_log.py +++ b/l10n_br_cnab_structure/tests/test_return_log.py @@ -127,8 +127,8 @@ def test_move_create(self): lambda line: line.account_id in ( self.bank_journal_itau.default_account_id, - self.bank_journal_itau.payment_debit_account_id, - self.bank_journal_itau.payment_credit_account_id, + self.bank_journal_itau.company_id.account_journal_payment_debit_account_id, + self.bank_journal_itau.company_id.account_journal_payment_credit_account_id, ) ) rebate_moves = event.generated_move_id.line_ids.filtered( diff --git a/l10n_br_cnab_structure/views/journal_view.xml b/l10n_br_cnab_structure/views/journal_view.xml index 50acd8362622..230693b978e7 100644 --- a/l10n_br_cnab_structure/views/journal_view.xml +++ b/l10n_br_cnab_structure/views/journal_view.xml @@ -11,13 +11,13 @@ account.journal - + - +
- -