mirror of
https://github.com/OCA/account-reconcile.git
synced 2025-01-20 12:27:39 +02:00
[IMP] add the posibility to customise the bank statement name in the parser
This commit is contained in:
@@ -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):
|
||||
"""
|
||||
|
||||
@@ -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(),
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user