Merge pull request #27 from pedrobaeza/7.0-import_start_balance_null

[IMP] account_statement_base_import: Fill balance start when parser doesn't filled it
This commit is contained in:
Pedro M. Baeza
2014-08-04 14:52:55 +02:00

View File

@@ -128,13 +128,22 @@ class AccountStatementProfil(Model):
values = statement_line_obj._add_missing_default_values(cr, uid, values, context) values = statement_line_obj._add_missing_default_values(cr, uid, values, context)
return values return values
def prepare_statement_vals(self, cr, uid, profile_id, result_row_list, parser, context): def prepare_statement_vals(self, cr, uid, profile_id, result_row_list,
parser, context=None):
""" """
Hook to build the values of the statement from the parser and Hook to build the values of the statement from the parser and
the profile. the profile.
""" """
vals = {'profile_id': profile_id} vals = {'profile_id': profile_id}
vals.update(parser.get_st_vals()) vals.update(parser.get_st_vals())
if not vals.get('balance_start'):
# Get starting balance from journal balance if parser doesn't
# fill this data, simulating the manual flow
statement_obj = self.pool['account.bank.statement']
profile = self.browse(cr, uid, profile_id, context=context)
temp = statement_obj.onchange_journal_id(
cr, uid, None, profile.journal_id.id, context=context)
vals['balance_start'] = temp['value'].get('balance_start', False)
return vals return vals
def multi_statement_import(self, cr, uid, ids, profile_id, file_stream, def multi_statement_import(self, cr, uid, ids, profile_id, file_stream,