diff --git a/account_statement_base_import/parser/parser.py b/account_statement_base_import/parser/parser.py index 377548b2..9d8ca4e1 100644 --- a/account_statement_base_import/parser/parser.py +++ b/account_statement_base_import/parser/parser.py @@ -49,6 +49,8 @@ class BankStatementImportParser(object): self.result_row_list = None # The file buffer on which to work on self.filebuffer = None + self.balance_start = None + self.balance_end = None @classmethod def parser_for(cls, parser_name): @@ -150,6 +152,22 @@ class BankStatementImportParser(object): self._post(*args, **kwargs) return self.result_row_list + def get_start_balance(self, *args, **kwargs): + """ + This is called by the importation method to set the balance start + amount in the bank statement. + return: float of the balance start (self.balance_start) + """ + return self.balance_start + + def get_end_balance(self, *args, **kwargs): + """ + This is called by the importation method to set the balance end + amount in the bank statement. + return: float of the balance end (self.balance_end) + """ + return self.balance_end + def itersubclasses(cls, _seen=None): """ diff --git a/account_statement_base_import/statement.py b/account_statement_base_import/statement.py index 97e8e8ab..438f6f1b 100644 --- a/account_statement_base_import/statement.py +++ b/account_statement_base_import/statement.py @@ -158,10 +158,13 @@ class AccountStatementProfil(Model): raise osv.except_osv(_("Missing column!"), _("Column %s you try to import is not " "present in the bank statement line!") % col) - - statement_id = statement_obj.create(cr, uid, - {'profile_id': prof.id}, - context=context) + st_vals = { + 'profile_id': prof.id, + 'balance_start': parser.get_start_balance(), + 'balance_end_real': parser.get_end_balance(), + } + + statement_id = statement_obj.create(cr, uid, st_vals, context=context) if prof.receivable_account_id: account_receivable = account_payable = prof.receivable_account_id.id else: