-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathentitlement_inkind_cel_views.xml
More file actions
128 lines (122 loc) · 4.99 KB
/
entitlement_inkind_cel_views.xml
File metadata and controls
128 lines (122 loc) · 4.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<!-- Extend In-Kind Entitlement Item Form (inline form within manager) -->
<record id="view_inkind_entitlement_item_cel_form" model="ir.ui.view">
<field name="name">spp.program.entitlement.manager.inkind.item.cel.form</field>
<field name="model">spp.program.entitlement.manager.inkind</field>
<field
name="inherit_id"
ref="spp_programs.view_entitlement_manager_inkind_form"
/>
<field name="arch" type="xml">
<!-- Add quantity mode selection to inline form -->
<xpath
expr="//field[@name='entitlement_item_ids']/form//field[@name='quantity']"
position="before"
>
<field
name="quantity_mode"
widget="radio"
options="{'horizontal': true}"
/>
</xpath>
<!-- Make quantity field conditional -->
<xpath
expr="//field[@name='entitlement_item_ids']/form//field[@name='quantity']"
position="attributes"
>
<attribute name="invisible">quantity_mode == 'cel'</attribute>
</xpath>
<!-- Add CEL quantity formula after quantity -->
<xpath
expr="//field[@name='entitlement_item_ids']/form//field[@name='quantity']"
position="after"
>
<field
name="quantity_cel_expression"
widget="cel_expression"
cel_profile="registry_groups"
show_symbol_browser="true"
show_validation_count="false"
invisible="quantity_mode != 'cel'"
placeholder="e.g., hh_size * 2"
/>
<div
invisible="quantity_mode != 'cel' or not quantity_cel_expression"
class="small"
>
<field
name="quantity_cel_preview"
invisible="not quantity_cel_preview"
class="text-success"
/>
<field
name="quantity_cel_error"
invisible="not quantity_cel_error"
class="text-danger"
/>
</div>
<field name="quantity_cel_is_valid" invisible="1" />
</xpath>
<!-- Add condition mode selection -->
<xpath
expr="//field[@name='entitlement_item_ids']/form//field[@name='condition']"
position="before"
>
<field
name="condition_mode"
nolabel="1"
widget="radio"
options="{'horizontal': true}"
/>
</xpath>
<!-- Make condition field conditional -->
<xpath
expr="//field[@name='entitlement_item_ids']/form//field[@name='condition']"
position="attributes"
>
<attribute name="invisible">condition_mode == 'cel'</attribute>
</xpath>
<!-- Add CEL condition expression after condition -->
<xpath
expr="//field[@name='entitlement_item_ids']/form//field[@name='condition']"
position="after"
>
<field
name="condition_cel_expression"
nolabel="1"
widget="cel_expression"
cel_profile="registry_groups"
show_symbol_browser="true"
show_validation_count="true"
invisible="condition_mode != 'cel'"
placeholder="e.g., hh_size >= 4 and child_count > 0"
/>
</xpath>
</field>
</record>
<!-- Extend In-Kind Entitlement Item List in Manager -->
<record id="view_inkind_entitlement_manager_cel_form" model="ir.ui.view">
<field name="name">spp.program.entitlement.manager.inkind.cel.form</field>
<field name="model">spp.program.entitlement.manager.inkind</field>
<field
name="inherit_id"
ref="spp_programs.view_entitlement_manager_inkind_form"
/>
<field name="arch" type="xml">
<!-- Update the tree view inside the form to show quantity and condition modes -->
<xpath
expr="//field[@name='entitlement_item_ids']/list/field[@name='quantity']"
position="before"
>
<field name="quantity_mode" optional="show" />
</xpath>
<xpath
expr="//field[@name='entitlement_item_ids']/list/field[@name='multiplier_field']"
position="before"
>
<field name="condition_mode" optional="hide" />
</xpath>
</field>
</record>
</odoo>