+# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
+
+from odoo import models
+
+
+class Users(models.Model):
+ _name = 'res.users'
+ _inherit = ['res.users']
+
+ def __init__(self, pool, cr):
+ """ Override of __init__ to add access rights.
+
+ Access rights are disabled by default, but allowed
+ on some specific fields defined in self.SELF_{READ/WRITE}ABLE_FIELDS.
+
+ [copied from mail.models.users]
+ """
+ super(Users, self).__init__(pool, cr)
+ # duplicate list to avoid modifying the original reference
+ type(self).SELF_WRITEABLE_FIELDS = list(self.SELF_WRITEABLE_FIELDS)
+ type(self).SELF_WRITEABLE_FIELDS.extend(['notify_frequency'])
+ type(self).SELF_WRITEABLE_FIELDS.extend(['notify_conf_ids'])
+ # duplicate list to avoid modifying the original reference
+ type(self).SELF_READABLE_FIELDS = list(self.SELF_READABLE_FIELDS)
+ type(self).SELF_READABLE_FIELDS.extend(['notify_frequency'])
+ type(self).SELF_READABLE_FIELDS.extend(['notify_conf_ids'])
diff --git a/mail_digest/security/ir.model.access.csv b/mail_digest/security/ir.model.access.csv
index 43892a41..1814f390 100644
--- a/mail_digest/security/ir.model.access.csv
+++ b/mail_digest/security/ir.model.access.csv
@@ -1,5 +1,4 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
-access_mail_digest_all,mail.digest.all,model_mail_digest,,1,0,0,0
-access_partner_notification_conf_all,partner.notification.all,model_partner_notification_conf,,1,0,0,0
-access_mail_digest_system,mail.digest.all,model_mail_digest,base.group_system,1,1,1,1
-access_partner_notification_conf_system,partner.notification.all,model_partner_notification_conf,base.group_system,1,1,1,1
+access_partner_notification_conf_user,partner.notification.user,model_partner_notification_conf,base.group_user,1,1,1,1
+access_mail_digest_system,mail.digest.sys,model_mail_digest,base.group_system,1,1,1,1
+access_partner_notification_conf_system,partner.notification.sys,model_partner_notification_conf,base.group_system,1,1,1,1
diff --git a/mail_digest/security/record_rules.xml b/mail_digest/security/record_rules.xml
new file mode 100644
index 00000000..b1594eef
--- /dev/null
+++ b/mail_digest/security/record_rules.xml
@@ -0,0 +1,14 @@
+
+
+
+
+ Partners can edit their own notification settings
+
+
+
+
+
+ ['|',('partner_id', '=', user.partner_id.id), ('create_uid', '=', user.id)]
+
+
+
diff --git a/mail_digest/templates/digest_default.xml b/mail_digest/templates/digest_default.xml
index 38e9eda9..6c98e4b8 100644
--- a/mail_digest/templates/digest_default.xml
+++ b/mail_digest/templates/digest_default.xml
@@ -4,12 +4,8 @@
-
-