From 66defee3ea84145039d202ec6aeeede54884cca8 Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Mon, 3 Aug 2020 11:41:06 +0200 Subject: [PATCH] :bug: Display the invalidity reason of an invalid transaction even if we can't validate it --- apps/note/tables.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/apps/note/tables.py b/apps/note/tables.py index 0048a0a5..505e8dfa 100644 --- a/apps/note/tables.py +++ b/apps/note/tables.py @@ -68,12 +68,8 @@ class HistoryTable(tables.Table): "note.change_transaction_invalidity_reason", record) else None, "onmouseover": lambda record: '$("#invalidity_reason_' + str(record.id) + '").show();$("#invalidity_reason_' - + str(record.id) + '").focus();' - if PermissionBackend.check_perm(get_current_authenticated_user(), - "note.change_transaction_invalidity_reason", record) else None, - "onmouseout": lambda record: '$("#invalidity_reason_' + str(record.id) + '").hide()' - if PermissionBackend.check_perm(get_current_authenticated_user(), - "note.change_transaction_invalidity_reason", record) else None, + + str(record.id) + '").focus();', + "onmouseout": lambda record: '$("#invalidity_reason_' + str(record.id) + '").hide()', } } ) @@ -101,15 +97,18 @@ class HistoryTable(tables.Table): """ When the validation status is hovered, an input field is displayed to let the user specify an invalidity reason """ + has_perm = PermissionBackend\ + .check_perm(get_current_authenticated_user(), "note.change_transaction_invalidity_reason", record) + val = "✔" if value else "✖" - if not PermissionBackend\ - .check_perm(get_current_authenticated_user(), "note.change_transaction_invalidity_reason", record): + + if value and not has_perm: return val val += "" return format_html(val)