diff --git a/account_statement_coda_import/__init__.py b/account_statement_coda_import/__init__.py index 29698b5e..87645bba 100644 --- a/account_statement_coda_import/__init__.py +++ b/account_statement_coda_import/__init__.py @@ -1,22 +1,23 @@ # -*- coding: utf-8 -*- -############################################################################## # -# Author: Joel Grand-Guillaume -# Copyright 2011-2012 Camptocamp SA # -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. +# Authors: Laurent Mignon +# Copyright (c) 2013 Acsone SA/NV (http://www.acsone.eu) +# All Rights Reserved # -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . # -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . # -############################################################################## import parser import statement diff --git a/account_statement_coda_import/__openerp__.py b/account_statement_coda_import/__openerp__.py index 45f34076..c370bc6c 100644 --- a/account_statement_coda_import/__openerp__.py +++ b/account_statement_coda_import/__openerp__.py @@ -27,7 +27,7 @@ 'complexity': 'normal', 'depends': [ 'account_statement_base_import', - 'account_statement_transactionid_completion' + 'account_statement_bankaccount_completion' ], 'description': """ This module brings generic methods and fields on bank statement to deal with diff --git a/account_statement_coda_import/parser/__init__.py b/account_statement_coda_import/parser/__init__.py index a70e93fb..f44acb2b 100644 --- a/account_statement_coda_import/parser/__init__.py +++ b/account_statement_coda_import/parser/__init__.py @@ -1,22 +1,23 @@ # -*- coding: utf-8 -*- -############################################################################## # -# Author: Nicolas Bessi -# Copyright 2011-2012 Camptocamp SA # -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. +# Authors: Laurent Mignon +# Copyright (c) 2013 Acsone SA/NV (http://www.acsone.eu) +# All Rights Reserved # -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . # -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . # -############################################################################## import coda_file_parser diff --git a/account_statement_coda_import/parser/coda_file_parser.py b/account_statement_coda_import/parser/coda_file_parser.py index f330c582..ceb3cac4 100644 --- a/account_statement_coda_import/parser/coda_file_parser.py +++ b/account_statement_coda_import/parser/coda_file_parser.py @@ -21,7 +21,7 @@ # import datetime - +import simplejson from coda.parser import Parser from coda.statement import AmountSign, MovementRecordType @@ -103,4 +103,10 @@ class CodaFileParser(BankStatementImportParser): return {'name': "\n".join(filter(None, [line.counterparty_name, line.communication])), 'date': line.entry_date or datetime.datetime.now().date(), 'amount': amount, - 'ref': line.ref} + 'ref': line.ref, + # TODO, since dictionary is directly used by the AccountStatementLine in a bulk insert + # method that bypass the ORM, we need to write by hand, the logic behind field.sparse + # to properly serialize our additional fields ('parner_acc_number', ....) in the right + # container field (additionnal_bank_fields) + 'additionnal_bank_fields': simplejson.dumps({'partner_acc_number': line.counterparty_number or None, + 'partner_bank_bic': line.counterparty_bic or None})} diff --git a/account_statement_coda_import/statement.py b/account_statement_coda_import/statement.py index 969b19d0..6b0afb46 100644 --- a/account_statement_coda_import/statement.py +++ b/account_statement_coda_import/statement.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -############################################################################## +# # # Authors: Laurent Mignon # Copyright (c) 2013 Acsone SA/NV (http://www.acsone.eu) @@ -18,7 +18,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . # -############################################################################## +# from openerp.osv.orm import Model from openerp.osv import fields @@ -32,7 +32,7 @@ class AccountStatementProfil(Model): Has to be inherited to add parser """ res = super(AccountStatementProfil, self).get_import_type_selection( - cr, uid, context=context) + cr, uid, context=context) res.append(('coda_transaction', 'CODA based transaction')) return res