Skip to content
Snippets Groups Projects
Commit 6c4a92f5 authored by Nishant Jain (niai)'s avatar Nishant Jain (niai)
Browse files

[IMP] l10n_in: audit trail improvement


With this commit, Made the tree line clickable instead of clicking View Related
Document Button. Updated the description, to be similar to chatter in audit trail
tree view. Also Updated error message while deleting entries once it's posted for
Indian Company.

closes odoo/odoo#121242

Signed-off-by: default avatarWilliam André (wan) <wan@odoo.com>
parent e4127e6c
Branches
Tags
No related merge requests found
......@@ -107,7 +107,7 @@ class AccountMove(models.Model):
def _unlink_l10n_in_except_once_post(self):
# Prevent deleting entries once it's posted for Indian Company only
if any(m.country_code == 'IN' and m.posted_before for m in self) and not self._context.get('force_delete'):
raise UserError(_("To keep the audit trail, you can not delete journal entries once they have been posted"))
raise UserError(_("To keep the audit trail, you can not delete journal entries once they have been posted.\nInstead, you can cancel the journal entry."))
def unlink(self):
# Add logger here becouse in api ondelete account.move.line is deleted and we can't get total amount
......
......@@ -24,8 +24,14 @@ class Message(models.Model):
title = message.subtype_id.display_name
audit_log_preview = Markup("<div>%s</div>") % (title)
for value in tracking_value_ids:
audit_log_preview += Markup("<li>%s <i class='o_TrackingValue_separator fa fa-long-arrow-rightmx-1 text-600' title='%s' role='img' aria-label='%s'></i>%s (%s)</li>") % (
_("Changed"), _("Changed"), value._get_old_display_value()[0], value._get_new_display_value()[0], value.field.field_description)
audit_log_preview += Markup(
"<li>%(old_value)s <i class='o_TrackingValue_separator fa fa-long-arrow-right mx-1 text-600' title='%(title)s' role='img' aria-label='%(title)s'></i>%(new_value)s (%(field)s)</li>"
) % {
'old_value': value._get_old_display_value()[0] or _("None"),
'new_value': value._get_new_display_value()[0] or _("None"),
'title': _("Changed"),
'field': value.field.field_description,
}
message.l10n_in_audit_log_preview = audit_log_preview
@api.depends('model', 'res_id')
......
......@@ -6,13 +6,12 @@
<field name="model">mail.message</field>
<field name="priority">99</field>
<field name="arch" type="xml">
<tree edit="0" delete="0" create="0">
<tree edit="0" delete="0" create="0" action="action_open_document" type="object">
<field name="res_id" invisible="1"/>
<field name="date"/>
<field name="author_id" widget="many2one_avatar"/>
<field name="l10n_in_audit_log_account_move_id"/>
<field name="l10n_in_audit_log_preview"/>
<button name="action_open_document" type="object" icon="fa-arrow-right" string="View Related Document" attrs="{'invisible': [('res_id', 'in', (0, False, ''))]}" />
</tree>
</field>
</record>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment