Browse Source

[RFR] Change log_custom to log_custom_method as suggested in PR

pull/1049/head
Eric Lembregts 7 years ago
committed by Holger Brunn
parent
commit
85ab38ef4f
  1. 6
      auditlog/models/rule.py
  2. 2
      auditlog/tests/test_auditlog.py
  3. 8
      auditlog/views/auditlog_view.xml

6
auditlog/models/rule.py

@ -72,7 +72,7 @@ class AuditlogRule(models.Model):
u"Log Creates", default=True,
help=(u"Select this if you want to keep track of creation on any "
u"record of the model of this rule"))
log_custom = fields.Boolean(
log_custom_method = fields.Boolean(
u"Log Methods",
help=(u"Select this if you want to keep track of custom methods on "
u"any record of the model of this rule"))
@ -162,7 +162,7 @@ class AuditlogRule(models.Model):
updated = True
# Check if custom methods are enabled and patch the different
# rule methods
if getattr(rule, 'log_custom'):
if getattr(rule, 'log_custom_method'):
for custom_method in rule.custom_method_ids:
check_attr = 'auditlog_ruled_%s' % custom_method.name
@ -196,7 +196,7 @@ class AuditlogRule(models.Model):
getattr(model_model, method), 'origin'):
model_model._revert_method(method)
updated = True
if hasattr(rule, 'log_custom'):
if hasattr(rule, 'log_custom_method'):
for custom_method in rule.custom_method_ids:
method = custom_method.name
if hasattr(getattr(model_model, method), 'origin'):

2
auditlog/tests/test_auditlog.py

@ -140,7 +140,7 @@ class TestMethods(TransactionCase):
'log_create': False,
'log_write': False,
'log_unlink': False,
'log_custom': True,
'log_custom_method': True,
'custom_method_ids': [(0, 0, {
'name': 'copy',
'message': 'execute_copy',

8
auditlog/views/auditlog_view.xml

@ -34,14 +34,14 @@
<field name="log_write"/>
<field name="log_unlink"/>
<field name="log_create"/>
<field name="log_custom"/>
<field name="log_custom_method"/>
<!--<field name="log_action"/>-->
<!--<field name="log_workflow"/>-->
</group>
</group>
<group string="Custom Methods" attrs="{'invisible': [('log_custom', '=', False)]}">
<group string="Custom Methods" attrs="{'invisible': [('log_custom_method', '=', False)]}">
<group colspan="2">
<div attrs="{'invisible': [('log_custom', '=', False)]}" colspan="2">
<div attrs="{'invisible': [('log_custom_method', '=', False)]}" colspan="2">
You can only edit custom methods when the rule is unsubscribed.
</div>
<field name="custom_method_ids" nolabel="1" attrs="{'readonly': [('state', '=', 'subscribed')]}" colspan="2">
@ -76,7 +76,7 @@
<field name="log_write"/>
<field name="log_unlink"/>
<field name="log_create"/>
<field name="log_custom"/>
<field name="log_custom_method"/>
<!--<field name="log_action"/>-->
<!--<field name="log_workflow"/>-->
<field name="state"/>

Loading…
Cancel
Save