I want to grant a user the create right on model crm.claim, but I don't want him to duplicate his claim. So on the more options tab, I want to hide "Duplicate", when the user is on the form view.
I know there is a relationship between the acess rights, and the options displayed on the More options selection, so, I'm trying to grant the create right without the duplicate right. How can I do it ?
With only access rights, it is not possible to hide "Duplicate" button in more. Instead you could try to raise an error when the user containing a particular group does duplicate.
def copy(self, cr, uid, id, default=None, context=None):
if self.pool.get('res.users').has_group(cr, uid, 'MODULE_NAME.YOUR CUSTOM GROUP ID'): # e.g. base.group_sale_manager
raise orm.except_orm('Error', 'You cannot duplicate this record')
return super(crm_claim, self).copy(cr, uid, id, default, context=context)
Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!
About This Community
|Asked: 4/3/15, 6:08 AM|
|Seen: 851 times|
|Last updated: 4/3/15, 6:26 AM|