[MIG] account_bank_statement_import_qif: Migration to 11.0

* Metafiles updated
* Test adapted to Python 3
* Code adapted to Python 3
This commit is contained in:
Pedro M. Baeza
2017-10-26 22:06:59 +02:00
parent c313b78525
commit 84b93bba8f
7 changed files with 21 additions and 23 deletions

View File

@@ -26,14 +26,14 @@ Usage
To use this module, you need to:
#. Go to *Accounting* dashboard.
#. Go to *Invoicing / Accounting* dashboard.
#. Click on *Import statement* from any of the bank journals.
#. Select a QIF file.
#. Press *Import*.
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/174/9.0
:target: https://runbot.odoo-community.org/runbot/174/11.0
Bug Tracker
===========
@@ -50,11 +50,15 @@ Credits
Contributors
------------
* Odoo SA
* Alexis de Lattre <alexis@via.ecp.fr>
* Laurent Mignon <laurent.mignon@acsone.eu>
* Ronald Portier <rportier@therp.nl>
* Pedro M. Baeza <pedro.baeza@tecnativa.com>
* Odoo SA
* Akretion
* Alexis de Lattre <alexis@via.ecp.fr>
* ACSONE A/V
* Laurent Mignon <laurent.mignon@acsone.eu>
* Therp
* Ronald Portier <rportier@therp.nl>
* Tecnativa (https://www.tecnativa.com)
* Pedro M. Baeza <pedro.baeza@tecnativa.com>
Maintainer
----------

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import wizards

View File

@@ -1,14 +1,13 @@
# -*- coding: utf-8 -*-
# Copyright 2015 Odoo S. A.
# Copyright 2015 Laurent Mignon <laurent.mignon@acsone.eu>
# Copyright 2015 Ronald Portier <rportier@therp.nl>
# Copyright 2016 Pedro M. Baeza <pedro.baeza@tecnativa.com>
# Copyright 2016-2017 Tecnativa - Pedro M. Baeza
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
'name': 'Import QIF Bank Statements',
'category': 'Accounting',
'version': '10.0.1.0.0',
'version': '11.0.1.0.0',
'author': 'OpenERP SA,'
'Tecnativa,'
'Odoo Community Association (OCA)',

View File

@@ -1,2 +1,3 @@
# -*- coding: utf-8 -*-
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import test_import_bank_statement

View File

@@ -1,12 +1,12 @@
# -*- coding: utf-8 -*-
# Copyright 2015 Odoo S. A.
# Copyright 2015 Laurent Mignon <laurent.mignon@acsone.eu>
# Copyright 2015 Ronald Portier <rportier@therp.nl>
# Copyright 2016 Pedro M. Baeza <pedro.baeza@tecnativa.com>
# Copyright 2016-2017 Tecnativa - Pedro M. Baeza
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo.tests.common import TransactionCase
from odoo.modules.module import get_module_resource
import base64
class TestQifFile(TransactionCase):
@@ -32,7 +32,7 @@ class TestQifFile(TransactionCase):
qif_file_path = get_module_resource(
'account_bank_statement_import_qif', 'tests', 'test_qif.qif',
)
qif_file = open(qif_file_path, 'rb').read().encode('base64')
qif_file = base64.b64encode(open(qif_file_path, 'rb').read())
wizard = self.statement_import_model.with_context(
journal_id=self.journal.id
).create(

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import account_bank_statement_import_qif

View File

@@ -1,11 +1,9 @@
# -*- coding: utf-8 -*-
# Copyright 2015 Odoo S. A.
# Copyright 2015 Laurent Mignon <laurent.mignon@acsone.eu>
# Copyright 2015 Ronald Portier <rportier@therp.nl>
# Copyright 2016 Pedro M. Baeza <pedro.baeza@tecnativa.com>
# Copyright 2016-2017 Tecnativa - Pedro M. Baeza
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
import StringIO
import dateutil.parser
from odoo.tools.translate import _
@@ -18,16 +16,14 @@ class AccountBankStatementImport(models.TransientModel):
@api.model
def _check_qif(self, data_file):
return data_file.strip().startswith('!Type:')
return data_file.strip().startswith(b'!Type:')
def _parse_file(self, data_file):
if not self._check_qif(data_file):
return super(AccountBankStatementImport, self)._parse_file(
data_file)
try:
file_data = ""
for line in StringIO.StringIO(data_file).readlines():
file_data += line
file_data = data_file.decode()
if '\r' in file_data:
data_list = file_data.split('\r')
else: