Skip to content

fix(spp_grm,spp_grm_registry): deduplicate Tickets smart button + fix caption/view_mode (#1000, #1001)#207

Open
emjay0921 wants to merge 2 commits into
19.0from
fix/1001-grm-tickets-smart-button
Open

fix(spp_grm,spp_grm_registry): deduplicate Tickets smart button + fix caption/view_mode (#1000, #1001)#207
emjay0921 wants to merge 2 commits into
19.0from
fix/1001-grm-tickets-smart-button

Conversation

@emjay0921
Copy link
Copy Markdown
Contributor

Why is this change needed?

Bundled fix for two connected QA bugs on registrant profiles:

  • OP#1001 — The Household GRM Tickets smart button on group/household forms rendered with two stacked captions ("Household GRM Tickets" + "GRM Tickets") and clicking it threw UncaughtPromiseError — act_window action undefined.
  • OP#1000 — Two identical "Tickets" smart buttons appeared on registrant profiles (both showing 0/0) because spp_grm and spp_grm_registry each added one.

QA has passed both tickets.

How was the change implemented?

spp_grm

Deleted the duplicate view record view_groups_form_inherit_spp_grm in views/res_partner_views.xml. The remaining view_individuals_form_inherit_spp_grm covers the registrant form for both individual + group cases (no is_group filter), and the third record (view_partner_form on base.view_partner_form) keeps the legacy Tickets button on plain (non-registrant) partners untouched.

spp_grm_registry

  • models/res_partner.py: view_mode="tree,form,kanban""list,form,kanban" on both action_view_grm_registrant_tickets and action_view_grm_household_tickets. The tree view type is invalid in Odoo 19; this is what caused the act_window action undefined error.
  • views/res_partner_views.xml:
    • Replaced the <div class="o_stat_info"><field statinfo/><span class="o_stat_text">GRM Tickets</span></div> markup with the idiomatic <field statinfo string="GRM Tickets"/> pattern used in spp_programs. The statinfo widget already renders the field's string as a label — combining it with an explicit <span> was producing the double caption.
    • New primary-mode view (view_res_partner_form_hide_legacy_grm_button, priority 99) inheriting spp_grm.view_individuals_form_inherit_spp_grm and replacing the legacy Tickets button with empty content — so when spp_grm_registry is installed, its own registrant + household buttons are the canonical entry point.
  • tests/test_res_partner.py: View-mode assertions updated to expect list instead of tree, with an explicit assertNotIn("tree", ...) regression guard.

New unit tests

Adjusted 2 existing tests + added 2 explicit-negative checks:

  • test_action_view_registrant_tickets_view_mode — now asserts list/form/kanban in view_mode AND tree NOT in view_mode.
  • test_action_view_household_tickets_view_mode — same shape.

Unit tests executed by the author

spp_grm_registry test suite (39 tests) + targeted spp_grm (33 tests) run in the CI container against an isolated DB. 0 failed / 0 errors.

How to test manually

git checkout fix/1001-grm-tickets-smart-button
./spp resetdb -y && ./spp start && ./spp url

Install spp_grm_registry (pulls spp_grm as a dep). Create both an individual and a group registrant. On each profile:

  • Exactly ONE Tickets-related smart button labelled GRM Tickets, single caption, width matching peer stat buttons.
  • Clicking opens the GRM tickets list filtered by the current registrant — no UncaughtPromiseError in the browser console.
  • On a non-registrant plain partner (Contacts app), the legacy spp_grm Tickets button still shows (unchanged).

Related links

🤖 Generated with Claude Code

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 updates the module to align with Odoo 17+ conventions by renaming 'tree' view modes to 'list' and simplifying smart button definitions using the 'string' attribute. It also removes legacy buttons and redundant view records to streamline the user interface. Feedback highlights the importance of using 'list' for modern Odoo versions and adopting idiomatic smart button labeling to prevent UI issues.

"name": "GRM Tickets (Registrant)",
"res_model": "spp.grm.ticket",
"view_mode": "tree,form,kanban",
"view_mode": "list,form,kanban",
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

In Odoo 17+, the tree view type has been renamed to list. Using the correct view_mode prevents potential client-side errors and aligns with modern Odoo conventions.

References
  1. In Odoo 17+, the 'tree' view type has been renamed to 'list'. (link)

Comment on lines +18 to +22
<field
name="grm_registrant_ticket_count"
widget="statinfo"
string="GRM Tickets"
/>
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

Using the string attribute directly on the field with widget="statinfo" is the idiomatic way to define smart button labels in Odoo 17+. This avoids the double-caption issue caused by combining the widget's automatic label with a manual <span>.

References
  1. In Odoo 17+, use the 'string' attribute on the 'field' with 'widget="statinfo"' for smart buttons. (link)

@codecov
Copy link
Copy Markdown

codecov Bot commented May 20, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 71.32%. Comparing base (6991217) to head (2ae7ae0).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             19.0     #207      +/-   ##
==========================================
+ Coverage   71.23%   71.32%   +0.08%     
==========================================
  Files         968      983      +15     
  Lines       57634    58060     +426     
==========================================
+ Hits        41057    41412     +355     
- Misses      16577    16648      +71     
Flag Coverage Δ
spp_base_common 90.26% <ø> (ø)
spp_grm 63.22% <ø> (ø)
spp_grm_case_link 99.03% <ø> (ø)
spp_grm_cel 76.95% <ø> (?)
spp_grm_demo 79.87% <ø> (ø)
spp_grm_programs 91.11% <ø> (?)
spp_grm_registry 98.50% <ø> (?)
spp_programs 64.84% <ø> (ø)
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_grm_registry/models/res_partner.py 100.00% <ø> (ø)

... and 14 files with indirect coverage changes

🚀 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.

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.

1 participant