Skip to content

fix(spp_hazard performance)#101

Merged
emjay0921 merged 8 commits into19.0from
fix/spp-hazard-review-fixes
Mar 18, 2026
Merged

fix(spp_hazard performance)#101
emjay0921 merged 8 commits into19.0from
fix/spp-hazard-review-fixes

Conversation

@gonzalesedwin1123
Copy link
Member

Summary

  • Fix performance issues in computed fields (replace len(rec.xxx_ids) with read_group, use SQL COUNT(DISTINCT) for affected registrant counts, batch bulk_create_impacts with BATCH_SIZE=500)
  • Fix security: restrict officer write/create on config models (category, impact_type), add base.group_user read ACL for spp.hazard.impact
  • Fix Odoo 19 compatibility: replace deprecated name_get() with _compute_display_name(), use Command.link() in tests
  • Fix action_close() multi-record bug (now iterates per record)
  • Improve UX: apply master data vs workflow entity form patterns, add alert banners, badge decorations, accessibility titles, extension points
  • Add demo data: 3 areas, 3 registrants, 5 impact records with mixed verification statuses
  • Add 21 new tests (registrant: 9, security: 7, incident: 5) bringing total to 59 passing tests with 100% method/field/constraint coverage
  • Add USAGE.md QA testing guide (13 sections, 487 lines) and update DESCRIPTION.md

Test plan

  • All 59 tests pass (./scripts/test_single_module.sh spp_hazard)
  • All pre-commit hooks pass (ruff, pylint, prettier, oca-gen-addon-readme, OpenSPP custom checks)
  • 100% coverage of public methods, computed fields, and constraints
  • Security tested for all 3 roles (viewer, officer, manager)
  • Manual QA: install with demo data, verify menu structure and form layouts
  • Manual QA: verify officer cannot write/create categories or impact types
  • Manual QA: verify registrant Emergency Response tab and stat button

- Replace len(rec.xxx_ids) with read_group for computed counts
- Use SQL COUNT(DISTINCT) for affected_registrant_count
- Batch bulk_create_impacts with BATCH_SIZE=500
- Replace deprecated name_get() with _compute_display_name()
- Fix action_close() multi-record bug (iterate per record)
- Restrict officer write/create on config models (category, impact_type)
- Add base.group_user read ACL for spp.hazard.impact
- Apply master data vs workflow entity form patterns
- Add alert banners, badge decorations, extension points
- Add accessibility titles to icon elements
- Add demo areas, registrants, and impact records
- Add registrant test suite (9 tests) and security tests (7 tests)
- Add 5 new incident tests (areas, display_name, constraints, close)
- Update DESCRIPTION.md and add USAGE.md QA testing guide
@gemini-code-assist
Copy link

Warning

Gemini is experiencing higher than usual traffic and was unable to create the summary. Please try again in a few hours by commenting /gemini summary.

@codecov
Copy link

codecov bot commented Mar 12, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 71.20%. Comparing base (9c2376e) to head (73de234).
⚠️ Report is 98 commits behind head on 19.0.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             19.0     #101      +/-   ##
==========================================
+ Coverage   71.17%   71.20%   +0.03%     
==========================================
  Files         704      707       +3     
  Lines       38554    38842     +288     
==========================================
+ Hits        27439    27657     +218     
- Misses      11115    11185      +70     
Flag Coverage Δ
spp_api_v2_gis 71.52% <ø> (ø)
spp_base_common 90.26% <ø> (ø)
spp_dci_demo 69.23% <ø> (ø)
spp_drims 79.55% <ø> (ø)
spp_drims_sl_demo 68.48% <ø> (-0.43%) ⬇️
spp_gis_indicators 91.07% <ø> (ø)
spp_hazard 99.59% <100.00%> (+7.08%) ⬆️
spp_hazard_programs 97.14% <ø> (ø)
spp_hxl_area 63.74% <ø> (ø)
spp_mis_demo_v2 69.73% <ø> (-0.09%) ⬇️
spp_programs 45.51% <ø> (ø)
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_hazard/__manifest__.py 0.00% <ø> (ø)
spp_hazard/models/hazard_category.py 100.00% <100.00%> (ø)
spp_hazard/models/hazard_impact.py 100.00% <100.00%> (ø)
spp_hazard/models/hazard_impact_type.py 100.00% <100.00%> (ø)
spp_hazard/models/hazard_incident.py 100.00% <100.00%> (+12.34%) ⬆️
spp_hazard/models/registrant.py 100.00% <100.00%> (+24.00%) ⬆️
spp_hazard_programs/__manifest__.py 0.00% <ø> (ø)

... and 6 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.

Cover gaps in hazard_incident.py: is_ongoing for alert/recovery/closed
statuses, date constraint on update, DISTINCT registrant counting,
empty recordset branch, multi-record action_close, and end_date
preservation on close. Total tests: 59 → 65.
@gonzalesedwin1123 gonzalesedwin1123 marked this pull request as ready for review March 12, 2026 16:25
@gonzalesedwin1123 gonzalesedwin1123 changed the title fix: improve spp_hazard performance, security, UX, and test coverage fix(spp_hazard performance) Mar 16, 2026
…rogram ACLs

- Consolidate 3 separate privileges (Viewer/Officer/Manager) into 1 shared
  privilege so they are mutually exclusive in Access Rights dropdown
- Split privilege into separate privileges.xml loaded before groups.xml
  (matching spp_registry pattern)
- Add ir.model.access.csv to spp_hazard_programs granting hazard groups
  read access to spp.program
- Fix area_count to include areas from incident_area_ids (One2many detail
  records), not just area_ids (Many2many)
- Fix action_view_areas and identify_potentially_affected_registrants to
  use both area sources
Add groups="group_hazard_manager" to child menu items (Hazard
Categories, Impact Types) so officers cannot see the Configuration
submenu.
- Make impact list inline editable (editable="bottom", no_open)
  to avoid badge widget bdom crash in dialog re-render
- Add Verify/Dispute/Close/Reset buttons in list rows
- Hide action buttons until row is saved (create_date check)
- Remove chatter from impact form (kept mail.thread for tracking)
- Fix impact ordering with id tiebreaker
- Notes field as optional="hide"
@emjay0921 emjay0921 merged commit 91a890a into 19.0 Mar 18, 2026
27 checks passed
@emjay0921 emjay0921 deleted the fix/spp-hazard-review-fixes branch March 18, 2026 01:38
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