Skip to Content
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odgovori
6217 Prikazi

I am trying to hide fields in my order.lines view based on a sale.order field. My xpath code doesn't work:

Note: Sale order field = x_studio_sales_type and Order line field = x_studio_florist_notes

<xpath expr="//form[1]/sheet[1]/notebook[1]/page[@name='order_lines']/field[@name='order_line']/tree[1]/field[@name='name']" position="after">
<field name="x_studio_florist_notes" attrs="{'invisible':[//field[@name='x_studio_sales_type'], '=', 'Events']}"/>
</xpath>

Is there any way to achieve this?


Avatar
Opusti
Best Answer

Hi Linda:

The syntax of the condition for invisible needs to be fixed. Try this

<xpath expr="//form[1]/sheet[1]/notebook[1]/page[@name='order_lines']/field[@name='order_line']/tree[1]/field[@name='name']" position="after">
<field name="x_studio_florist_notes" attrs="{'invisible':[('x_studio_sales_type', '=', 'Events')]}"/>
</xpath>
Avatar
Opusti
Avtor

Thanks for the response, I did try this syntax to begin with but it didn't work either.

Error while validating constraint

unexpected EOF while parsing

('', 1, 54, "{'invisible': [('x_studio_sales_type', '=', 'Events')]")

Please post the name of the view you are trying to customize

Avtor

I'm trying to edit sale.view_order_line_tree using fields from sale.view_order_form

Tried it on sale.view_order_form and it works fine here. Can you post a screenshot of your view customization ?

Avtor

Not enough karma to post images on the forum. But you can find my form here https://ibb.co/6bkmXBy

The following syntax for the <field...../> part may be more appropriate in your situation.

<field name="x_studio_florist_notes" attrs="{'column_invisible':[('parent.x_studio_sales_type', '=', 'Events')]}"/>

The difference being that with "invisible", it will always display the column but hide/display the value in the column conditionally. With the second syntax, it will hide/display the whole column based on the condition. Since it looks like your custom field is defined at the Sales Order level, you need to use the "parent." to reference x_studio_sales_type.

Hope this helps.

Avtor

Thanks so much for helping me Paresh, using the above worked! Also for explaining the differences between the two "invisible" and "column_invisible".

Related Posts Odgovori Prikazi Aktivnost
0
apr. 20
3550
1
okt. 16
6425
1
feb. 25
2436
3
dec. 24
1989
2
mar. 24
2237