mirror of
https://github.com/OCA/bank-statement-import.git
synced 2025-01-20 12:37:43 +02:00
[MIG] account_bank_statement_import_paypal: adapt improvements to v11
This commit is contained in:
@@ -20,11 +20,6 @@
|
||||
'multi_step_wizard',
|
||||
'web_widget_dropdown_dynamic',
|
||||
],
|
||||
'external_dependencies': {
|
||||
'python': [
|
||||
'csv',
|
||||
]
|
||||
},
|
||||
'data': [
|
||||
'security/ir.model.access.csv',
|
||||
'data/maps.xml',
|
||||
|
||||
@@ -3,4 +3,3 @@
|
||||
from . import account_bank_statement_import_paypal_mapping
|
||||
from . import account_bank_statement_import_paypal_parser
|
||||
from . import account_bank_statement_import
|
||||
from . import account_journal
|
||||
|
||||
@@ -32,4 +32,4 @@ class AccountBankStatementImport(models.TransientModel):
|
||||
'account_bank_statement_import_paypal_test'):
|
||||
raise
|
||||
_logger.warning('PayPal parser error', exc_info=True)
|
||||
return super()._parse_file(data_file)
|
||||
return super(AccountBankStatementImport, self)._parse_file(data_file)
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
# Copyright 2019 Tecnativa - Vicent Cubells
|
||||
# Copyright 2019 Brainbean Apps (https://brainbeanapps.com)
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import models
|
||||
|
||||
|
||||
class AccountJournal(models.Model):
|
||||
_inherit = 'account.journal'
|
||||
|
||||
def _get_bank_statements_available_import_formats(self):
|
||||
res = super()._get_bank_statements_available_import_formats()
|
||||
res.append('PayPal Reports')
|
||||
return res
|
||||
@@ -1,5 +1,5 @@
|
||||
# Copyright 2019 Tecnativa - Vicent Cubells
|
||||
# Copyright 2019 Brainbean Apps (https://brainbeanapps.com)
|
||||
# Copyright 2019-2020 Brainbean Apps (https://brainbeanapps.com)
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import fields
|
||||
@@ -12,7 +12,7 @@ from os import path
|
||||
|
||||
class TestAccountBankStatementImportPayPal(common.TransactionCase):
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
super(TestAccountBankStatementImportPayPal, self).setUp()
|
||||
|
||||
self.now = fields.Datetime.now()
|
||||
self.currency_eur = self.env.ref('base.EUR')
|
||||
@@ -47,7 +47,6 @@ class TestAccountBankStatementImportPayPal(common.TransactionCase):
|
||||
'name': 'PayPal',
|
||||
'type': 'bank',
|
||||
'code': 'PP',
|
||||
'currency_id': self.currency_usd.id,
|
||||
})
|
||||
wizard = self.AccountBankStatementImport.with_context({
|
||||
'journal_id': journal.id,
|
||||
@@ -119,7 +118,6 @@ class TestAccountBankStatementImportPayPal(common.TransactionCase):
|
||||
'name': 'PayPal',
|
||||
'type': 'bank',
|
||||
'code': 'PP',
|
||||
'currency_id': self.currency_usd.id,
|
||||
})
|
||||
wizard = self.AccountBankStatementImport.with_context({
|
||||
'journal_id': journal.id,
|
||||
@@ -143,7 +141,6 @@ class TestAccountBankStatementImportPayPal(common.TransactionCase):
|
||||
'name': 'PayPal',
|
||||
'type': 'bank',
|
||||
'code': 'PP',
|
||||
'currency_id': self.currency_usd.id,
|
||||
})
|
||||
wizard = self.AccountBankStatementImport.with_context({
|
||||
'journal_id': journal.id,
|
||||
@@ -163,39 +160,27 @@ class TestAccountBankStatementImportPayPal(common.TransactionCase):
|
||||
self.assertEqual(len(statement), 0)
|
||||
|
||||
def test_import_activity_mapping_en(self):
|
||||
with common.Form(
|
||||
self.AccountBankStatementImportPayPalMappingWizard) as form:
|
||||
form.filename = 'fixtures/activity_en.csv'
|
||||
form.data_file = self._data_file(
|
||||
'fixtures/activity_en.csv'
|
||||
)
|
||||
wizard = self.AccountBankStatementImportPayPalMappingWizard.new({
|
||||
'filename': 'fixtures/activity_en.csv',
|
||||
'data_file': self._data_file('fixtures/activity_en.csv'),
|
||||
})
|
||||
wizard._onchange_data_file()
|
||||
self.assertEqual(
|
||||
len(
|
||||
self.AccountBankStatementImportPayPalMappingWizard
|
||||
.with_context(
|
||||
header=form.header,
|
||||
).statement_columns()
|
||||
),
|
||||
len(self.AccountBankStatementImportPayPalMappingWizard
|
||||
.with_context(header=wizard.header).statement_columns()),
|
||||
22
|
||||
)
|
||||
wizard = form.save()
|
||||
wizard.import_mapping()
|
||||
|
||||
def test_import_statement_mapping_en(self):
|
||||
with common.Form(
|
||||
self.AccountBankStatementImportPayPalMappingWizard) as form:
|
||||
form.filename = 'fixtures/statement_en.csv'
|
||||
form.data_file = self._data_file(
|
||||
'fixtures/statement_en.csv'
|
||||
)
|
||||
wizard = self.AccountBankStatementImportPayPalMappingWizard.new({
|
||||
'filename': 'fixtures/statement_en.csv',
|
||||
'data_file': self._data_file('fixtures/statement_en.csv'),
|
||||
})
|
||||
wizard._onchange_data_file()
|
||||
self.assertEqual(
|
||||
len(
|
||||
self.AccountBankStatementImportPayPalMappingWizard
|
||||
.with_context(
|
||||
header=form.header,
|
||||
).statement_columns()
|
||||
),
|
||||
len(self.AccountBankStatementImportPayPalMappingWizard
|
||||
.with_context(header=wizard.header).statement_columns()),
|
||||
18
|
||||
)
|
||||
wizard = form.save()
|
||||
wizard.import_mapping()
|
||||
|
||||
@@ -143,12 +143,8 @@
|
||||
</group>
|
||||
</group>
|
||||
</xpath>
|
||||
<xpath expr="//div[@name='final_buttons']/button" position="attributes">
|
||||
<attribute name="class">btn-default</attribute>
|
||||
<attribute name="string">Cancel</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//div[@name='final_buttons']/button" position="before">
|
||||
<button name="import_mapping" string="Import" type="object" class="btn-primary" />
|
||||
<xpath expr="//div[@name='states_buttons']/button" position="before">
|
||||
<button name="import_mapping" string="Import" type="object" class="btn-primary" attrs="{'invisible': [('state', '=', 'final')]}" />
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -1,3 +1,2 @@
|
||||
web
|
||||
server-ux
|
||||
connector-jira
|
||||
|
||||
Reference in New Issue
Block a user