feat(spp_registry): x2many_no_padding widget + empty-state info on registrant lists (#943)#196
feat(spp_registry): x2many_no_padding widget + empty-state info on registrant lists (#943)#196emjay0921 wants to merge 6 commits into
Conversation
…gistrant 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.
…dding rollout Commit 6b4b4d2 applied the new spp_registry x2many_no_padding widget across 10 modules' registrant form views but forgot to bump module versions or add HISTORY entries. Add both now so OCA tooling reflects the change and existing deployments get an upgrade signal: - spp_registry: 19.0.2.0.0 -> 19.0.2.0.1 (introduces the widget) - spp_banking, spp_consent, spp_disability_registry, spp_event_data, spp_farmer_registry, spp_grm_registry, spp_hazard, spp_service_points: 19.0.2.0.0 -> 19.0.2.0.1 (consumers) - spp_programs: 19.0.2.0.11 -> 19.0.2.0.12 (consumer) No code changes — version bumps and HISTORY entries only.
….0 (OP#943) Both modules already had a 19.0.2.1.0 bump on the 19.0 base branch (undocumented in HISTORY.md, but real in the manifest). My earlier bumps (19.0.2.0.1 for spp_registry, 19.0.2.0.12 for spp_programs) were below 19.0's current version, which caused merge conflicts on PR #196 because OCA tooling forbids version regression. Re-bump both to 19.0.2.1.1 and update the matching HISTORY entries to keep the version monotonic on merge.
There was a problem hiding this comment.
Code Review
This pull request introduces a custom Odoo widget, x2many_no_padding, to suppress the default four empty placeholder rows in inline list views across multiple modules, including banking, consent, disability, and programs. It also adds descriptive empty-state messages to improve the user experience when lists are empty. Feedback focuses on a critical runtime error in the JavaScript implementation where a method was incorrectly defined as a getter. Furthermore, logic issues were identified in the XML views where certain empty-state messages are unreachable because their parent containers are hidden when the record count is zero.
| get getEmptyRowIds() { | ||
| return []; | ||
| } |
There was a problem hiding this comment.
In Odoo's ListRenderer, getEmptyRowIds is implemented as a method, not a getter. Defining it with the get keyword here will cause a runtime error (TypeError: this.getEmptyRowIds is not a function) when the base class or the template attempts to call it. It should be defined as a standard method.
| get getEmptyRowIds() { | |
| return []; | |
| } | |
| getEmptyRowIds() { | |
| return []; | |
| } |
| <div | ||
| invisible="disability_assessment_count != 0" | ||
| class="text-muted small" | ||
| > | ||
| No disability assessments yet. | ||
| </div> |
| <div | ||
| invisible="hazard_impact_count != 0" | ||
| class="text-muted small" | ||
| colspan="2" | ||
| > | ||
| No hazard impacts recorded yet. | ||
| </div> |
There was a problem hiding this comment.
This empty state message is unreachable because it is inside a group that is hidden when hazard_impact_count == 0 (line 54). While code duplication is acceptable in UI definitions to provide context-specific labels, the current visibility logic prevents this message from being displayed.
References
- In UI definitions, code duplication is acceptable if it serves to provide context-specific labels for different operations, thereby improving user experience. Prioritizing clear, context-aware UX can be more important than strict code deduplication.
# Conflicts: # spp_programs/__manifest__.py # spp_registry/__manifest__.py
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 19.0 #196 +/- ##
=======================================
Coverage 71.70% 71.70%
=======================================
Files 942 942
Lines 55563 55563
=======================================
Hits 39844 39844
Misses 15719 15719
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Previous commit 218b55b also restored 18 unrelated module READMEs (api_v2_gis, api_v2_vocabulary, branding_kit, case_demo, cel_domain, spp_demo, drims_sl, farmer_registry_demo, grm_case_link, registry_group_hierarchy) that had stale local diffs from prior sessions' regen attempts. Those changes don't belong in this PR. Restore those 18 files to origin/19.0 state. The 10 PR-scoped modules (spp_registry, spp_banking, spp_consent, spp_disability_registry, spp_event_data, spp_farmer_registry, spp_grm_registry, spp_hazard, spp_programs, spp_service_points) keep their regenerated READMEs.
|
@gonzalesedwin1123 — ready for review. QA on OP#943 already passed; CI is green on |
Why is this change needed?
Per OP#943 (Registry views — collapse empty rows in multi-line One2many blocks), Odoo 19's inline list-in-form views hardcode four blank placeholder rows below the data. On registrant forms — which embed many One2many blocks (Phone, IDs, Relationships, Bank, Group Membership, Group Members, Consents, Events, Programs, Entitlements, GRM tickets, disability assessments, hazard impacts, farm activities, service points) — those blank rows pile up and bloat the layout to the point that scrolling through a single registrant becomes painful.
How was the change implemented?
Two-part rollout:
spp_registry:static/src/js/x2many_no_padding_field.jsregisters a reusablewidget="x2many_no_padding"(extends Odoo's stockX2ManyFieldand overrides the row-padding behavior to return zero placeholder rows).widget="x2many_no_padding". For read-only or no-create lists (Consents, Events, GRM tickets, disability assessments, hazard impacts) the table is also hidden entirely when empty and replaced with a short muted info line — matching the empty-state treatment that Entitlements already had.10 module versions bumped (patch) with matching HISTORY entries:
spp_registryspp_bankingspp_consentspp_disability_registryspp_event_dataspp_farmer_registryspp_grm_registryspp_hazardspp_programsspp_service_pointsNew unit tests
None — the change is a JS widget + view attribute application. No Python logic. Manual UI verification per the test plan below.
Unit tests executed by the author
Per-module
pre-commit run --files <PR-scoped paths>passed locally (CI-matched container).How to test manually
Already QA-passed; for re-verification on a fresh install:
./spp start→./spp resetdb -y→./spp start→./spp url.admin/admin, installspp_mis_demo_v2(orspp_farmer_registry_demofor the farm path), load the corresponding Settings → Demo Data → Load Demo wizard.Related links