[IMP] add the posibility to customise the bank statement name in the parser

This commit is contained in:
Sebastien Beau
2013-12-04 15:10:49 +01:00
parent 3c3b653950
commit 5e80529485
3 changed files with 11 additions and 0 deletions

View File

@@ -51,6 +51,7 @@ class BankStatementImportParser(object):
self.filebuffer = None
self.balance_start = None
self.balance_end = None
self.statement_name = None
@classmethod
def parser_for(cls, parser_name):
@@ -168,6 +169,14 @@ class BankStatementImportParser(object):
"""
return self.balance_end
def get_statement_name(self, *args, **kwargs):
"""
This is called by the importation method to set the statement
date in the bank statement.
return: float of the balance start (self.balance_start)
"""
return self.statement_name or '/'
def itersubclasses(cls, _seen=None):
"""

View File

@@ -160,6 +160,7 @@ class AccountStatementProfil(Model):
"present in the bank statement line!") % col)
st_vals = {
'profile_id': prof.id,
'name': parser.get_statement_name(),
'balance_start': parser.get_start_balance(),
'balance_end_real': parser.get_end_balance(),
}

View File

@@ -97,6 +97,7 @@ class CreditPartnerStatementImporter(orm.TransientModel):
req_id = req_id[0]
importer = self.browse(cr, uid, req_id, context)
ftype = self._check_extension(importer.file_name)
context['file_name'] = importer.file_name
sid = self.pool.get(
'account.statement.profile').statement_import(
cr,