I have created one field in my module and i dont want other user write ,create and edit .
How to acheive this
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
I have created one field in my module and i dont want other user write ,create and edit .
How to acheive this
Try like this it may help you,
Add an extra field in the view, ie,
in Xml,
<field name="check_field" invisible="1" />
<field name="new_field" attrs="{'readonly': [('check_field', '!=', True)]}" />
in py,
check_field = fields.Boolean('Check', compute='get_user')
@api.multi
@api.depends('new_field')
def get_user(self):
if SUPERUSER_ID == self._uid:
self.check_user = True
else:
self.check_user = False
Write two views for this model.One for the administrative user and other for the read only group.
Find administrative id from res_users model, after
<field name="name_field" attrs="{'readonly': [('<user_id>', '!=', <administrative id>)]}" />
<field name="name_field" attrs="{'readonly': [('<user_id>', '!=', 1)]}" />
it will help you..
Create an account today to enjoy exclusive features and engage with our awesome community!
RegistracijaRelated Posts | Replies | Rodiniai | Veikla | |
---|---|---|---|---|
|
1
gruod. 24
|
6049 | ||
|
3
rugp. 24
|
6902 | ||
|
4
liep. 24
|
41213 | ||
Default value in form view
Solved
|
|
5
bal. 23
|
98978 | |
|
3
lapkr. 22
|
4328 |