Skip to content

Commit b52b805

Browse files
committed
merge: resolve conflicts with 19.0 — bump spp_area to .0.2, spp_change_request_v2 to .0.6, spp_programs to .1.3
Stacked OP#951 menu-audit HISTORY entries on top of the OP#989 ir.rule security entries that landed in 19.0 in the interim. spp_area manifest keeps both data/user_roles.xml (this PR) and security/rules.xml (from main). README.rst + index.html updated to match HISTORY.md ordering; CI will canonicalize docutils output.
2 parents cf66199 + b106560 commit b52b805

37 files changed

Lines changed: 1600 additions & 281 deletions

spp_area/README.rst

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,14 +140,25 @@ Dependencies
140140
Changelog
141141
=========
142142

143-
19.0.2.0.1
143+
19.0.2.0.2
144144
~~~~~~~~~~
145145

146146
- fix(security): grant ``group_area_viewer`` (read-only) to
147147
spp_user_roles support roles (Global Support, Global Support Manager,
148148
Local Support) so they can browse area records per the OP#951 menu
149149
audit.
150150

151+
19.0.2.0.1
152+
~~~~~~~~~~
153+
154+
- fix(security): add a global ``ir.rule`` on ``res.partner`` that
155+
filters registrants by ``area_id`` for users with ``center_area_ids``
156+
set (OP#989). Replaces the limited ``search_read`` /
157+
``web_search_read`` override in ``models/registrant.py`` which missed
158+
``name_search`` (Many2one dropdowns), ``search_count``,
159+
``read_group``, and related-field traversal. The rule's conditional
160+
domain is a no-op for users without center areas (global roles).
161+
151162
19.0.2.0.0
152163
~~~~~~~~~~
153164

spp_area/__manifest__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"name": "OpenSPP Area Management",
77
"summary": "Establishes direct associations between OpenSPP registrants, beneficiary groups, and their corresponding geographical administrative areas. It validates registrant-area linkages against official area types, ensuring data integrity and enabling targeted program delivery and analysis.",
88
"category": "OpenSPP/Core",
9-
"version": "19.0.2.0.1",
9+
"version": "19.0.2.0.2",
1010
"sequence": 1,
1111
"author": "OpenSPP.org",
1212
"website": "https://github.com/OpenSPP/OpenSPP2",
@@ -34,6 +34,7 @@
3434
"security/groups.xml",
3535
"security/ir.model.access.csv",
3636
"data/user_roles.xml",
37+
"security/rules.xml",
3738
"wizard/area_import_language_wizard_views.xml",
3839
"views/area_base.xml",
3940
"views/area_tag.xml",

spp_area/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.1
1+
### 19.0.2.0.2
22

33
- fix(security): grant `group_area_viewer` (read-only) to spp_user_roles support roles (Global Support, Global Support Manager, Local Support) so they can browse area records per the OP#951 menu audit.
44

5+
### 19.0.2.0.1
6+
7+
- fix(security): add a global `ir.rule` on `res.partner` that filters registrants by `area_id` for users with `center_area_ids` set (OP#989). Replaces the limited `search_read` / `web_search_read` override in `models/registrant.py` which missed `name_search` (Many2one dropdowns), `search_count`, `read_group`, and related-field traversal. The rule's conditional domain is a no-op for users without center areas (global roles).
8+
59
### 19.0.2.0.0
610

711
- Initial migration to OpenSPP2

spp_area/security/rules.xml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<!--
3+
Part of OpenSPP. See LICENSE file for full copyright and licensing details.
4+
5+
Area-based row-level filtering for registrants (OP#989).
6+
7+
Replaces / strengthens the `_prepare_domain` override in models/registrant.py
8+
which only catches `search_read` / `web_search_read`. An ir.rule applies to
9+
every ORM read path automatically: `search`, `search_count`, `read_group`,
10+
`name_search` (Many2one dropdowns), `read`, and related-field traversal.
11+
12+
The rule is scoped to `is_registrant = True` only — non-registrant contacts
13+
(users' own partners, admins, companies, system bots, mail followers) must
14+
remain readable, otherwise every record using `message_partner_ids` /
15+
`message_follower_ids` blows up for local users with `center_area_ids`.
16+
17+
The conditional domain makes the rule a no-op for users without
18+
`center_area_ids` (global roles).
19+
-->
20+
<odoo noupdate="1">
21+
<record id="rule_res_partner_area_filter" model="ir.rule">
22+
<field name="name">Registrants: visible only within user's center areas</field>
23+
<field name="model_id" ref="base.model_res_partner" />
24+
<field
25+
name="domain_force"
26+
>['|', ('is_registrant', '=', False), ('area_id', 'child_of', user.center_area_ids.ids)] if user.center_area_ids else []</field>
27+
<field name="global" eval="True" />
28+
<field name="perm_read" eval="True" />
29+
<field name="perm_write" eval="True" />
30+
<field name="perm_create" eval="True" />
31+
<field name="perm_unlink" eval="True" />
32+
</record>
33+
</odoo>

spp_area/static/description/index.html

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,7 @@ <h2><a class="toc-backref" href="#toc-entry-1">Changelog</a></h2>
537537
</div>
538538
</div>
539539
<div class="section" id="section-1">
540-
<h1>19.0.2.0.1</h1>
540+
<h1>19.0.2.0.2</h1>
541541
<ul class="simple">
542542
<li>fix(security): grant <tt class="docutils literal">group_area_viewer</tt> (read-only) to
543543
spp_user_roles support roles (Global Support, Global Support Manager,
@@ -546,6 +546,18 @@ <h1>19.0.2.0.1</h1>
546546
</ul>
547547
</div>
548548
<div class="section" id="section-2">
549+
<h1>19.0.2.0.1</h1>
550+
<ul class="simple">
551+
<li>fix(security): add a global <tt class="docutils literal">ir.rule</tt> on <tt class="docutils literal">res.partner</tt> that
552+
filters registrants by <tt class="docutils literal">area_id</tt> for users with <tt class="docutils literal">center_area_ids</tt>
553+
set (OP#989). Replaces the limited <tt class="docutils literal">search_read</tt> /
554+
<tt class="docutils literal">web_search_read</tt> override in <tt class="docutils literal">models/registrant.py</tt> which missed
555+
<tt class="docutils literal">name_search</tt> (Many2one dropdowns), <tt class="docutils literal">search_count</tt>,
556+
<tt class="docutils literal">read_group</tt>, and related-field traversal. The rule’s conditional
557+
domain is a no-op for users without center areas (global roles).</li>
558+
</ul>
559+
</div>
560+
<div class="section" id="section-3">
549561
<h1>19.0.2.0.0</h1>
550562
<ul class="simple">
551563
<li>Initial migration to OpenSPP2</li>

spp_change_request_v2/README.rst

Lines changed: 13 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.4
856+
19.0.2.0.6
857857
~~~~~~~~~~
858858

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

867+
19.0.2.0.5
868+
~~~~~~~~~~
869+
870+
- fix(security): add a global ``ir.rule`` on ``spp.change.request`` that
871+
filters by ``registrant_id.area_id`` against the user's
872+
``center_area_ids`` (OP#989 round-2). The earlier ``_prepare_domain``
873+
override only caught ``search_read`` / ``web_search_read`` and missed
874+
the registrant Many2one picker (which uses ``name_search`` →
875+
``_search``), so users could still select out-of-area registrants. The
876+
conditional domain is a no-op for users with no center areas (global
877+
roles).
878+
867879
19.0.2.0.3
868880
~~~~~~~~~~
869881

spp_change_request_v2/__manifest__.py

Lines changed: 3 additions & 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.4",
3+
"version": "19.0.2.0.6",
44
"sequence": 50,
55
"category": "OpenSPP",
66
"summary": "Configuration-driven change request system with UX improvements, conflict detection and duplicate prevention",
@@ -13,6 +13,7 @@
1313
"mail",
1414
"spp_base_common",
1515
"spp_registry",
16+
"spp_area",
1617
"spp_security",
1718
"spp_approval",
1819
"spp_event_data",
@@ -25,6 +26,7 @@
2526
"security/privileges.xml",
2627
"security/groups.xml",
2728
"security/rules.xml",
29+
"security/area_filter_rules.xml",
2830
"security/ir.model.access.csv",
2931
# Views (loaded before data that references them)
3032
"views/dms_file_views.xml",

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.4
1+
### 19.0.2.0.6
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.5
6+
7+
- 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).
8+
59
### 19.0.2.0.3
610

711
- fix: add HTML escaping to all computed Html fields with `sanitize=False` to prevent stored XSS (#50)
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<!--
3+
Part of OpenSPP. See LICENSE file for full copyright and licensing details.
4+
5+
Area-based row-level filtering for change requests (OP#989).
6+
7+
QA round 1 surfaced that the original `_prepare_domain` override on
8+
`spp.change.request` only caught `search_read` / `web_search_read`. The
9+
registrant picker on the CR form (a Many2one widget) calls `name_search` ->
10+
`_search` and bypasses the override. An ir.rule applies to every ORM read
11+
path automatically, including `name_search`, `search_count`, `read_group`,
12+
and related-field traversal.
13+
14+
Mirrors the conditional domain pattern from `spp_area/security/rules.xml`
15+
so users without `center_area_ids` (global roles) are unaffected. The
16+
module now depends on `spp_area` directly so `user.center_area_ids`
17+
can be referenced without defensive guards.
18+
-->
19+
<odoo noupdate="1">
20+
<record id="rule_spp_change_request_area_filter" model="ir.rule">
21+
<field
22+
name="name"
23+
>Change Request: visible only within user's center areas</field>
24+
<field name="model_id" ref="model_spp_change_request" />
25+
<field
26+
name="domain_force"
27+
>[('registrant_id.area_id', 'child_of', user.center_area_ids.ids)] if user.center_area_ids else []</field>
28+
<field name="global" eval="True" />
29+
<field name="perm_read" eval="True" />
30+
<field name="perm_write" eval="True" />
31+
<field name="perm_create" eval="True" />
32+
<field name="perm_unlink" eval="True" />
33+
</record>
34+
</odoo>

spp_change_request_v2/static/description/index.html

Lines changed: 17 additions & 4 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.4</h1>
1342+
<h1>19.0.2.0.6</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,26 +1351,39 @@ <h1>19.0.2.0.4</h1>
13511351
</ul>
13521352
</div>
13531353
<div class="section" id="section-2">
1354+
<h1>19.0.2.0.5</h1>
1355+
<ul class="simple">
1356+
<li>fix(security): add a global <tt class="docutils literal">ir.rule</tt> on <tt class="docutils literal">spp.change.request</tt> that
1357+
filters by <tt class="docutils literal">registrant_id.area_id</tt> against the user’s
1358+
<tt class="docutils literal">center_area_ids</tt> (OP#989 round-2). The earlier <tt class="docutils literal">_prepare_domain</tt>
1359+
override only caught <tt class="docutils literal">search_read</tt> / <tt class="docutils literal">web_search_read</tt> and missed
1360+
the registrant Many2one picker (which uses <tt class="docutils literal">name_search</tt>
1361+
<tt class="docutils literal">_search</tt>), so users could still select out-of-area registrants. The
1362+
conditional domain is a no-op for users with no center areas (global
1363+
roles).</li>
1364+
</ul>
1365+
</div>
1366+
<div class="section" id="section-3">
13541367
<h1>19.0.2.0.3</h1>
13551368
<ul class="simple">
13561369
<li>fix: add HTML escaping to all computed Html fields with
13571370
<tt class="docutils literal">sanitize=False</tt> to prevent stored XSS (#50)</li>
13581371
</ul>
13591372
</div>
1360-
<div class="section" id="section-3">
1373+
<div class="section" id="section-4">
13611374
<h1>19.0.2.0.2</h1>
13621375
<ul class="simple">
13631376
<li>fix: fix batch approval wizard line deletion (#130)</li>
13641377
</ul>
13651378
</div>
1366-
<div class="section" id="section-4">
1379+
<div class="section" id="section-5">
13671380
<h1>19.0.2.0.1</h1>
13681381
<ul class="simple">
13691382
<li>fix: skip field types before getattr and isolate detail prefetch
13701383
(#129)</li>
13711384
</ul>
13721385
</div>
1373-
<div class="section" id="section-5">
1386+
<div class="section" id="section-6">
13741387
<h1>19.0.2.0.0</h1>
13751388
<ul class="simple">
13761389
<li>Initial migration to OpenSPP2</li>

0 commit comments

Comments
 (0)