Technical mailing list archives

technical@mail.odoo.com

Avatar

Re: Disable C/U/D | Allow Chatter

by
OpusVL, Nick Booker
- 28/06/2018 09:50:16
Yes try Christian's idea before mine it looks cleaner.

Thanks Christian, I hadn't thought of that.

On 28/06/18 13:35, Christian Zöllner wrote:
> Hi,
> 
> look into check_access_rule() on model mail.message (Odoo V10). The 
> magic happens there.
> 
> Best Regards
> Christian
> 
> ------------------------------------------------------------------------
> *Von: *"Nick Booker" <nick.booker@opusvl.com>
> *An: *"Technical" <technical@mail.odoo.com>
> *Gesendet: *Donnerstag, 28. Juni 2018 12:01:34
> *Betreff: *Re: Disable C/U/D | Allow Chatter
> 
> On 27/06/18 19:47, Arlosyst wrote: > Hi Community, > > Is it possible to take away the 
> Create/Update/Delete operation rights > for an object, but, still allow 
> them to add messages to the FORM via > CHATTER(messaging) on the same 
> object?
> 
> I'm assuming you're developing a module so you may need to adjust the
> below suggestions if you want to attempt to do it via configuration.
> 
> Thinking off the top of my head this might work.
> 
> If you can, use ir.model.access and/or ir.rule to set up the permissions
> so users of the relevant group can only read and write.
> 
> See here: https://www.odoo.com/documentation/10.0/reference/security.html
> 
> You might be able to use the "Field Access" feature mentioned in the
> above link to achieve what you want (by setting group to be the name of
> the group that doesn't have this restriction on all of the fields but
> the ones inherited from mail.thread).  I've never tried that feature so
> I'd be interested how well it works.
> 
> However depending on the number of fields in your model it might be
> easier to override write() on your model, and check the user's group
> membership and that the only fields in the passed in data dict are the
> subset of mail.thread fields necessary to write to the chatter (some
> trial and error may be needed).  Raise an AccessError when you want to
> block it, otherwise return super(MyModel, self).write(data).
> 
> Remember to allow self.env.user.id == odoo.SUPERUSER_ID to bypass the
> whole check unless you have specific requirements around that, to match
> Odoo's convention of allowing uid=1 to do anything at the model layer,
> unless you have specific requirements around that and an alternative
> escape hatch.
> -- Nick Booker OpusVL
> 
> _______________________________________________
> Mailing-List: https://www.odoo.com/groups/technical-62
> Post to: mailto:technical@mail.odoo.com
> Unsubscribe: https://www.odoo.com/groups?unsubscribe
> 
> 
> 
> -- 
> Christian Zöllner
> E-Mail: c.zoellner@intero-technologies.de
> 
> Intero Technologies GmbH
> Heinrich-Heine-Ring 76
> D - 18435 Stralsund
> Tel:  +49 (0) 3831 – 44 55 7 - 0
> Fax:  +49 (0) 3831 – 44 55 7 - 79
> 
> Internet: www.intero-technologies.de
> 
> Intero Technologies GmbH • Firmensitz: Heinrich-Heine-Ring 76, 18435 
> Stralsund , Deutschland • Registergericht: Amtsgericht Stralsund, HRB 
> 7076 • Geschäftsführer: Frank Löffler, Lars Lifson • USt-Ident.Nr. DE 
> 251251697
> 
> This eMail and its content is dedicated to the intended recipient only. 
> If you have received it in error please contact the sender immediately 
> by fax or return eMail. Please then delete the eMail and any copies of it.
> 
> _______________________________________________
> Mailing-List: https://www.odoo.com/groups/technical-62
> Post to: mailto:technical@mail.odoo.com
> Unsubscribe: https://www.odoo.com/groups?unsubscribe
> 


-- 
Nick Booker
OpusVL

Reference