Skip to content

Commit

Permalink
[MIG] account_statement_import_online_ponto: Migration to 17.0
Browse files Browse the repository at this point in the history
TT51521
  • Loading branch information
victoralmau committed Nov 15, 2024
1 parent b2fb611 commit 82d7a39
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 21 deletions.
2 changes: 1 addition & 1 deletion account_statement_import_online_ponto/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Online Bank Statements: MyPonto.com",
"version": "16.0.1.1.1",
"version": "17.0.1.0.0",
"category": "Account",
"website": "https://github.com/OCA/bank-statement-import",
"author": "Florent de Labarre, Therp BV, Odoo Community Association (OCA)",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
from unittest import mock

from odoo import _, fields
from odoo.tests import common
from odoo.tests import tagged

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

_logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -174,9 +176,8 @@
transaction_amounts = [5.48, 5.83, 6.08, 8.95]


class TestAccountStatementImportOnlinePonto(common.TransactionCase):
post_install = True

@tagged("post_install", "-at_install")
class TestAccountStatementImportOnlinePonto(BaseCommon):
def setUp(self):
super().setUp()

Expand Down Expand Up @@ -257,7 +258,7 @@ def test_balance_start(self):
self.provider._create_or_update_statement(
data, statement_date, datetime(2019, 11, 2)
)
with self.mock_login(), self.mock_set_access_account(), self.mock_get_transactions(): # noqa: B950
with self.mock_login(), self.mock_set_access_account(), self.mock_get_transactions(): # noqa: E501
vals = {
"date_since": datetime(2019, 11, 4),
"date_until": datetime(2019, 11, 5),
Expand All @@ -277,23 +278,23 @@ def test_balance_start(self):
self.assertEqual(new_statement.balance_end, 105.83)

def test_ponto_execution_date(self):
with self.mock_login(), self.mock_set_access_account(), self.mock_get_transactions(): # noqa: B950
with self.mock_login(), self.mock_set_access_account(), self.mock_get_transactions(): # noqa: E501
# First base selection on execution date.
self.provider.ponto_date_field = "execution_date"
statement = self._get_statements_from_wizard() # Will get 1 statement
self._check_line_count(statement.line_ids, expected_count=2)
self._check_statement_amounts(statement, transaction_amounts[:2])

def test_ponto_value_date(self):
with self.mock_login(), self.mock_set_access_account(), self.mock_get_transactions(): # noqa: B950
with self.mock_login(), self.mock_set_access_account(), self.mock_get_transactions(): # noqa: E501
# First base selection on execution date.
self.provider.ponto_date_field = "value_date"
statement = self._get_statements_from_wizard() # Will get 1 statement
self._check_line_count(statement.line_ids, expected_count=3)
self._check_statement_amounts(statement, transaction_amounts[:3])

def test_ponto_get_transactions_multi(self):
with self.mock_login(), self.mock_set_access_account(), self.mock_get_transactions_multi(): # noqa: B950
with self.mock_login(), self.mock_set_access_account(), self.mock_get_transactions_multi(): # noqa: E501
# First base selection on execution date.
self.provider.ponto_date_field = "execution_date"
# Expect statements for october and november.
Expand All @@ -310,7 +311,7 @@ def test_ponto_get_transactions_multi(self):
)

def test_ponto_scheduled(self):
with self.mock_login(), self.mock_set_access_account(), self.mock_get_transactions(): # noqa: B950
with self.mock_login(), self.mock_set_access_account(), self.mock_get_transactions(): # noqa: E501
# Scheduled should get all transaction, ignoring date_until.
self.provider.ponto_last_identifier = False
date_since = datetime(2019, 11, 3)
Expand All @@ -326,7 +327,7 @@ def test_ponto_scheduled(self):
)

def test_ponto_scheduled_from_identifier(self):
with self.mock_login(), self.mock_set_access_account(), self.mock_get_transactions(): # noqa: B950
with self.mock_login(), self.mock_set_access_account(), self.mock_get_transactions(): # noqa: E501
# Scheduled should get all transactions after last identifier.
self.provider.ponto_last_identifier = "9ac50483-16dc-4a82-aa60-df56077405cd"
date_since = datetime(2019, 11, 3)
Expand Down Expand Up @@ -416,7 +417,7 @@ def test_wizard_action_debug(self):
self.provider._create_or_update_statement(
data, statement_date, datetime(2019, 11, 2)
)
with self.mock_login(), self.mock_set_access_account(), self.mock_get_transactions(): # noqa: B950
with self.mock_login(), self.mock_set_access_account(), self.mock_get_transactions(): # noqa: E501
vals = {
"date_since": datetime(2019, 11, 4),
"date_until": datetime(2019, 11, 5),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@
from dateutil.relativedelta import relativedelta

from odoo import fields
from odoo.tests import common
from odoo.tests import tagged

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

from .test_account_statement_import_online_ponto import FOUR_TRANSACTIONS

class TestPontoInterface(common.TransactionCase):
post_install = True

@tagged("post_install", "-at_install")
class TestPontoInterface(BaseCommon):
@patch("requests.post")
def test_login(self, requests_post):
"""Check Ponto API login."""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,7 @@
/>
<field name="arch" type="xml">
<xpath expr="//group[@name='main']" position="inside">
<group
name="ponto"
string="Ponto Config"
attrs="{'invisible':[('service','!=','ponto')]}"
>
<group name="ponto" string="Ponto Config" invisible="service!='ponto'">
<field name="username" string="Login" />
<field name="password" string="Secret Key" />
<field name="ponto_date_field" />
Expand Down

0 comments on commit 82d7a39

Please sign in to comment.