Skip to content

Commit e6db9de

Browse files
committed
merge: re-resolve spp_change_request_v2 conflict after PR 202 landed in 19.0 — bump to 19.0.2.0.7
2 parents b52b805 + e3eae92 commit e6db9de

10 files changed

Lines changed: 138 additions & 28 deletions

File tree

spp_base_common/__manifest__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@
3838
"spp_base_common/static/src/xml/custom_list_create_template.xml",
3939
"spp_base_common/static/src/js/filterable_radio_field.js",
4040
"spp_base_common/static/src/xml/filterable_radio_field.xml",
41+
"spp_base_common/static/src/xml/pager_hide_single.xml",
42+
"spp_base_common/static/src/scss/pager_hide_single.scss",
4143
],
4244
"web._assets_primary_variables": [
4345
"spp_base_common/static/src/scss/colors.scss",
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// See OP#920 + spp_base_common/static/src/xml/pager_hide_single.xml.
2+
// The control-panel right-side toolbar (refresh button, embedded
3+
// actions, view switcher) had no vertical alignment of its own — it
4+
// relied on the pager's h-100 nav to anchor the row's height.
5+
// Once the pager is hidden, those siblings collapse to top-aligned.
6+
// Set align-items: center explicitly so they stay vertically centred
7+
// whether the pager is visible or not.
8+
.o_control_panel_navigation {
9+
align-items: center;
10+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<!--
3+
Hide the form-view "1/1" pager when there's only one record to navigate.
4+
5+
The standard web.Pager renders the counter + chevrons even when
6+
`total === 1`, leaving a disabled "1/1 < >" widget that confuses
7+
users. We drop the entire <nav> with `t-if` and pair the change
8+
with an `align-items: center` rule on the parent
9+
`o_control_panel_navigation` (see pager_hide_single.scss) so the
10+
sibling refresh button stays vertically centred without the
11+
pager's old h-100 anchor. `1/1+` (updateTotal set) stays visible
12+
because the count may still grow.
13+
14+
See OP#920.
15+
-->
16+
<templates xml:space="preserve">
17+
<t
18+
t-name="spp_base_common.PagerHideSingle"
19+
t-inherit="web.Pager"
20+
t-inherit-mode="extension"
21+
>
22+
<xpath expr="//nav[hasclass('o_pager')]" position="attributes">
23+
<attribute name="t-if">props.total &gt; 1 or props.updateTotal</attribute>
24+
</xpath>
25+
</t>
26+
</templates>

spp_change_request_v2/README.rst

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -853,7 +853,7 @@ Before declaring a new CR type complete:
853853
Changelog
854854
=========
855855

856-
19.0.2.0.6
856+
19.0.2.0.7
857857
~~~~~~~~~~
858858

859859
- fix(security): align CR Requestor / CR Local Validator / CR HQ
@@ -864,6 +864,20 @@ Changelog
864864
visibility once the menu root is gated. Adds ``spp_hazard`` to module
865865
dependencies.
866866

867+
19.0.2.0.6
868+
~~~~~~~~~~
869+
870+
- fix(views): route post-submit CRs (pending / approved / applied /
871+
rejected) through the stage review form when opened from the list,
872+
matching the Edit Details → Upload Documents → Review & Submit
873+
breadcrumb workflow used for fresh CRs (#920 round-2). Demo-generated
874+
CRs in "Applied" state previously landed on the legacy main form view
875+
from the list — now they open in ``spp_change_request_review_form``
876+
like manually-created CRs. Adds the missing
877+
``_action_open_review_form`` / ``_action_open_documents_form`` helpers
878+
and wires ``action="action_open_stage_form" type="object"`` on the CR
879+
list so row-click goes through the stage router.
880+
867881
19.0.2.0.5
868882
~~~~~~~~~~
869883

spp_change_request_v2/__manifest__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "OpenSPP Change Request V2",
3-
"version": "19.0.2.0.6",
3+
"version": "19.0.2.0.7",
44
"sequence": 50,
55
"category": "OpenSPP",
66
"summary": "Configuration-driven change request system with UX improvements, conflict detection and duplicate prevention",

spp_change_request_v2/models/change_request.py

Lines changed: 53 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,6 +1018,7 @@ def _on_submit(self):
10181018
action = "resubmitted" if old_state == "revision" else "submitted"
10191019
self._create_audit_event("submitted", old_state, "pending")
10201020
self._create_log(action)
1021+
self.stage = "review"
10211022

10221023
def _on_request_revision(self, notes):
10231024
super()._on_request_revision(notes)
@@ -1523,29 +1524,63 @@ def action_upload_document(self):
15231524
def action_open_stage_form(self):
15241525
"""Open the appropriate form view based on the current stage.
15251526
1526-
For draft/revision CRs: routes to the stage-specific form.
1527-
For other states: opens the main CR form (for validators/managers).
1527+
- **Draft / revision**: route by `stage` to the editable stage form
1528+
(details / documents / review).
1529+
- **Submitted+ (pending, approved, applied, rejected)**: always open
1530+
the review-stage form. That form already renders state-aware
1531+
headers (Approve/Reject for validators, Apply for managers,
1532+
Applied ribbon for completed, Start Over for rejected) and shows
1533+
the same Edit Details → Upload Documents → Review & Submit
1534+
breadcrumb. Without this, validators/managers (and demo-applied
1535+
CRs opened from the list) landed on the legacy main form view
1536+
which lacks the breadcrumb and the pager-hide treatment. See
1537+
OP#920 round-2.
15281538
"""
15291539
self.ensure_one()
15301540

1531-
if self.approval_state not in ("draft", "revision"):
1532-
return {
1533-
"type": "ir.actions.act_window",
1534-
"name": self.name,
1535-
"res_model": "spp.change.request",
1536-
"res_id": self.id,
1537-
"view_mode": "form",
1538-
"views": [[False, "form"]],
1539-
"target": "current",
1540-
}
1541+
if self.approval_state in ("draft", "revision"):
1542+
if self.stage == "documents":
1543+
return self._action_open_documents_form()
1544+
if self.stage == "review":
1545+
return self._action_open_review_form()
1546+
return self.action_open_detail()
1547+
1548+
# pending / approved / applied / rejected
1549+
return self._action_open_review_form()
15411550

1542-
if self.stage == "documents":
1543-
return self._action_open_documents_form()
1544-
if self.stage == "review":
1545-
return self._action_open_review_form()
1551+
def _action_open_review_form(self):
1552+
"""Open the CR in the Review & Submit stage form view."""
1553+
self.ensure_one()
1554+
view = self.env.ref(
1555+
"spp_change_request_v2.spp_change_request_review_form",
1556+
raise_if_not_found=False,
1557+
)
1558+
return {
1559+
"type": "ir.actions.act_window",
1560+
"name": self.name,
1561+
"res_model": "spp.change.request",
1562+
"res_id": self.id,
1563+
"view_mode": "form",
1564+
"views": [[view.id if view else False, "form"]],
1565+
"target": "current",
1566+
}
15461567

1547-
# Default: details stage
1548-
return self.action_open_detail()
1568+
def _action_open_documents_form(self):
1569+
"""Open the CR in the Upload Documents stage form view."""
1570+
self.ensure_one()
1571+
view = self.env.ref(
1572+
"spp_change_request_v2.spp_change_request_documents_form",
1573+
raise_if_not_found=False,
1574+
)
1575+
return {
1576+
"type": "ir.actions.act_window",
1577+
"name": self.name,
1578+
"res_model": "spp.change.request",
1579+
"res_id": self.id,
1580+
"view_mode": "form",
1581+
"views": [[view.id if view else False, "form"]],
1582+
"target": "current",
1583+
}
15491584

15501585
def action_goto_details(self):
15511586
"""Navigate to the details stage (replaces breadcrumb via client action)."""

spp_change_request_v2/readme/HISTORY.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1-
### 19.0.2.0.6
1+
### 19.0.2.0.7
22

33
- fix(security): align CR Requestor / CR Local Validator / CR HQ Validator roles with the OP#951 menu audit — replace the `spp_registry.group_registry_read` (Tier-3, no menu) link with `spp_registry.group_registry_viewer` so these roles see the Registry menu; add `spp_hazard.group_hazard_viewer` so they retain Hazard visibility once the menu root is gated. Adds `spp_hazard` to module dependencies.
44

5+
### 19.0.2.0.6
6+
7+
- 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.
8+
59
### 19.0.2.0.5
610

711
- fix(security): add a global `ir.rule` on `spp.change.request` that filters by `registrant_id.area_id` against the user's `center_area_ids` (OP#989 round-2). The earlier `_prepare_domain` override only caught `search_read` / `web_search_read` and missed the registrant Many2one picker (which uses `name_search``_search`), so users could still select out-of-area registrants. The conditional domain is a no-op for users with no center areas (global roles).

spp_change_request_v2/static/description/index.html

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1339,7 +1339,7 @@ <h2>Changelog</h2>
13391339
</div>
13401340
</div>
13411341
<div class="section" id="section-1">
1342-
<h1>19.0.2.0.6</h1>
1342+
<h1>19.0.2.0.7</h1>
13431343
<ul class="simple">
13441344
<li>fix(security): align CR Requestor / CR Local Validator / CR HQ
13451345
Validator roles with the OP#951 menu audit — replace the
@@ -1351,6 +1351,21 @@ <h1>19.0.2.0.6</h1>
13511351
</ul>
13521352
</div>
13531353
<div class="section" id="section-2">
1354+
<h1>19.0.2.0.6</h1>
1355+
<ul class="simple">
1356+
<li>fix(views): route post-submit CRs (pending / approved / applied /
1357+
rejected) through the stage review form when opened from the list,
1358+
matching the Edit Details → Upload Documents → Review &amp; Submit
1359+
breadcrumb workflow used for fresh CRs (#920 round-2). Demo-generated
1360+
CRs in “Applied” state previously landed on the legacy main form view
1361+
from the list — now they open in <tt class="docutils literal">spp_change_request_review_form</tt>
1362+
like manually-created CRs. Adds the missing
1363+
<tt class="docutils literal">_action_open_review_form</tt> / <tt class="docutils literal">_action_open_documents_form</tt> helpers
1364+
and wires <tt class="docutils literal"><span class="pre">action=&quot;action_open_stage_form&quot;</span> <span class="pre">type=&quot;object&quot;</span></tt> on the CR
1365+
list so row-click goes through the stage router.</li>
1366+
</ul>
1367+
</div>
1368+
<div class="section" id="section-3">
13541369
<h1>19.0.2.0.5</h1>
13551370
<ul class="simple">
13561371
<li>fix(security): add a global <tt class="docutils literal">ir.rule</tt> on <tt class="docutils literal">spp.change.request</tt> that
@@ -1363,27 +1378,27 @@ <h1>19.0.2.0.5</h1>
13631378
roles).</li>
13641379
</ul>
13651380
</div>
1366-
<div class="section" id="section-3">
1381+
<div class="section" id="section-4">
13671382
<h1>19.0.2.0.3</h1>
13681383
<ul class="simple">
13691384
<li>fix: add HTML escaping to all computed Html fields with
13701385
<tt class="docutils literal">sanitize=False</tt> to prevent stored XSS (#50)</li>
13711386
</ul>
13721387
</div>
1373-
<div class="section" id="section-4">
1388+
<div class="section" id="section-5">
13741389
<h1>19.0.2.0.2</h1>
13751390
<ul class="simple">
13761391
<li>fix: fix batch approval wizard line deletion (#130)</li>
13771392
</ul>
13781393
</div>
1379-
<div class="section" id="section-5">
1394+
<div class="section" id="section-6">
13801395
<h1>19.0.2.0.1</h1>
13811396
<ul class="simple">
13821397
<li>fix: skip field types before getattr and isolate detail prefetch
13831398
(#129)</li>
13841399
</ul>
13851400
</div>
1386-
<div class="section" id="section-6">
1401+
<div class="section" id="section-7">
13871402
<h1>19.0.2.0.0</h1>
13881403
<ul class="simple">
13891404
<li>Initial migration to OpenSPP2</li>

spp_change_request_v2/tests/test_stage_navigation.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,14 +116,16 @@ def test_action_open_stage_form_draft_review(self):
116116
cr.action_open_stage_form()
117117

118118
def test_action_open_stage_form_pending(self):
119-
"""Pending CR opens main form (not stage form)."""
119+
"""Pending CR opens the Review & Submit stage form so post-submit
120+
states share the breadcrumb-based UI with draft / revision."""
120121
cr = self._create_cr()
121122
cr.approval_state = "pending"
122123
result = cr.action_open_stage_form()
123124
self.assertEqual(result["type"], "ir.actions.act_window")
124125
self.assertEqual(result["res_model"], "spp.change.request")
125126
self.assertEqual(result["res_id"], cr.id)
126-
self.assertEqual(result["views"], [[False, "form"]])
127+
review_view = self.env.ref("spp_change_request_v2.spp_change_request_review_form")
128+
self.assertEqual(result["views"], [[review_view.id, "form"]])
127129

128130
def test_action_start_over_creates_new_cr(self):
129131
"""action_start_over() creates a new CR with same type and registrant."""

spp_change_request_v2/views/change_request_views.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
decoration-warning="display_state == 'revision'"
1414
create="0"
1515
sample="1"
16+
action="action_open_stage_form"
17+
type="object"
1618
>
1719
<field name="name" decoration-bf="1" />
1820
<field name="request_type_id" />

0 commit comments

Comments
 (0)