Technical أرشيف القائمة البريدية

technical@mail.odoo.com

الصورة الرمزية

Re: Disable C/U/D | Allow Chatter

بواسطة
OpusVL, Nick Booker
- 28 يونيو, 2018 05:58:59
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

المرجع