i want to hide or disable add a properties button, how can i do that.
By the way, I would like to ask how to hide or disable the edit properties field button (pencil icon) and how to require the field when creating the properties field.
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Accounting
- Inventory
- PoS
- Project
- MRP
This question has been flagged
Create a new module or identify the existing module where you want to make the changes.
Inside your module, create a new XML file, let's call it views/assets.xml, and add the following code:
- note: here i remove the XML tag like(< >) because when i edit the tag and save the answer the I didn't see the full code of XML,
so please add the (<>) once you edit the XML file
odoo
data
# Override the field properties view
template id="view_field_property_form_inherit" inherit_id="base.view_field_property_form"
xpath expr="//field[@name='field_id']/form" position="attributes"
#Hide the "Add a Property" button
attribute name="create">0 /xpath
xpath expr="//field[@name='field_id']/form/group/group[1]/field[@name='fields_view_id']/form" position="attributes"
#Disable the "Edit" button
attribute name="options">{'no_edit': True} /xpath
/template
/data
/odoo
In the above code, we override the view_field_property_form template and modify the XML structure using XPath expressions.
- In your module's manifest file (e.g., __manifest__.py), make sure to include the XML file in the data section:
{
'name': 'Your Module',
'version': '1.0',
'summary': 'Module Summary',
'data': [
'views/assets.xml',
],
'installable': True,
'application': True,
'auto_install': False,
}
- Update the module list and restart the Odoo server for the changes to take effect.
After making these changes, the "Add a Property" button will be hidden, and the "Edit" button will be disabled in the field properties form.
Note that this approach overrides the existing field properties view and applies the modifications globally. If you want to apply the changes to specific models or views, you may need to adjust the XPath expressions accordingly.
Additionally, ensure that you have the necessary access rights to modify views and create a custom module in your Odoo installation.
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign upRelated Posts | Replies | Views | Activity | |
---|---|---|---|---|
|
0
Nov 22
|
1664 | ||
Hide chatter in odoo 16
Solved
|
|
1
Nov 24
|
2417 | |
|
1
May 23
|
1805 | ||
|
1
Sep 24
|
1427 | ||
|
1
Feb 23
|
3706 |