Skip to content

Commit 7a7d215

Browse files
committed
fix(spp_programs): use group container for condition section to fix CEL field ordering
1 parent bfc187c commit 7a7d215

2 files changed

Lines changed: 90 additions & 35 deletions

File tree

spp_programs/views/cel/entitlement_inkind_cel_views.xml

Lines changed: 88 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,102 @@
1-
<?xml version="1.0" encoding="utf-8"?>
1+
<?xml version="1.0" encoding="utf-8" ?>
22
<odoo>
33
<!-- Extend In-Kind Entitlement Item Form (inline form within manager) -->
44
<record id="view_inkind_entitlement_item_cel_form" model="ir.ui.view">
55
<field name="name">spp.program.entitlement.manager.inkind.item.cel.form</field>
66
<field name="model">spp.program.entitlement.manager.inkind</field>
7-
<field name="inherit_id" ref="spp_programs.view_entitlement_manager_inkind_form"/>
7+
<field
8+
name="inherit_id"
9+
ref="spp_programs.view_entitlement_manager_inkind_form"
10+
/>
811
<field name="arch" type="xml">
912
<!-- Add quantity mode selection to inline form -->
10-
<xpath expr="//field[@name='entitlement_item_ids']/form//field[@name='quantity']" position="before">
11-
<field name="quantity_mode" widget="radio" options="{'horizontal': true}"/>
13+
<xpath
14+
expr="//field[@name='entitlement_item_ids']/form//field[@name='quantity']"
15+
position="before"
16+
>
17+
<field
18+
name="quantity_mode"
19+
widget="radio"
20+
options="{'horizontal': true}"
21+
/>
1222
</xpath>
1323

1424
<!-- Make quantity field conditional -->
15-
<xpath expr="//field[@name='entitlement_item_ids']/form//field[@name='quantity']" position="attributes">
25+
<xpath
26+
expr="//field[@name='entitlement_item_ids']/form//field[@name='quantity']"
27+
position="attributes"
28+
>
1629
<attribute name="invisible">quantity_mode == 'cel'</attribute>
1730
</xpath>
1831

1932
<!-- Add CEL quantity formula after quantity -->
20-
<xpath expr="//field[@name='entitlement_item_ids']/form//field[@name='quantity']" position="after">
21-
<field name="quantity_cel_expression"
22-
widget="cel_expression"
23-
cel_profile="registry_groups"
24-
show_symbol_browser="true"
25-
show_validation_count="false"
26-
invisible="quantity_mode != 'cel'"
27-
placeholder="e.g., hh_size * 2"/>
28-
<div invisible="quantity_mode != 'cel' or not quantity_cel_expression" class="small">
29-
<field name="quantity_cel_preview" invisible="not quantity_cel_preview" class="text-success"/>
30-
<field name="quantity_cel_error" invisible="not quantity_cel_error" class="text-danger"/>
33+
<xpath
34+
expr="//field[@name='entitlement_item_ids']/form//field[@name='quantity']"
35+
position="after"
36+
>
37+
<field
38+
name="quantity_cel_expression"
39+
widget="cel_expression"
40+
cel_profile="registry_groups"
41+
show_symbol_browser="true"
42+
show_validation_count="false"
43+
invisible="quantity_mode != 'cel'"
44+
placeholder="e.g., hh_size * 2"
45+
/>
46+
<div
47+
invisible="quantity_mode != 'cel' or not quantity_cel_expression"
48+
class="small"
49+
>
50+
<field
51+
name="quantity_cel_preview"
52+
invisible="not quantity_cel_preview"
53+
class="text-success"
54+
/>
55+
<field
56+
name="quantity_cel_error"
57+
invisible="not quantity_cel_error"
58+
class="text-danger"
59+
/>
3160
</div>
32-
<field name="quantity_cel_is_valid" invisible="1"/>
61+
<field name="quantity_cel_is_valid" invisible="1" />
3362
</xpath>
3463

