fix(spp_grm,spp_grm_registry): deduplicate Tickets smart button + fix caption/view_mode (#1000, #1001)#207
fix(spp_grm,spp_grm_registry): deduplicate Tickets smart button + fix caption/view_mode (#1000, #1001)#207emjay0921 wants to merge 2 commits into
Conversation
… caption/view_mode (#1000, #1001)
There was a problem hiding this comment.
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", |
There was a problem hiding this comment.
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
- In Odoo 17+, the 'tree' view type has been renamed to 'list'. (link)
| <field | ||
| name="grm_registrant_ticket_count" | ||
| widget="statinfo" | ||
| string="GRM Tickets" | ||
| /> |
There was a problem hiding this comment.
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
- In Odoo 17+, use the 'string' attribute on the 'field' with 'widget="statinfo"' for smart buttons. (link)
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ 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
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Why is this change needed?
Bundled fix for two connected QA bugs on registrant profiles:
UncaughtPromiseError — act_window action undefined.spp_grmandspp_grm_registryeach added one.QA has passed both tickets.
How was the change implemented?
spp_grmDeleted the duplicate view record
view_groups_form_inherit_spp_grminviews/res_partner_views.xml. The remainingview_individuals_form_inherit_spp_grmcovers the registrant form for both individual + group cases (nois_groupfilter), and the third record (view_partner_formonbase.view_partner_form) keeps the legacy Tickets button on plain (non-registrant) partners untouched.spp_grm_registrymodels/res_partner.py:view_mode="tree,form,kanban"→"list,form,kanban"on bothaction_view_grm_registrant_ticketsandaction_view_grm_household_tickets. Thetreeview type is invalid in Odoo 19; this is what caused theact_window action undefinederror.views/res_partner_views.xml:<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 inspp_programs. Thestatinfowidget already renders the field'sstringas a label — combining it with an explicit<span>was producing the double caption.view_res_partner_form_hide_legacy_grm_button, priority 99) inheritingspp_grm.view_individuals_form_inherit_spp_grmand replacing the legacy Tickets button with empty content — so whenspp_grm_registryis installed, its own registrant + household buttons are the canonical entry point.tests/test_res_partner.py: View-mode assertions updated to expectlistinstead oftree, with an explicitassertNotIn("tree", ...)regression guard.New unit tests
Adjusted 2 existing tests + added 2 explicit-negative checks:
test_action_view_registrant_tickets_view_mode— now assertslist/form/kanbanin view_mode ANDtreeNOT in view_mode.test_action_view_household_tickets_view_mode— same shape.Unit tests executed by the author
spp_grm_registrytest suite (39 tests) + targetedspp_grm(33 tests) run in the CI container against an isolated DB. 0 failed / 0 errors.How to test manually
Install
spp_grm_registry(pullsspp_grmas a dep). Create both an individual and a group registrant. On each profile:UncaughtPromiseErrorin the browser console.Related links
🤖 Generated with Claude Code