add account number and bank bic to statement line

Be carefull, values returned by the parser are now formatted to work arround a bug in the bulk insert... see comment in the coda_file_parser.py
This commit is contained in:
Laurent Mignon (Acsone)
2013-08-22 17:12:09 +02:00
parent 4c3d705192
commit d122becbdb
5 changed files with 42 additions and 34 deletions

View File

@@ -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 <http://www.gnu.org/licenses/>.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import parser
import statement

View File

@@ -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

View File

@@ -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 <http://www.gnu.org/licenses/>.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import coda_file_parser

View File

@@ -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})}

View File

@@ -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 <http://www.gnu.org/licenses/>.
#
##############################################################################
#
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