콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
1 회신
6269 화면

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?


아바타
취소
베스트 답변

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>
아바타
취소
작성자

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

작성자

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 ?

작성자

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.

작성자

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

관련 게시물 답글 화면 활동
0
4월 20
3562
1
10월 16
6442
1
2월 25
2461
3
12월 24
2061
2
3월 24
2273