Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
9003 Widoki

Hello everybody,

I want to replace a field in a XML record, but obviously, what I tried doesn't seem to be the good way to do it ... here's my record:


<record model="ir.actions.act_window" id="open_allocation_holidays">

<field name="name">Allocation Requests</field>

<field name="res_model">hr.holidays</field>

<field name="view_type">form</field>

<field name="context">{'default_type':'add', 'search_default_my_leaves':1}</field>

<field name="domain">[('type','=','add')]</field>

<field name="view_id" ref="allocation_leave_new"/>

<field name="search_view_id" ref="view_hr_holidays_filter"/>

</record>


What I want is to replace the field to add a default filter.

<field name="context">{'default_type':'add', 'search_default_my_leaves':1}</field>

with:

<field name="context">{'default_type':'add', 'search_default_my_leaves':1, 'search_default_my_validations':1}</field>


I already tried xpath with position="attributes" and position="replace,

<xpath expr="//record[@id='open_allocation_holidays' ]" position="attributes"> <attribute name="context"> {default type ...}</attribute></xpath>, I tried to search with the field name too (expr="//field[@name='context']") but nothing works.
Is there an other way to replace my field ?


Awatar
Odrzuć
Najlepsza odpowiedź

Hello, 

This is an action so you just need to use same id and write it again the same action.

This is the simple way to use and add in existing action.

Ex.

<record model="ir.actions.act_window" id="module_name.open_allocation_holidays">

<field name="name">Allocation Requests</field>

<field name="res_model">hr.holidays</field>

<field name="view_type">form</field>

<field name="context">{'default_type':'add', 'search_default_my_leaves':1, 'search_default_my_validations':1}</field>

<field name="domain">[('type','=','add')]</field>

<field name="view_id" ref="allocation_leave_new"/>

<field name="search_view_id" ref="view_hr_holidays_filter"/>

</record>


Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
1
maj 19
4938
1
mar 15
7297
1
mar 15
6555
0
kwi 16
3749
0
mar 15
4742