diff --git a/spp_base_common/__manifest__.py b/spp_base_common/__manifest__.py index 6cda488f..b9ff39a3 100644 --- a/spp_base_common/__manifest__.py +++ b/spp_base_common/__manifest__.py @@ -5,7 +5,7 @@ { "name": "OpenSPP Base (Common)", "category": "OpenSPP/Core", - "version": "19.0.2.0.0", + "version": "19.0.2.0.1", "sequence": 1, "author": "OpenSPP.org", "website": "https://github.com/OpenSPP/OpenSPP2", @@ -38,6 +38,8 @@ "spp_base_common/static/src/xml/custom_list_create_template.xml", "spp_base_common/static/src/js/filterable_radio_field.js", "spp_base_common/static/src/xml/filterable_radio_field.xml", + "spp_base_common/static/src/xml/pager_hide_single.xml", + "spp_base_common/static/src/scss/pager_hide_single.scss", ], "web._assets_primary_variables": [ "spp_base_common/static/src/scss/colors.scss", diff --git a/spp_base_common/static/src/scss/pager_hide_single.scss b/spp_base_common/static/src/scss/pager_hide_single.scss new file mode 100644 index 00000000..d328621a --- /dev/null +++ b/spp_base_common/static/src/scss/pager_hide_single.scss @@ -0,0 +1,10 @@ +// See OP#920 + spp_base_common/static/src/xml/pager_hide_single.xml. +// The control-panel right-side toolbar (refresh button, embedded +// actions, view switcher) had no vertical alignment of its own — it +// relied on the pager's h-100 nav to anchor the row's height. +// Once the pager is hidden, those siblings collapse to top-aligned. +// Set align-items: center explicitly so they stay vertically centred +// whether the pager is visible or not. +.o_control_panel_navigation { + align-items: center; +} diff --git a/spp_base_common/static/src/xml/pager_hide_single.xml b/spp_base_common/static/src/xml/pager_hide_single.xml new file mode 100644 index 00000000..2bd84b0f --- /dev/null +++ b/spp_base_common/static/src/xml/pager_hide_single.xml @@ -0,0 +1,26 @@ + + + + + + props.total > 1 or props.updateTotal + + + diff --git a/spp_change_request_v2/README.rst b/spp_change_request_v2/README.rst index 346551e7..e17aa6a3 100644 --- a/spp_change_request_v2/README.rst +++ b/spp_change_request_v2/README.rst @@ -853,6 +853,20 @@ Before declaring a new CR type complete: Changelog ========= +19.0.2.0.4 +~~~~~~~~~~ + +- fix(views): route post-submit CRs (pending / approved / applied / + rejected) through the stage review form when opened from the list, + matching the Edit Details → Upload Documents → Review & Submit + breadcrumb workflow used for fresh CRs (#920 round-2). Demo-generated + CRs in "Applied" state previously landed on the legacy main form view + from the list — now they open in ``spp_change_request_review_form`` + like manually-created CRs. Adds the missing + ``_action_open_review_form`` / ``_action_open_documents_form`` helpers + and wires ``action="action_open_stage_form" type="object"`` on the CR + list so row-click goes through the stage router. + 19.0.2.0.3 ~~~~~~~~~~ diff --git a/spp_change_request_v2/__manifest__.py b/spp_change_request_v2/__manifest__.py index c565429a..d441e4fe 100644 --- a/spp_change_request_v2/__manifest__.py +++ b/spp_change_request_v2/__manifest__.py @@ -1,6 +1,6 @@ { "name": "OpenSPP Change Request V2", - "version": "19.0.2.0.3", + "version": "19.0.2.0.4", "sequence": 50, "category": "OpenSPP", "summary": "Configuration-driven change request system with UX improvements, conflict detection and duplicate prevention", diff --git a/spp_change_request_v2/models/change_request.py b/spp_change_request_v2/models/change_request.py index 8425457d..d1b1012e 100644 --- a/spp_change_request_v2/models/change_request.py +++ b/spp_change_request_v2/models/change_request.py @@ -1018,6 +1018,7 @@ def _on_submit(self): action = "resubmitted" if old_state == "revision" else "submitted" self._create_audit_event("submitted", old_state, "pending") self._create_log(action) + self.stage = "review" def _on_request_revision(self, notes): super()._on_request_revision(notes) @@ -1523,29 +1524,63 @@ def action_upload_document(self): def action_open_stage_form(self): """Open the appropriate form view based on the current stage. - For draft/revision CRs: routes to the stage-specific form. - For other states: opens the main CR form (for validators/managers). + - **Draft / revision**: route by `stage` to the editable stage form + (details / documents / review). + - **Submitted+ (pending, approved, applied, rejected)**: always open + the review-stage form. That form already renders state-aware + headers (Approve/Reject for validators, Apply for managers, + Applied ribbon for completed, Start Over for rejected) and shows + the same Edit Details → Upload Documents → Review & Submit + breadcrumb. Without this, validators/managers (and demo-applied + CRs opened from the list) landed on the legacy main form view + which lacks the breadcrumb and the pager-hide treatment. See + OP#920 round-2. """ self.ensure_one() - if self.approval_state not in ("draft", "revision"): - return { - "type": "ir.actions.act_window", - "name": self.name, - "res_model": "spp.change.request", - "res_id": self.id, - "view_mode": "form", - "views": [[False, "form"]], - "target": "current", - } + if self.approval_state in ("draft", "revision"): + if self.stage == "documents": + return self._action_open_documents_form() + if self.stage == "review": + return self._action_open_review_form() + return self.action_open_detail() + + # pending / approved / applied / rejected + return self._action_open_review_form() - if self.stage == "documents": - return self._action_open_documents_form() - if self.stage == "review": - return self._action_open_review_form() + def _action_open_review_form(self): + """Open the CR in the Review & Submit stage form view.""" + self.ensure_one() + view = self.env.ref( + "spp_change_request_v2.spp_change_request_review_form", + raise_if_not_found=False, + ) + return { + "type": "ir.actions.act_window", + "name": self.name, + "res_model": "spp.change.request", + "res_id": self.id, + "view_mode": "form", + "views": [[view.id if view else False, "form"]], + "target": "current", + } - # Default: details stage - return self.action_open_detail() + def _action_open_documents_form(self): + """Open the CR in the Upload Documents stage form view.""" + self.ensure_one() + view = self.env.ref( + "spp_change_request_v2.spp_change_request_documents_form", + raise_if_not_found=False, + ) + return { + "type": "ir.actions.act_window", + "name": self.name, + "res_model": "spp.change.request", + "res_id": self.id, + "view_mode": "form", + "views": [[view.id if view else False, "form"]], + "target": "current", + } def action_goto_details(self): """Navigate to the details stage (replaces breadcrumb via client action).""" diff --git a/spp_change_request_v2/readme/HISTORY.md b/spp_change_request_v2/readme/HISTORY.md index 387d84da..58320fcd 100644 --- a/spp_change_request_v2/readme/HISTORY.md +++ b/spp_change_request_v2/readme/HISTORY.md @@ -1,3 +1,7 @@ +### 19.0.2.0.4 + +- fix(views): route post-submit CRs (pending / approved / applied / rejected) through the stage review form when opened from the list, matching the Edit Details → Upload Documents → Review & Submit breadcrumb workflow used for fresh CRs (#920 round-2). Demo-generated CRs in "Applied" state previously landed on the legacy main form view from the list — now they open in `spp_change_request_review_form` like manually-created CRs. Adds the missing `_action_open_review_form` / `_action_open_documents_form` helpers and wires `action="action_open_stage_form" type="object"` on the CR list so row-click goes through the stage router. + ### 19.0.2.0.3 - fix: add HTML escaping to all computed Html fields with `sanitize=False` to prevent stored XSS (#50) diff --git a/spp_change_request_v2/static/description/index.html b/spp_change_request_v2/static/description/index.html index f8bf3e1a..5885da4d 100644 --- a/spp_change_request_v2/static/description/index.html +++ b/spp_change_request_v2/static/description/index.html @@ -1339,26 +1339,41 @@

Changelog

+

19.0.2.0.4

+ +
+

19.0.2.0.3

-
+

19.0.2.0.2

-
+

19.0.2.0.1

  • fix: skip field types before getattr and isolate detail prefetch (#129)
-
+

19.0.2.0.0

  • Initial migration to OpenSPP2
  • diff --git a/spp_change_request_v2/tests/test_stage_navigation.py b/spp_change_request_v2/tests/test_stage_navigation.py index 91fc64b3..2defe31b 100644 --- a/spp_change_request_v2/tests/test_stage_navigation.py +++ b/spp_change_request_v2/tests/test_stage_navigation.py @@ -116,14 +116,16 @@ def test_action_open_stage_form_draft_review(self): cr.action_open_stage_form() def test_action_open_stage_form_pending(self): - """Pending CR opens main form (not stage form).""" + """Pending CR opens the Review & Submit stage form so post-submit + states share the breadcrumb-based UI with draft / revision.""" cr = self._create_cr() cr.approval_state = "pending" result = cr.action_open_stage_form() self.assertEqual(result["type"], "ir.actions.act_window") self.assertEqual(result["res_model"], "spp.change.request") self.assertEqual(result["res_id"], cr.id) - self.assertEqual(result["views"], [[False, "form"]]) + review_view = self.env.ref("spp_change_request_v2.spp_change_request_review_form") + self.assertEqual(result["views"], [[review_view.id, "form"]]) def test_action_start_over_creates_new_cr(self): """action_start_over() creates a new CR with same type and registrant.""" diff --git a/spp_change_request_v2/views/change_request_views.xml b/spp_change_request_v2/views/change_request_views.xml index 1e5f1927..ba441e57 100644 --- a/spp_change_request_v2/views/change_request_views.xml +++ b/spp_change_request_v2/views/change_request_views.xml @@ -13,6 +13,8 @@ decoration-warning="display_state == 'revision'" create="0" sample="1" + action="action_open_stage_form" + type="object" >