[IMP] account: added field reference on bank statements, to hold the name of imported file or online synchronization reference
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -12,7 +12,8 @@
|
||||
<ul id="statement_format">
|
||||
|
||||
</ul>
|
||||
<field name="data_file" placeholder="Choose a file to import..."/>
|
||||
<field name="data_file" filename="filename" placeholder="Choose a file to import..."/>
|
||||
<field name="filename" invisible="1"/>
|
||||
<footer>
|
||||
<button name="import_file" string="_Import" type="object" class="btn-primary" />
|
||||
<button string="Cancel" class="btn-default" special="cancel"/>
|
||||
|
||||
Reference in New Issue
Block a user