Skip to content

feat(spp_registry): x2many_no_padding widget + empty-state info on registrant lists (#943)#196

Open
emjay0921 wants to merge 6 commits into
19.0from
fix/943-registry-views-collapse-empty-rows
Open

feat(spp_registry): x2many_no_padding widget + empty-state info on registrant lists (#943)#196
emjay0921 wants to merge 6 commits into
19.0from
fix/943-registry-views-collapse-empty-rows

Conversation

@emjay0921
Copy link
Copy Markdown
Contributor

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:

  1. New widget in spp_registry: static/src/js/x2many_no_padding_field.js registers a reusable widget="x2many_no_padding" (extends Odoo's stock X2ManyField and overrides the row-padding behavior to return zero placeholder rows).
  2. Apply the widget across 10 modules: every multi-line One2many block on the group / individual registrant forms now declares 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:

Module Bump Scope
spp_registry 19.0.2.0.0 → 19.0.2.0.1 introduces the widget; applies to Phone / IDs / Relationships / Group Membership / Group Members lists
spp_banking 19.0.2.0.0 → 19.0.2.0.1 Bank Information lists
spp_consent 19.0.2.0.0 → 19.0.2.0.1 Consents list (+ empty-state info)
spp_disability_registry 19.0.2.0.0 → 19.0.2.0.1 disability assessments list (+ empty-state info)
spp_event_data 19.0.2.0.0 → 19.0.2.0.1 Events list (+ empty-state info)
spp_farmer_registry 19.0.2.0.0 → 19.0.2.0.1 farm activities list
spp_grm_registry 19.0.2.0.0 → 19.0.2.0.1 GRM tickets list (+ empty-state info)
spp_hazard 19.0.2.0.0 → 19.0.2.0.1 hazard impacts list (+ empty-state info)
spp_programs 19.0.2.0.11 → 19.0.2.0.12 Programs / Entitlements / Program Membership lines
spp_service_points 19.0.2.0.0 → 19.0.2.0.1 service points list

New 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:

  1. ./spp start./spp resetdb -y./spp start./spp url.
  2. Log in as admin / admin, install spp_mis_demo_v2 (or spp_farmer_registry_demo for the farm path), load the corresponding Settings → Demo Data → Load Demo wizard.
  3. Open any group or individual registrant form. For each embedded One2many block (Phone, IDs, Relationships, Bank, Group Membership, Group Members, Consents, Events, Programs, Entitlements, GRM tickets, disability assessments, hazard impacts, farm activities, service points):
    • When the list has data: confirm there are no extra blank rows beneath the populated rows.
    • When the list is empty: for Consents / Events / GRM tickets / disability assessments / hazard impacts, confirm the table is hidden and a short muted info line is shown in its place (no four-row blank skeleton). For other lists, confirm the empty table renders without padding rows.

Related links

…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.
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +28 to +30
get getEmptyRowIds() {
return [];
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

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.

Suggested change
get getEmptyRowIds() {
return [];
}
getEmptyRowIds() {
return [];
}

Comment on lines +171 to +176
<div
invisible="disability_assessment_count != 0"
class="text-muted small"
>
No disability assessments yet.
</div>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This empty state message is unreachable because it is placed inside a container (at line 157 in the full file) that is hidden when disability_assessment_count == 0. To show this message when the list is empty, it must be moved outside that parent container.

Comment on lines +56 to +62
<div
invisible="hazard_impact_count != 0"
class="text-muted small"
colspan="2"
>
No hazard impacts recorded yet.
</div>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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
  1. 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
Copy link
Copy Markdown

codecov Bot commented May 12, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 71.70%. Comparing base (f121006) to head (4b78fca).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             19.0     #196   +/-   ##
=======================================
  Coverage   71.70%   71.70%           
=======================================
  Files         942      942           
  Lines       55563    55563           
=======================================
  Hits        39844    39844           
  Misses      15719    15719           
Flag Coverage Δ
spp_analytics 93.13% <ø> (ø)
spp_api_v2 80.33% <ø> (ø)
spp_api_v2_change_request 66.85% <ø> (ø)
spp_api_v2_cycles 71.12% <ø> (ø)
spp_api_v2_data 64.41% <ø> (ø)
spp_api_v2_entitlements 70.19% <ø> (ø)
spp_api_v2_gis 71.52% <ø> (ø)
spp_api_v2_products 66.27% <ø> (ø)
spp_api_v2_service_points 70.94% <ø> (ø)
spp_api_v2_simulation 71.12% <ø> (ø)
spp_api_v2_vocabulary 57.26% <ø> (ø)
spp_approval 50.29% <ø> (ø)
spp_area 80.07% <ø> (ø)
spp_area_hdx 81.43% <ø> (ø)
spp_audit 72.60% <ø> (ø)
spp_banking 80.00% <ø> (ø)
spp_base_common 90.26% <ø> (ø)
spp_base_setting 50.00% <ø> (ø)
spp_programs 64.87% <ø> (ø)
spp_security 66.66% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
spp_banking/__manifest__.py 0.00% <ø> (ø)
spp_disability_registry/__manifest__.py 0.00% <ø> (ø)
spp_farmer_registry/__manifest__.py 0.00% <ø> (ø)
spp_hazard/__manifest__.py 0.00% <ø> (ø)
spp_programs/__manifest__.py 0.00% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

emjay0921 added 2 commits May 12, 2026 10:50
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.
@emjay0921
Copy link
Copy Markdown
Contributor Author

@gonzalesedwin1123 — ready for review. QA on OP#943 already passed; CI is green on 4b78fca6. Branch is up-to-date with 19.0 (merge commit 1909778c resolved version conflicts on spp_registry / spp_programs cleanly).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants