mirror of
https://github.com/OCA/account-reconcile.git
synced 2025-01-20 12:27:39 +02:00
[FIX] logger of account.bank.profile that was broken + use mail thread system
This commit is contained in:
@@ -43,7 +43,6 @@ class AccountStatementProfil(Model):
|
|||||||
help="Tic that box to automatically launch the completion "
|
help="Tic that box to automatically launch the completion "
|
||||||
"on each imported file using this profile."),
|
"on each imported file using this profile."),
|
||||||
'last_import_date': fields.datetime("Last Import Date"),
|
'last_import_date': fields.datetime("Last Import Date"),
|
||||||
'rec_log': fields.text('log', readonly=True),
|
|
||||||
'import_type': fields.selection(
|
'import_type': fields.selection(
|
||||||
get_import_type_selection,
|
get_import_type_selection,
|
||||||
'Type of import',
|
'Type of import',
|
||||||
@@ -55,27 +54,15 @@ class AccountStatementProfil(Model):
|
|||||||
|
|
||||||
def write_logs_after_import(self, cr, uid, ids, statement_id, num_lines, context):
|
def write_logs_after_import(self, cr, uid, ids, statement_id, num_lines, context):
|
||||||
"""
|
"""
|
||||||
Write the log in the logger + in the log field of the profile to report the user about
|
Write the log in the logger
|
||||||
what has been done.
|
|
||||||
|
|
||||||
:param int/long statement_id: ID of the concerned account.bank.statement
|
:param int/long statement_id: ID of the concerned account.bank.statement
|
||||||
:param int/long num_lines: Number of line that have been parsed
|
:param int/long num_lines: Number of line that have been parsed
|
||||||
:return: True
|
:return: True
|
||||||
"""
|
"""
|
||||||
if isinstance(ids, (int, long)):
|
self.message_post(cr,
|
||||||
ids = [ids]
|
|
||||||
for id in ids:
|
|
||||||
log = self.read(cr, uid, id, ['rec_log'], context=context)['rec_log']
|
|
||||||
log_line = log and log.split("\n") or []
|
|
||||||
import_date = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
|
|
||||||
log_line[0:0] = [import_date + ' : '
|
|
||||||
+ _("Bank Statement ID %s have been imported with %s lines ") % (statement_id, num_lines)]
|
|
||||||
log = "\n".join(log_line)
|
|
||||||
self.write(cr, uid, id, {'rec_log': log, 'last_import_date': import_date}, context=context)
|
|
||||||
self.message_post(
|
|
||||||
cr,
|
|
||||||
uid,
|
uid,
|
||||||
[statement_id],
|
ids,
|
||||||
body=_('Statement ID %s have been imported with %s lines.') % (statement_id, num_lines),
|
body=_('Statement ID %s have been imported with %s lines.') % (statement_id, num_lines),
|
||||||
context=context)
|
context=context)
|
||||||
return True
|
return True
|
||||||
|
|||||||
@@ -19,7 +19,6 @@
|
|||||||
type="action" icon="gtk-ok"
|
type="action" icon="gtk-ok"
|
||||||
colspan = "2"/>
|
colspan = "2"/>
|
||||||
<separator colspan="4" string="Import Logs"/>
|
<separator colspan="4" string="Import Logs"/>
|
||||||
<field name="rec_log" colspan="4" nolabel="1"/>
|
|
||||||
</field>
|
</field>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|||||||
@@ -31,6 +31,8 @@ class AccountStatementProfil(Model):
|
|||||||
journal to use, the partner and commision account and so on.
|
journal to use, the partner and commision account and so on.
|
||||||
"""
|
"""
|
||||||
_name = "account.statement.profile"
|
_name = "account.statement.profile"
|
||||||
|
_inherit = ['mail.thread']
|
||||||
|
|
||||||
_description = "Statement Profil"
|
_description = "Statement Profil"
|
||||||
|
|
||||||
_columns = {
|
_columns = {
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
<field name="force_partner_on_bank"/>
|
<field name="force_partner_on_bank"/>
|
||||||
<field name="balance_check"/>
|
<field name="balance_check"/>
|
||||||
<field name="bank_statement_prefix"/>
|
<field name="bank_statement_prefix"/>
|
||||||
|
<field name="message_ids" widget="mail_thread" placeholder="Share a note..." colspan="4"/>
|
||||||
</form>
|
</form>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|||||||
Reference in New Issue
Block a user