Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
1 Ответить
3003 Представления

A while ago Sudhir greatly helped with my issue on adding fields to my view without changing the original view (sale.order.form).


With his help I extended the sale order form view with:

<xpath expr="//field[@name='partner_id']" position="after" >
                    <field name="my_field_1" invisible="not context.get('show_custom', False)"/>
                    <field name="my_field_2" invisible="not context.get('show_custom', False)"/>
                </xpath>


The context was defined within the action: context="{'show_custom': True}"

This will change my view without impacting the original ones (i.e. Quotations and/or Sale Orders).

I plan to add much more to my view and I was wondering if I can somehow "globally" change the context.get' i.e. within the <xpath>.

For instance, I tried:


<xpath expr="//field[@name='partner_id']" position="after" invisible="not context.get('show_custom', False)">
                    <field name="my_field_1"/>
                    <field name="my_field_2"/>
                </xpath>


Even though this wont create any errors, it wont work. I was wondering if there is a way to apply the not context.get to all the custom fields inside the xpath, I mean without repeating the code for every individual field.

 





Аватар
Отменить
Лучший ответ

Hello,

    You can mention invisible= "not context.get('show_custom', False)" (attribute) for a <group> or a <page> by creating the group or page inside your xpath, so that you need not use for every field as you mentioned.      


Аватар
Отменить
Related Posts Ответы Просмотры Активность
5
авг. 24
46641
1
июл. 24
2012
2
апр. 24
2551
3
июн. 23
5781
2
июн. 23
4723