Question

I want to give readonly permission to "Contacts" page which is inside res_partner I inherited that view and in my new xml I mentioned grp_partner -> my module name group_readonly_supplier -> I created one group inside that module having only read permission to res_partner

XML code :

< xpath expr="//page[@string='Internal Notes']" position="replace" >
< page string="Internal Notes" 
attrs = "{'readonly':[('groups','=','grp_partner.group_readonly_supplier')]}" >
< /page >
< /xpath >

but whenever I clicked on edit I got blank page Then I tried

< xpath expr="//page[@string='Internal Notes']" position="replace" >
< page string="Internal Notes" 
attrs="{'readonly': [('groups','=','hcapex_partner.group_hcapex_supplier')]}" >
< field name="comment" placeholder="Put an internal note..." 
 attrs="{'readonly': [('groups','=','grp_partner.group_readonly_supplier')]}"/ >                                   
< /page >
< /xpath >

But this will also not able to make readonly that field from that Page.

Please Help me

Thank You in Advance

Was it helpful?

Solution

Try this:

 'field_name': fields.char('Field Name', size=64,write= ['base.group_partner_manager'],read=['base.group_user']),

or this:

Create a functional field in your model which will be true if the user belong to the specified group else false, then add attrs for your field to make it editable if the user belong to the specified group else readonly.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top