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..
Stwórz konto dzisiaj, aby cieszyć się ekskluzywnymi funkcjami i wchodzić w interakcje z naszą wspaniałą społecznością!
Zarejestruj sięPowiązane posty | Odpowiedzi | Widoki | Czynność | |
---|---|---|---|---|
|
1
gru 24
|
6053 | ||
|
3
sie 24
|
6903 | ||
how to know the odoo master password?
Rozwiązane
|
|
4
lip 24
|
41219 | |
Default value in form view
Rozwiązane
|
|
5
kwi 23
|
98994 | |
|
3
lis 22
|
4332 |