Hi,
I have this code below which I want this field to be invisible if the user login is not accounting. I tried res, base but it didn't work.
<field name="account_charge_id" style="width: 30%" attrs="{'invisible':[('????', '!=', 'Accountant')]}"/>
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
Hi,
I have this code below which I want this field to be invisible if the user login is not accounting. I tried res, base but it didn't work.
<field name="account_charge_id" style="width: 30%" attrs="{'invisible':[('????', '!=', 'Accountant')]}"/>
Hi William,
You should use "groups" instead:
<field name="account_charge_id" style="width: 30%" groups="account.group_account_user"/>
Regards,
Ivan
By the way, how to know the groups? where can we find this information "account.group_account_user"? I tried to check this in PostgreSQL DB, there is no much info about it.
You can view the user group ID by enable developer mode, after that go to the group record you wish to know the ID, click the bug icon in the header -> view metadata
You should see it
Thank you.
Dear William,
Adding Group is suggested. Also possible by compute field.
def _compute_field_visibility(self):
# block
field_visibility = fields.Boolean(compute='_compute_field_visibility')
Regards
Global Creative Concepts Tech Co Ltd.
We'll I tried to do this also but I don't know the exact field to be used in order to create a logic that triggers the boolean field.
I tried like this:
if res.group_id.name in ['Accountant', 'Manager', 'Administrator']:
field_visibility = true
else:
field_visibility = false
It had an error because they don't recognize "res".
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign upRelated Posts | Replies | Views | Activity | |
---|---|---|---|---|
|
1
Aug 24
|
260 | ||
|
1
Jul 24
|
555 | ||
|
2
Aug 24
|
2506 | ||
|
1
Sep 24
|
552 | ||
|
1
Jan 24
|
340 |
Get current logged in user id in odoo: https://goo.gl/KzXLak
How to visible and invisible fields in odoo: https://goo.gl/BCxCpk