From 1651786340a16ced7cfecb227f82e51fb4ed576e Mon Sep 17 00:00:00 2001 From: Yannick Tivisse Date: Thu, 17 Aug 2017 11:16:21 +0200 Subject: [PATCH] [FIX] mail: Allow to recompute the res_model on a mail.follower after creation Purpose ======= Currently an employee can - Create mail.followers - Write on mail.follower if it is related to his own partner When creating a record with followers (example: An expense sheet), the followers are created but the function fields are recomputed and stored on the table (if store=True). In that particular case (Create: ok, Write: ko), this recomputation will trigger a write and then an access right error with a transaction rollback. Specification ============= Adding the `compute_sudo=True` attribute on the `res_model` field, the recomputation will be allowed for users at the record creation. This fix doesn't imply to update the modules. --- addons/mail/models/mail_followers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/mail/models/mail_followers.py b/addons/mail/models/mail_followers.py index ce169c91127..062bf46428f 100644 --- a/addons/mail/models/mail_followers.py +++ b/addons/mail/models/mail_followers.py @@ -23,7 +23,7 @@ class Followers(models.Model): index=True, required=True, ondelete='cascade', help='Model of the followed resource') res_model = fields.Char( - 'Related Document Model Name', index=True, readonly=True, related='res_model_id.model', store=True) + 'Related Document Model Name', index=True, readonly=True, related='res_model_id.model', compute_sudo=True, store=True) res_id = fields.Integer( 'Related Document ID', index=True, help='Id of the followed resource') partner_id = fields.Many2one(