[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.
This commit is contained in:
Yannick Tivisse
2017-08-17 11:16:21 +02:00
parent fc1f00a7d0
commit 1651786340
+1 -1
View File
@@ -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(