Browse Source

[IMP] auditlog: set all fields readonly when the rule is enabled

pull/1556/head
sebalix 5 years ago
parent
commit
c6a30604b8
  1. 28
      auditlog/models/rule.py

28
auditlog/models/rule.py

@ -44,32 +44,40 @@ class AuditlogRule(models.Model):
_name = 'auditlog.rule'
_description = "Auditlog - Rule"
name = fields.Char("Name", size=32, required=True)
name = fields.Char(
"Name", required=True,
states={'subscribed': [('readonly', True)]})
model_id = fields.Many2one(
'ir.model', "Model", required=True,
help="Select model for which you want to generate log.")
help="Select model for which you want to generate log.",
states={'subscribed': [('readonly', True)]})
user_ids = fields.Many2many(
'res.users',
'audittail_rules_users',
'user_id', 'rule_id',
string="Users",
help="if User is not added then it will applicable for all users")
help="if User is not added then it will applicable for all users",
states={'subscribed': [('readonly', True)]})
log_read = fields.Boolean(
"Log Reads",
help=("Select this if you want to keep track of read/open on any "
"record of the model of this rule"))
"record of the model of this rule"),
states={'subscribed': [('readonly', True)]})
log_write = fields.Boolean(
"Log Writes", default=True,
help=("Select this if you want to keep track of modification on any "
"record of the model of this rule"))
"record of the model of this rule"),
states={'subscribed': [('readonly', True)]})
log_unlink = fields.Boolean(
"Log Deletes", default=True,
help=("Select this if you want to keep track of deletion on any "
"record of the model of this rule"))
"record of the model of this rule"),
states={'subscribed': [('readonly', True)]})
log_create = fields.Boolean(
"Log Creates", default=True,
help=("Select this if you want to keep track of creation on any "
"record of the model of this rule"))
"record of the model of this rule"),
states={'subscribed': [('readonly', True)]})
log_type = fields.Selection(
[('full', "Full log"),
('fast', "Fast log"),
@ -79,7 +87,8 @@ class AuditlogRule(models.Model):
"the operation (log more info like computed fields which were "
"updated, but it is slower)\n"
"Fast log: only log the changes made through the create and "
"write operations (less information, but it is faster)"))
"write operations (less information, but it is faster)"),
states={'subscribed': [('readonly', True)]})
# log_action = fields.Boolean(
# "Log Action",
# help=("Select this if you want to keep track of actions on the "
@ -92,7 +101,8 @@ class AuditlogRule(models.Model):
[('draft', "Draft"), ('subscribed', "Subscribed")],
string="State", required=True, default='draft')
action_id = fields.Many2one(
'ir.actions.act_window', string="Action")
'ir.actions.act_window', string="Action",
states={'subscribed': [('readonly', True)]})
_sql_constraints = [
('model_uniq', 'unique(model_id)',

Loading…
Cancel
Save