From e98e7d762bc3a9399dcffaf61359e51d39f36450 Mon Sep 17 00:00:00 2001 From: Yannick Tivisse Date: Tue, 8 Feb 2022 09:35:11 +0000 Subject: [PATCH] [IMP] note: Allow company specific notes Purpose ======= Allow to restrict note to users having access to a specific company For example, when creating a new company, it create a "Useful Links" note that is used on the payroll dashboard (With granted access to payroll officers who belongs to this company). This note should be restricted to people having access to the company, and shouldn't be mixed all the time for people having multi company accesses. closes odoo/odoo#84155 Related: odoo/enterprise#24128 Signed-off-by: Yannick Tivisse (yti) --- addons/note/models/note.py | 1 + addons/note/security/note_security.xml | 6 ++++++ addons/note/views/note_views.xml | 3 ++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/addons/note/models/note.py b/addons/note/models/note.py index 3d63afb75b8..c668e1503ff 100644 --- a/addons/note/models/note.py +++ b/addons/note/models/note.py @@ -42,6 +42,7 @@ class Note(models.Model): name = fields.Text( compute='_compute_name', string='Note Summary', store=True, readonly=False) + company_id = fields.Many2one('res.company') user_id = fields.Many2one('res.users', string='Owner', default=lambda self: self.env.uid) memo = fields.Html('Note Content') sequence = fields.Integer('Sequence') diff --git a/addons/note/security/note_security.xml b/addons/note/security/note_security.xml index 3b657e48633..730c9f9d55b 100644 --- a/addons/note/security/note_security.xml +++ b/addons/note/security/note_security.xml @@ -1,5 +1,11 @@ + + Note - Multi-Company + + ['|', ('company_id', '=', False), ('company_id', 'in', company_ids)] + + Only followers can access a sticky notes diff --git a/addons/note/views/note_views.xml b/addons/note/views/note_views.xml index a17827c804c..e614a37d454 100644 --- a/addons/note/views/note_views.xml +++ b/addons/note/views/note_views.xml @@ -170,10 +170,11 @@
+
- +