From fa9f1f6346a02e60deba6feca9cd5935d6e77ead Mon Sep 17 00:00:00 2001 From: Emanuel Cino Date: Wed, 5 Jul 2017 08:54:51 +0200 Subject: [PATCH] [MIG] account_bank_statement_import_camt_details: Migration to 10.0 --- .../{__openerp__.py => __manifest__.py} | 2 +- .../models/account_bank_statement_line.py | 2 +- .../models/camt_parser.py | 12 +++++++++--- .../tests/test_import_bank_statement.py | 16 ++++++++-------- 4 files changed, 19 insertions(+), 13 deletions(-) rename account_bank_statement_import_camt_details/{__openerp__.py => __manifest__.py} (95%) diff --git a/account_bank_statement_import_camt_details/__openerp__.py b/account_bank_statement_import_camt_details/__manifest__.py similarity index 95% rename from account_bank_statement_import_camt_details/__openerp__.py rename to account_bank_statement_import_camt_details/__manifest__.py index ea63f25..3d0c52f 100644 --- a/account_bank_statement_import_camt_details/__openerp__.py +++ b/account_bank_statement_import_camt_details/__manifest__.py @@ -3,7 +3,7 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). { 'name': 'CAMT Debitor Details Bank Statements Import', - 'version': '9.0.1.0.0', + 'version': '10.0.1.0.0', 'license': 'AGPL-3', 'author': 'Odoo Community Association (OCA), Compassion CH', 'website': 'https://github.com/OCA/bank-statement-import', diff --git a/account_bank_statement_import_camt_details/models/account_bank_statement_line.py b/account_bank_statement_import_camt_details/models/account_bank_statement_line.py index 4961ae7..7a3d61a 100644 --- a/account_bank_statement_import_camt_details/models/account_bank_statement_line.py +++ b/account_bank_statement_import_camt_details/models/account_bank_statement_line.py @@ -2,7 +2,7 @@ """Add process_camt method to account.bank.statement.import.""" # © 2017 Compassion CH # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -from openerp import models, fields +from odoo import models, fields class AccountBankStatementLine(models.Model): diff --git a/account_bank_statement_import_camt_details/models/camt_parser.py b/account_bank_statement_import_camt_details/models/camt_parser.py index e4f8c8a..2ad94cf 100644 --- a/account_bank_statement_import_camt_details/models/camt_parser.py +++ b/account_bank_statement_import_camt_details/models/camt_parser.py @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- # © 2017 Compassion CH # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -from openerp import models -from openerp.tools import OrderedDict +from odoo import models +from odoo.tools import OrderedDict class CamtDetailsParser(models.AbstractModel): @@ -44,9 +44,15 @@ class CamtDetailsParser(models.AbstractModel): transaction['partner_address'] = self._format_partner_address( address_values) + # BIC node + bic_node = node.xpath( + './ns:RltdAgts/ns:%sAgt/ns:FinInstnId/ns:BIC' % party_type, + namespaces={'ns': ns}) + if bic_node: + transaction['partner_bic'] = bic_node[0].text + # Transfer account info in fields transaction['partner_account'] = transaction.get('account_number') - transaction['partner_bic'] = transaction.get('account_bic') def _format_partner_address(self, address_values): """ diff --git a/account_bank_statement_import_camt_details/tests/test_import_bank_statement.py b/account_bank_statement_import_camt_details/tests/test_import_bank_statement.py index 167c140..1bdfcb3 100644 --- a/account_bank_statement_import_camt_details/tests/test_import_bank_statement.py +++ b/account_bank_statement_import_camt_details/tests/test_import_bank_statement.py @@ -2,8 +2,8 @@ # © 2017 CompassionCH # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). import base64 -from openerp.tests.common import TransactionCase -from openerp.tools.misc import file_open +from odoo.tests.common import TransactionCase +from odoo.tools.misc import file_open class TestImport(TransactionCase): @@ -28,10 +28,10 @@ class TestImport(TransactionCase): """Test that transaction details are correctly imported.""" line_details = [ { - 'partner_account': 'NL46ABNA0499998748', + 'partner_account': 'NL69ABNA0522123643', 'partner_bic': 'ABNANL2A', - 'partner_name': 'INSURANCE COMPANY TESTX', - 'partner_address': 'TEST STREET 20, 1234 AB TESTCITY' + 'partner_name': '3rd party Media', + 'partner_address': 'SOMESTREET 570-A, 1276 ML HOUSCITY' }, { 'partner_account': 'NL46ABNA0499998748', @@ -39,10 +39,10 @@ class TestImport(TransactionCase): 'partner_name': 'Test Customer', }, { - 'partner_account': 'NL69ABNA0522123643', + 'partner_account': 'NL46ABNA0499998748', 'partner_bic': 'ABNANL2A', - 'partner_name': '3rd party Media', - 'partner_address': 'SOMESTREET 570-A, 1276 ML HOUSCITY' + 'partner_name': 'INSURANCE COMPANY TESTX', + 'partner_address': 'TEST STREET 20, 1234 AB TESTCITY' }, ] with file_open(