Skip to content

Commit 6b4b4d2

Browse files
committed
feat(spp_registry): x2many_no_padding widget + empty-state info on registrant lists (#943)
Add a reusable `widget="x2many_no_padding"` in spp_registry that suppresses the four empty placeholder rows Odoo 19 hardcodes on inline list-in-form views, and apply it across every multi-line One2many block on the group and individual registrant forms (Phone, IDs, Relationships, Bank, Group Membership, Group Members, Consents, Events, Programs, Entitlements, GRM tickets, disability assessments, hazard impacts, farm activities, service points). For read-only or no-create lists (Consents, Events, GRM tickets, disability assessments, hazard impacts), also hide the table when the list is empty and show a short muted info line in its place — matching the existing Entitlements treatment.
1 parent 98a45a9 commit 6b4b4d2

16 files changed

Lines changed: 218 additions & 20 deletions

File tree

spp_banking/views/groups_view.xml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,13 @@
1515
<attribute name="invisible">0</attribute>
1616
</xpath>
1717
<xpath expr="//group[@name='group_financial_section']" position="inside">
18-
<field name="bank_ids" readonly="disabled" nolabel="1" colspan="2">
18+
<field
19+
name="bank_ids"
20+
readonly="disabled"
21+
nolabel="1"
22+
colspan="2"
23+
widget="x2many_no_padding"
24+
>
1925
<list editable="top">
2026
<field name="bank_id" options="{'no_quick_create':True}" />
2127
<field name="acc_number" />

spp_banking/views/individuals_view.xml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,13 @@
1212
<attribute name="invisible">0</attribute>
1313
</xpath>
1414
<xpath expr="//group[@name='financial_section']" position="inside">
15-
<field name="bank_ids" readonly="disabled" nolabel="1" colspan="2">
15+
<field
16+
name="bank_ids"
17+
readonly="disabled"
18+
nolabel="1"
19+
colspan="2"
20+
widget="x2many_no_padding"
21+
>
1622
<list editable="top">
1723
<field name="bank_id" options="{'no_quick_create':True}" />
1824
<field name="acc_number" />

spp_consent/views/registrant_view.xml

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,24 @@ Part of OpenSPP. See LICENSE file for full copyright and licensing details.
1717

1818
<!-- Add consent field to verification section -->
1919
<xpath expr="//group[@name='verification_section']" position="inside">
20-
<field name="consent_ids" nolabel="1" readonly="1">
20+
<separator string="Consents" colspan="2" />
21+
<field
22+
name="consent_ids"
23+
nolabel="1"
24+
readonly="1"
25+
widget="x2many_no_padding"
26+
invisible="not consent_ids"
27+
colspan="2"
28+
>
2129
<list>
2230
<field name="name" />
2331
<field name="signatory_id" column_invisible="1" />
2432
<field name="expiry" />
2533
</list>
2634
</field>
35+
<div class="text-muted small" invisible="consent_ids" colspan="2">
36+
No consents recorded yet. Click "Record Consent" above to add one.
37+
</div>
2738
</xpath>
2839

2940
<xpath expr="//div[@name='button_box']" position="inside">
@@ -59,13 +70,24 @@ Part of OpenSPP. See LICENSE file for full copyright and licensing details.
5970

6071
<!-- Add consent field to verification section -->
6172
<xpath expr="//group[@name='group_verification_section']" position="inside">
62-
<field name="consent_ids" nolabel="1" readonly="1">
73+
<separator string="Consents" colspan="2" />
74+
<field
75+
name="consent_ids"
76+
nolabel="1"
77+
readonly="1"
78+
widget="x2many_no_padding"
79+
invisible="not consent_ids"
80+
colspan="2"
81+
>
6382
<list>
6483
<field name="name" />
6584
<field name="signatory_id" />
6685
<field name="expiry" />
6786
</list>
6887
</field>
88+
<div class="text-muted small" invisible="consent_ids" colspan="2">
89+
No consents recorded yet. Click "Record Consent" above to add one.
90+
</div>
6991
</xpath>
7092

7193
<xpath expr="//div[@name='button_box']" position="inside">

spp_disability_registry/views/registrant_views.xml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,10 +168,18 @@
168168
<i class="fa fa-plus me-1" /> New Assessment
169169
</button>
170170
</div>
171+
<div
172+
invisible="disability_assessment_count != 0"
173+
class="text-muted small"
174+
>
175+
No disability assessments yet.
176+
</div>
171177
<field
172178
name="disability_assessment_ids"
173179
readonly="1"
174180
nolabel="1"
181+
widget="x2many_no_padding"
182+
invisible="disability_assessment_count == 0"
175183
>
176184
<list
177185
limit="10"
@@ -210,7 +218,11 @@
210218
Unmet Device Need
211219
</span>
212220
</div>
213-
<field name="assistive_device_ids" nolabel="1">
221+
<field
222+
name="assistive_device_ids"
223+
nolabel="1"
224+
widget="x2many_no_padding"
225+
>
214226
<list editable="bottom">
215227
<field
216228
name="device_type_id"

spp_event_data/views/registrant_view.xml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,16 @@
3333
<!-- Additional summary fields -->
3434
</group>
3535
</group>
36-
<field name="event_data_ids" readonly="1" nolabel="1">
36+
<div invisible="event_data_count != 0" class="text-muted small">
37+
No events recorded yet.
38+
</div>
39+
<field
40+
name="event_data_ids"
41+
readonly="1"
42+
nolabel="1"
43+
widget="x2many_no_padding"
44+
invisible="event_data_count == 0"
45+
>
3746
<list>
3847
<field name="name" />
3948
<field name="event_type_id" />
@@ -84,7 +93,16 @@
8493
<!-- Additional summary fields -->
8594
</group>
8695
</group>
87-
<field name="event_data_ids" readonly="1" nolabel="1">
96+
<div invisible="event_data_count != 0" class="text-muted small">
97+
No events recorded yet.
98+
</div>
99+
<field
100+
name="event_data_ids"
101+
readonly="1"
102+
nolabel="1"
103+
widget="x2many_no_padding"
104+
invisible="event_data_count == 0"
105+
>
88106
<list>
89107
<field name="name" />
90108
<field name="event_type_id" />

spp_farmer_registry/views/farm_views.xml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
<field
6262
name="farm_crop_act_ids"
6363
context="{'default_activity_type': 'crop'}"
64+
widget="x2many_no_padding"
6465
>
6566
<list editable="bottom">
6667
<field name="activity_type" column_invisible="1" />
@@ -88,6 +89,7 @@
8889
<field
8990
name="farm_livestock_act_ids"
9091
context="{'default_activity_type': 'livestock'}"
92+
widget="x2many_no_padding"
9193
>
9294
<list editable="bottom">
9395
<field name="activity_type" column_invisible="1" />
@@ -113,6 +115,7 @@
113115
<field
114116
name="farm_aquaculture_act_ids"
115117
context="{'default_activity_type': 'aquaculture'}"
118+
widget="x2many_no_padding"
116119
>
117120
<list editable="bottom">
118121
<field name="activity_type" column_invisible="1" />
@@ -131,7 +134,7 @@
131134
</page>
132135

133136
<page string="Land Parcels" name="land_parcels">
134-
<field name="farm_land_rec_ids">
137+
<field name="farm_land_rec_ids" widget="x2many_no_padding">
135138
<list>
136139
<field name="land_name" />
137140
<field name="land_acreage" />
@@ -142,15 +145,19 @@
142145

143146
<page string="Farm Assets" name="farm_assets">
144147
<separator string="Assets" />
145-
<field name="farm_asset_ids" nolabel="1">
148+
<field name="farm_asset_ids" nolabel="1" widget="x2many_no_padding">
146149
<list editable="bottom">
147150
<field name="asset_type_id" />
148151
<field name="technology_used" />
149152
<field name="quantity" />
150153
</list>
151154
</field>
152155
<separator string="Machinery" />
153-
<field name="farm_machinery_ids" nolabel="1">
156+
<field
157+
name="farm_machinery_ids"
158+
nolabel="1"
159+
widget="x2many_no_padding"
160+
>
154161
<list editable="bottom">
155162
<field name="machinery_type_id" />
156163
<field name="machine_working_status" />
@@ -160,7 +167,7 @@
160167
</page>
161168

162169
<page string="Extension Services" name="extension_services">
163-
<field name="farm_extension_ids">
170+
<field name="farm_extension_ids" widget="x2many_no_padding">
164171
<list>
165172
<field name="service_type" />
166173
<field name="provider" />

spp_grm_registry/views/res_partner_views.xml

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,19 @@
3535
<field name="grm_registrant_open_count" />
3636
</group>
3737
</group>
38+
<div
39+
invisible="grm_registrant_ticket_count != 0"
40+
class="text-muted small"
41+
>
42+
No GRM tickets for this registrant yet.
43+
</div>
3844
<!-- Odoo 19: list/form replaces tree/form -->
39-
<field name="grm_registrant_ticket_ids" mode="list">
45+
<field
46+
name="grm_registrant_ticket_ids"
47+
mode="list"
48+
widget="x2many_no_padding"
49+
invisible="grm_registrant_ticket_count == 0"
50+
>
4051
<list create="0" delete="0">
4152
<field name="name" />
4253
<field name="category_id" />
@@ -83,8 +94,19 @@
8394
<group>
8495
<field name="grm_household_ticket_count" />
8596
</group>
97+
<div
98+
invisible="grm_household_ticket_count != 0"
99+
class="text-muted small"
100+
>
101+
No GRM tickets for this household yet.
102+
</div>
86103
<!-- Odoo 19: list/form replaces tree/form -->
87-
<field name="grm_household_ticket_ids" mode="list">
104+
<field
105+
name="grm_household_ticket_ids"
106+
mode="list"
107+
widget="x2many_no_padding"
108+
invisible="grm_household_ticket_count == 0"
109+
>
88110
<list create="0" delete="0">
89111
<field name="name" />
90112
<field name="registrant_id" />

spp_hazard/views/registrant_views.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,20 @@
5353
string="Incident Impacts"
5454
invisible="hazard_impact_count == 0"
5555
>
56+
<div
57+
invisible="hazard_impact_count != 0"
58+
class="text-muted small"
59+
colspan="2"
60+
>
61+
No hazard impacts recorded yet.
62+
</div>
5663
<field
5764
name="hazard_impact_ids"
5865
nolabel="1"
5966
readonly="1"
6067
colspan="2"
68+
widget="x2many_no_padding"
69+
invisible="hazard_impact_count == 0"
6170
>
6271
<list>
6372
<field name="incident_id" />

spp_programs/views/program_membership_view.xml

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ Part of OpenSPP. See LICENSE file for full copyright and licensing details.
187187
name="phone_number_ids"
188188
nolabel="1"
189189
colspan="2"
190+
widget="x2many_no_padding"
190191
>
191192
<list>
192193
<field
@@ -216,7 +217,12 @@ Part of OpenSPP. See LICENSE file for full copyright and licensing details.
216217
</group>
217218
</page>
218219
<page string="Bank Details" name="banks">
219-
<field name="bank_ids" nolabel="1" colspan="2">
220+
<field
221+
name="bank_ids"
222+
nolabel="1"
223+
colspan="2"
224+
widget="x2many_no_padding"
225+
>
220226
<list editable="bottom">
221227
<field name="bank_id" />
222228
<field name="acc_number" />
@@ -226,7 +232,12 @@ Part of OpenSPP. See LICENSE file for full copyright and licensing details.
226232
</field>
227233
</page>
228234
<page string="IDs" name="ids">
229-
<field name="reg_ids" nolabel="1" colspan="2">
235+
<field
236+
name="reg_ids"
237+
nolabel="1"
238+
colspan="2"
239+
widget="x2many_no_padding"
240+
>
230241
<list editable="bottom">
231242
<field name="id_type_id" />
232243
<field name="value" string="ID Number" />
@@ -236,7 +247,12 @@ Part of OpenSPP. See LICENSE file for full copyright and licensing details.
236247
</page>
237248
<page string="Relationships" name="relationships">
238249
<group string="Registrant is related to:">
239-
<field name="related_1_ids" nolabel="1" colspan="2">
250+
<field
251+
name="related_1_ids"
252+
nolabel="1"
253+
colspan="2"
254+
widget="x2many_no_padding"
255+
>
240256
<list editable="bottom">
241257
<field
242258
name="source"
@@ -255,7 +271,12 @@ Part of OpenSPP. See LICENSE file for full copyright and licensing details.
255271
</field>
256272
</group>
257273
<group string="Others Related to this Registrant:">
258-
<field name="related_2_ids" nolabel="1" colspan="2">
274+
<field
275+
name="related_2_ids"
276+
nolabel="1"
277+
colspan="2"
278+
widget="x2many_no_padding"
279+
>
259280
<list>
260281
<field
261282
name="destination"
@@ -284,6 +305,7 @@ Part of OpenSPP. See LICENSE file for full copyright and licensing details.
284305
name="group_membership_ids"
285306
nolabel="1"
286307
colspan="2"
308+
widget="x2many_no_padding"
287309
>
288310
<list>
289311
<field

spp_programs/views/registrant_view.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ Part of OpenSPP. See LICENSE file for full copyright and licensing details.
9191
nolabel="1"
9292
readonly="1"
9393
invisible="program_membership_count == 0"
94+
widget="x2many_no_padding"
9495
>
9596
<list
9697
decoration-info="state == 'draft'"
@@ -162,6 +163,7 @@ Part of OpenSPP. See LICENSE file for full copyright and licensing details.
162163
nolabel="1"
163164
readonly="1"
164165
invisible="entitlements_count == 0"
166+
widget="x2many_no_padding"
165167
>
166168
<list
167169
decoration-muted="state in ('cancelled', 'expired')"
@@ -189,6 +191,7 @@ Part of OpenSPP. See LICENSE file for full copyright and licensing details.
189191
nolabel="1"
190192
readonly="1"
191193
invisible="inkind_entitlements_count == 0"
194+
widget="x2many_no_padding"
192195
>
193196
<list decoration-muted="state in ('cancelled', 'expired')">
194197
<field name="cycle_id" />
@@ -230,6 +233,7 @@ Part of OpenSPP. See LICENSE file for full copyright and licensing details.
230233
nolabel="1"
231234
readonly="1"
232235
invisible="program_membership_count == 0"
236+
widget="x2many_no_padding"
233237
>
234238
<list
235239
decoration-info="state == 'draft'"
@@ -304,6 +308,7 @@ Part of OpenSPP. See LICENSE file for full copyright and licensing details.
304308
nolabel="1"
305309
readonly="1"
306310
invisible="entitlements_count == 0"
311+
widget="x2many_no_padding"
307312
>
308313
<list
309314
decoration-muted="state in ('cancelled', 'expired')"
@@ -331,6 +336,7 @@ Part of OpenSPP. See LICENSE file for full copyright and licensing details.
331336
nolabel="1"
332337
readonly="1"
333338
invisible="inkind_entitlements_count == 0"
339+
widget="x2many_no_padding"
334340
>
335341
<list decoration-muted="state in ('cancelled', 'expired')">
336342
<field name="cycle_id" />

0 commit comments

Comments
 (0)