Help

0

Rendering tags field invisible

Avatar
Hummingbiz

My customer has requested that I make the tags field (tags_id) invisible.  The customer is using the CRM module in an Odoo Version 13 Enterprise installation.

I have extended views for several other modifications requested by this customer, but I have not been able to render the tags field invisible.  I believe this may have to do with the fact tht this is a many2many field.

Here are some of the things I have tried in my extended view:

<xpath expr="//field[@name='tag_ids']" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>


<xpath expr="//field[@name='tag_ids']" position="replace">
<field name="tag_ids" widget="many2many_tags" options="{'color_field': 'color', 'no_create_edit': True}" invisible="1"/>
</xpath>

<xpath expr="//field[@name='tag_ids']" position="replace">
<field name="tag_ids" invisible="1"/>
</xpath>

<xpath expr="//field[@name='tag_ids']" position="replace"/>

Avatar
Negeren
1 Antwoord
0
Avatar
Jack Dane
Beste antwoord

Hello HummingBiz,

I have tried to do make the field invisible on the CRM record using the exact same method in your first approach and it seems to work without a problem. 

Code:

<?xml version="1.0"?>
<xpath expr="//field[@name='tag_ids']" position="attributes">
  <attribute name="invisible">1</attribute>
</xpath>

Here is an image of my view

It could be that another field is inheriting and somehow setting the field back to visible after your view, so you could increase the Sequence to be after all inherited view. To make sure that your invisible attribute is being added at the end. 

If you are installing via an external app, make sure to update your app when you make these changes (I forget all the time).

But other than that I am unsure what would be causing your error, I really don't think it is the code you have written. So it would be better to look elsewhere. 

Thanks, 

1 Opmerking
Avatar
Negeren
Avatar
Hummingbiz
-

Per your advice, I sought a solution in how the field was being located, rather than the mechanics of rendering the field invisible. I was able to identify the two groups in which the tags_id field appeared in the parent form (crm_lead_view_form) like this:

<xpath expr="//group/group[4]/field[@name='tag_ids']" position="attributes">

<attribute name="invisible">1</attribute>

</xpath>

<xpath expr="//group/group[6]/field[@name='tag_ids']" position="attributes">

<attribute name="invisible">1</attribute>

</xpath>

Thanks for your help, which pointed me in the right direction.