3564
<!-- Add condition mode selection -->
36-
<xpath expr="//field[@name='entitlement_item_ids']/form//field[@name='condition']" position="before">
37-
<field name="condition_mode" widget="radio" options="{'horizontal': true}"/>
65+
<xpath
66+
expr="//field[@name='entitlement_item_ids']/form//field[@name='condition']"
67+
position="before"
68+
>
69+
<field
70+
name="condition_mode"
71+
nolabel="1"
72+
widget="radio"
73+
options="{'horizontal': true}"
74+
/>
3875
</xpath>
3976

4077
<!-- Make condition field conditional -->
41-
<xpath expr="//field[@name='entitlement_item_ids']/form//field[@name='condition']" position="attributes">
78+
<xpath
79+
expr="//field[@name='entitlement_item_ids']/form//field[@name='condition']"
80+
position="attributes"
81+
>
4282
<attribute name="invisible">condition_mode == 'cel'</attribute>
4383
</xpath>
4484

4585
<!-- Add CEL condition expression after condition -->
46-
<xpath expr="//field[@name='entitlement_item_ids']/form//field[@name='condition']" position="after">
47-
<field name="condition_cel_expression"
48-
widget="cel_expression"
49-
cel_profile="registry_groups"
50-
show_symbol_browser="true"
51-
show_validation_count="true"
52-
invisible="condition_mode != 'cel'"
53-
placeholder="e.g., hh_size >= 4 and child_count > 0"/>
86+
<xpath
87+
expr="//field[@name='entitlement_item_ids']/form//field[@name='condition']"
88+
position="after"
89+
>
90+
<field
91+
name="condition_cel_expression"
92+
nolabel="1"
93+
widget="cel_expression"
94+
cel_profile="registry_groups"
95+
show_symbol_browser="true"
96+
show_validation_count="true"
97+
invisible="condition_mode != 'cel'"
98+
placeholder="e.g., hh_size >= 4 and child_count > 0"
99+
/>
54100
</xpath>
55101
</field>
56102
</record>
@@ -59,14 +105,23 @@
59105
<record id="view_inkind_entitlement_manager_cel_form" model="ir.ui.view">
60106
<field name="name">spp.program.entitlement.manager.inkind.cel.form</field>
61107
<field name="model">spp.program.entitlement.manager.inkind</field>
62-
<field name="inherit_id" ref="spp_programs.view_entitlement_manager_inkind_form"/>
108+
<field
109+
name="inherit_id"
110+
ref="spp_programs.view_entitlement_manager_inkind_form"
111+
/>
63112
<field name="arch" type="xml">
64113
<!-- Update the tree view inside the form to show quantity and condition modes -->
65-
<xpath expr="//field[@name='entitlement_item_ids']/list/field[@name='quantity']" position="before">
66-
<field name="quantity_mode" optional="show"/>
114+
<xpath
115+
expr="//field[@name='entitlement_item_ids']/list/field[@name='quantity']"
116+
position="before"
117+
>
118+
<field name="quantity_mode" optional="show" />
67119
</xpath>
68-
<xpath expr="//field[@name='entitlement_item_ids']/list/field[@name='multiplier_field']" position="before">
69-
<field name="condition_mode" optional="hide"/>
120+
<xpath
121+
expr="//field[@name='entitlement_item_ids']/list/field[@name='multiplier_field']"
122+
position="before"
123+
>
124+
<field name="condition_mode" optional="hide" />
70125
</xpath>
71126
</field>
72127
</record>

spp_programs/views/managers/entitlement_manager_inkind_view.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,14 @@ Part of OpenSPP. See LICENSE file for full copyright and licensing details.
9090
string="Condition (Optional)"
9191
class="mt-3"
9292
/>
93-
<div name="condition_section">
93+
<group name="condition_section" col="1">
9494
<field
9595
name="condition"
9696
nolabel="1"
9797
widget="domain"
9898
options="{'model': 'res.partner'}"
9999
/>
100-
</div>
100+
</group>
101101
<group colspan="4" col="4">
102102
<group colspan="2">
103103
<field

0 commit comments

Comments
 (0)