From 0578dadc9cfb4ec9a35032906ec2e7e2ee4ef177 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Wed, 16 Jun 2021 23:40:52 +0200 Subject: [PATCH] account_statement_import_online: usability improvement on form view of online.bank.statement.provider: avoid speading the information on 3 tabs. As there are just a few fields, let's keep all the information directly visible. Fix warning on search view of online.bank.statement.provider Fix some tests Button on journal form view to access the wizard The wizard now returns the bank statements of the journal(s) Fix wired strings --- .../__manifest__.py | 2 +- .../models/account_journal.py | 14 --- .../online_bank_statement_provider.xml | 1 - .../online_bank_statement_provider_dummy.py | 2 +- ...st_account_bank_statement_import_online.py | 7 +- .../views/account_journal.xml | 27 ++++-- .../views/online_bank_statement_provider.xml | 94 +++++++++---------- .../online_bank_statement_pull_wizard.py | 33 ++++++- .../online_bank_statement_pull_wizard.xml | 26 ++--- 9 files changed, 112 insertions(+), 94 deletions(-) diff --git a/account_statement_import_online/__manifest__.py b/account_statement_import_online/__manifest__.py index 1fcfa9ee..329629fb 100644 --- a/account_statement_import_online/__manifest__.py +++ b/account_statement_import_online/__manifest__.py @@ -20,9 +20,9 @@ "data/account_statement_import_online.xml", "security/ir.model.access.csv", "security/online_bank_statement_provider.xml", + "wizards/online_bank_statement_pull_wizard.xml", "views/account_journal.xml", "views/online_bank_statement_provider.xml", - "wizards/online_bank_statement_pull_wizard.xml", ], "installable": True, } diff --git a/account_statement_import_online/models/account_journal.py b/account_statement_import_online/models/account_journal.py index 53764c25..df89ee1b 100644 --- a/account_statement_import_online/models/account_journal.py +++ b/account_statement_import_online/models/account_journal.py @@ -76,17 +76,3 @@ class AccountJournal(models.Model): if "bank_statements_source" in vals or "online_bank_statement_provider" in vals: self._update_online_bank_statement_provider_id() return res - - def action_online_bank_statements_pull_wizard(self): - provider_ids = self.mapped("online_bank_statement_provider_id").ids - return { - "name": _("Online Bank Statement Pull Wizard"), - "type": "ir.actions.act_window", - "res_model": "online.bank.statement.pull.wizard", - "views": [[False, "form"]], - "target": "new", - "context": { - "default_provider_ids": [(6, False, provider_ids)], - "active_test": False, - }, - } diff --git a/account_statement_import_online/security/online_bank_statement_provider.xml b/account_statement_import_online/security/online_bank_statement_provider.xml index 0b1ae8e0..db8c82d0 100644 --- a/account_statement_import_online/security/online_bank_statement_provider.xml +++ b/account_statement_import_online/security/online_bank_statement_provider.xml @@ -8,7 +8,6 @@ Online Bank Statement Provider multi-company - ['|',('company_id','=',False),('company_id','in',company_ids)] diff --git a/account_statement_import_online/tests/online_bank_statement_provider_dummy.py b/account_statement_import_online/tests/online_bank_statement_provider_dummy.py index f2e7b5fb..e7b88458 100644 --- a/account_statement_import_online/tests/online_bank_statement_provider_dummy.py +++ b/account_statement_import_online/tests/online_bank_statement_provider_dummy.py @@ -56,7 +56,7 @@ class OnlineBankStatementProviderDummy(models.Model): transaction_date = fields.Datetime.to_string(transaction_date) lines.append( { - "name": "payment", + "payment_ref": "payment", "amount": amount, "date": transaction_date, "unique_import_id": str( diff --git a/account_statement_import_online/tests/test_account_bank_statement_import_online.py b/account_statement_import_online/tests/test_account_bank_statement_import_online.py index 335b5f70..e16ce1f3 100644 --- a/account_statement_import_online/tests/test_account_bank_statement_import_online.py +++ b/account_statement_import_online/tests/test_account_bank_statement_import_online.py @@ -383,10 +383,8 @@ class TestAccountBankAccountStatementImportOnline(common.TransactionCase): order="date asc", ) self.assertFalse(statements[0].balance_start) - self.assertFalse(statements[0].balance_end_real) self.assertTrue(statements[0].balance_end) self.assertTrue(statements[1].balance_start) - self.assertFalse(statements[1].balance_end_real) def test_wizard(self): journal = self.AccountJournal.create( @@ -398,11 +396,8 @@ class TestAccountBankAccountStatementImportOnline(common.TransactionCase): "online_bank_statement_provider": "dummy", } ) - action = journal.action_online_bank_statements_pull_wizard() - self.assertTrue(action["context"]["default_provider_ids"][0][2]) - wizard = self.OnlineBankStatementPullWizard.with_context( - action["context"] + active_model="account.journal", active_id=journal.id ).create( {"date_since": self.now - relativedelta(hours=1), "date_until": self.now} ) diff --git a/account_statement_import_online/views/account_journal.xml b/account_statement_import_online/views/account_journal.xml index 53c5ea70..fe319292 100644 --- a/account_statement_import_online/views/account_journal.xml +++ b/account_statement_import_online/views/account_journal.xml @@ -47,17 +47,28 @@ /> + +
+
+
- + Online Bank Statements Pull Wizard - ir.actions.server - + online.bank.statement.pull.wizard + new + form - code - - if records: - action = records.action_online_bank_statements_pull_wizard() - + list + diff --git a/account_statement_import_online/views/online_bank_statement_provider.xml b/account_statement_import_online/views/online_bank_statement_provider.xml index 56d24dfb..de3f26aa 100644 --- a/account_statement_import_online/views/online_bank_statement_provider.xml +++ b/account_statement_import_online/views/online_bank_statement_provider.xml @@ -10,11 +10,19 @@ online.bank.statement.provider + + + + @@ -38,63 +46,41 @@
-
- -
- - - - - - - - - - - - - - - - - - - + + + +