diff --git a/addons/account/models/account_bank_statement.py b/addons/account/models/account_bank_statement.py index 60f06a3feb5..9106b19d512 100644 --- a/addons/account/models/account_bank_statement.py +++ b/addons/account/models/account_bank_statement.py @@ -128,6 +128,7 @@ class AccountBankStatement(models.Model): _inherit = ['mail.thread'] name = fields.Char(string='Reference', states={'open': [('readonly', False)]}, copy=False, readonly=True) + reference = fields.Char(string='External Reference', states={'open': [('readonly', False)]}, copy=False, readonly=True, help="Used to hold the reference of the external mean that created this statement (name of imported file, reference of online synchronization...)") date = fields.Date(required=True, states={'confirm': [('readonly', True)]}, select=True, copy=False, default=fields.Date.context_today) date_done = fields.Datetime(string="Closed On") balance_start = fields.Monetary(string='Starting Balance', states={'confirm': [('readonly', True)]}, default=_default_opening_balance) diff --git a/addons/account_bank_statement_import/account_bank_statement_import.py b/addons/account_bank_statement_import/account_bank_statement_import.py index 87e2de0d860..38d05f478e9 100644 --- a/addons/account_bank_statement_import/account_bank_statement_import.py +++ b/addons/account_bank_statement_import/account_bank_statement_import.py @@ -26,6 +26,7 @@ class AccountBankStatementImport(models.TransientModel): _description = 'Import Bank Statement' data_file = fields.Binary(string='Bank Statement File', required=True, help='Get you bank statements in electronic format from your bank and select them here.') + filename = fields.Char() @api.multi def import_file(self): @@ -164,7 +165,8 @@ class AccountBankStatementImport(models.TransientModel): def _complete_stmts_vals(self, stmts_vals, journal, account_number): for st_vals in stmts_vals: st_vals['journal_id'] = journal.id - + if not st_vals.get('reference'): + st_vals['reference'] = self.filename for line_vals in st_vals['transactions']: unique_import_id = line_vals.get('unique_import_id') if unique_import_id: diff --git a/addons/account_bank_statement_import/account_bank_statement_import_view.xml b/addons/account_bank_statement_import/account_bank_statement_import_view.xml index 8cf9f06af2d..27d945d64e9 100644 --- a/addons/account_bank_statement_import/account_bank_statement_import_view.xml +++ b/addons/account_bank_statement_import/account_bank_statement_import_view.xml @@ -12,7 +12,8 @@ - + +