Skip to content

Commit

Permalink
[MIG] account_payment_return_import: Migration to 17.0
Browse files Browse the repository at this point in the history
TT49283
  • Loading branch information
carolinafernandez-tecnativa committed Jul 25, 2024
1 parent 60018d6 commit 192ec16
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 46 deletions.
5 changes: 3 additions & 2 deletions account_payment_return_import/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ Account Payment Return Import
!! source digest: sha256:59ba0330c4a2226f8b777e3827942848bbb5f0e29445c7bf13efdf2a8248e26b
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Mature-brightgreen.png
.. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png
:target: https://odoo-community.org/page/development-status
:alt: Mature
:alt: Production/Stable
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
Expand Down Expand Up @@ -91,6 +91,7 @@ Contributors
- Luis M. Ontalba
- Ernesto Tejeda
- Yadier Quesada
- Carolina Fernandez

Maintainers
-----------
Expand Down
5 changes: 3 additions & 2 deletions account_payment_return_import/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# Copyright 2016 Tecnativa - Carlos Dauden
# Copyright 2016-2020 Tecnativa - Pedro M. Baeza
# Copyright 2017 Tecnativa - David Vidal
# Copyright 2024 Tecnativa - Carolina Fernandez
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
"name": "Account Payment Return Import",
"category": "Accounting",
"version": "16.0.1.0.1",
"development_status": "Mature",
"version": "17.0.1.0.0",
"development_status": "Production/Stable",
"summary": "This module adds a generic wizard to import payment return"
"file formats. Is only the base to be extended by another"
"modules",
Expand Down
1 change: 1 addition & 0 deletions account_payment_return_import/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
- Luis M. Ontalba
- Ernesto Tejeda
- Yadier Quesada
- Carolina Fernandez
3 changes: 2 additions & 1 deletion account_payment_return_import/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ <h1 class="title">Account Payment Return Import</h1>
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:59ba0330c4a2226f8b777e3827942848bbb5f0e29445c7bf13efdf2a8248e26b
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Mature" src="https://img.shields.io/badge/maturity-Mature-brightgreen.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/account-payment/tree/17.0/account_payment_return_import"><img alt="OCA/account-payment" src="https://img.shields.io/badge/github-OCA%2Faccount--payment-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/account-payment-17-0/account-payment-17-0-account_payment_return_import"><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/account-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><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Production/Stable" src="https://img.shields.io/badge/maturity-Production%2FStable-green.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/account-payment/tree/17.0/account_payment_return_import"><img alt="OCA/account-payment" src="https://img.shields.io/badge/github-OCA%2Faccount--payment-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/account-payment-17-0/account-payment-17-0-account_payment_return_import"><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/account-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 generic wizard + methods to import payment return
file formats.</p>
<p>It’s a base to be extended by another modules though it allows to import
Expand Down Expand Up @@ -432,6 +432,7 @@ <h2><a class="toc-backref" href="#toc-entry-5">Contributors</a></h2>
<li>Luis M. Ontalba</li>
<li>Ernesto Tejeda</li>
<li>Yadier Quesada</li>
<li>Carolina Fernandez</li>
</ul>
</li>
</ul>
Expand Down
10 changes: 0 additions & 10 deletions account_payment_return_import/tests/test_import_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,6 @@ class TestImportBase(TestPaymentReturnFile):
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.env = cls.env(
context=dict(
cls.env.context,
mail_create_nolog=True,
mail_create_nosubscribe=True,
mail_notrack=True,
no_reset_password=True,
tracking_disable=True,
)
)
cls.company = cls.env.ref("base.main_company")
cls.acc_number = "NL77ABNA0574908765"
cls.acc_bank = cls.env["res.partner.bank"].create(
Expand Down
26 changes: 9 additions & 17 deletions account_payment_return_import/tests/test_import_file.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
# Copyright 2016 Tecnativa - Carlos Dauden
# Copyright 2018 Tecnativa - Luis M. Ontalba
# Copyright 2024 Tecnativa - Carolina Fernandez
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

import base64
import logging

from odoo import fields
from odoo.modules.module import get_module_resource
from odoo.tests.common import TransactionCase
from odoo.tools.misc import file_open, file_path

from odoo.addons.base.tests.common import BaseCommon

_logger = logging.getLogger(__name__)


class TestPaymentReturnFile(TransactionCase):
class TestPaymentReturnFile(BaseCommon):
"""Check whether payment returns with transactions correctly imported.
No actual tests are done in this class, implementations are in
Expand All @@ -22,16 +24,6 @@ class TestPaymentReturnFile(TransactionCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.env = cls.env(
context=dict(
cls.env.context,
mail_create_nolog=True,
mail_create_nosubscribe=True,
mail_notrack=True,
no_reset_password=True,
tracking_disable=True,
)
)

def _test_transaction(
self, return_obj, reference=False, returned_amount=False, reason_add_info=False
Expand Down Expand Up @@ -74,8 +66,8 @@ def _test_return_import(
"""Test correct creation of single return."""
import_model = self.env["payment.return.import"]
return_model = self.env["payment.return"]
return_path = get_module_resource(module_name, "tests", "test_files", file_name)
return_file = base64.b64encode(open(return_path, "rb").read())
return_path = file_path(module_name + "/tests/test_files/" + file_name)
return_file = base64.b64encode(file_open(return_path, "rb").read())
bank_return_id = import_model.create(
dict(
data_file=return_file,
Expand All @@ -95,8 +87,8 @@ def _test_return_import(
self.assertEqual(

Check warning on line 87 in account_payment_return_import/tests/test_import_file.py

View check run for this annotation

Codecov / codecov/patch

account_payment_return_import/tests/test_import_file.py#L87

Added line #L87 was not covered by tests
fields.Date.to_string(return_obj.date),
date,
"Date %s not equal to expected %s"
% (fields.Date.to_string(return_obj.date), date),
f"Date {fields.Date.to_string(return_obj.date)}\
not equal to expected {date}",
)
if transactions:
for transaction in transactions:
Expand Down
14 changes: 2 additions & 12 deletions account_payment_return_import/tests/test_import_payment_return.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,13 @@
# Copyright 2016 Tecnativa - Carlos Dauden
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo.tests.common import TransactionCase
from odoo.addons.base.tests.common import BaseCommon


class TestAccountPaymentReturnImport(TransactionCase):
class TestAccountPaymentReturnImport(BaseCommon):
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.env = cls.env(
context=dict(
cls.env.context,
mail_create_nolog=True,
mail_create_nosubscribe=True,
mail_notrack=True,
no_reset_password=True,
tracking_disable=True,
)
)
cls.return_import_model = cls.env["payment.return.import"]
cls.company = cls.env.ref("base.main_company")
cls.acc_number = "NL77ABNA0574908765"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<field name="journal_id" position="after">
<field
name="imported_bank_account_id"
attrs="{'invisible': [('imported_bank_account_id', '=', False)]}"
invisible="not imported_bank_account_id"
/>
</field>
</field>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<field
name="journal_id"
domain="[('type', '=', 'bank')]"
attrs="{'invisible': [('hide_journal_field', '=', True)]}"
invisible="hide_journal_field"
context="{'default_type':'bank'}"
/>
<footer>
Expand Down

0 comments on commit 192ec16

Please sign in to comment.