Skip to content

Commit 1f06116

Browse files
authored
Merge pull request #48 from OpenSPP/fix/ci-failures-19.0
fix: resolve CI failures on 19.0 branch
2 parents 3258a93 + 99b9369 commit 1f06116

12 files changed

Lines changed: 224 additions & 214 deletions

File tree

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ faker
88
fastapi>=0.110.0
99
geojson
1010
httpx
11+
jwcrypto
1112
numpy>=1.22.2
1213
openpyxl
1314
parse-accept-language

spp_change_request_v2/tests/test_ux_wizards.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -88,17 +88,18 @@ def test_wizard_create_draft_success(self):
8888

8989
result = wizard.action_create_draft()
9090

91-
# Should return action to open a form
92-
self.assertEqual(result["type"], "ir.actions.act_window")
93-
self.assertTrue(result["res_id"])
94-
self.assertEqual(result["target"], "current")
91+
# Should return client action that closes modal then opens form
92+
self.assertEqual(result["type"], "ir.actions.client")
93+
self.assertEqual(result["tag"], "open_cr_close_modal")
94+
params = result["params"]
95+
self.assertTrue(params["res_id"])
9596

9697
# If CR type has a detail model, wizard opens detail form directly
9798
# Otherwise, it falls back to CR form
9899
if cr_type.detail_model:
99100
# Opened detail form
100-
self.assertEqual(result["res_model"], cr_type.detail_model)
101-
detail = self.env[cr_type.detail_model].browse(result["res_id"])
101+
self.assertEqual(params["res_model"], cr_type.detail_model)
102+
detail = self.env[cr_type.detail_model].browse(params["res_id"])
102103
self.assertTrue(detail.exists())
103104
# Verify the CR was created and linked
104105
cr = detail.change_request_id
@@ -108,8 +109,8 @@ def test_wizard_create_draft_success(self):
108109
self.assertEqual(cr.approval_state, "draft")
109110
else:
110111
# Opened CR form (fallback)
111-
self.assertEqual(result["res_model"], "spp.change.request")
112-
cr = self.env["spp.change.request"].browse(result["res_id"])
112+
self.assertEqual(params["res_model"], "spp.change.request")
113+
cr = self.env["spp.change.request"].browse(params["res_id"])
113114
self.assertTrue(cr.exists())
114115
self.assertEqual(cr.request_type_id, cr_type)
115116
self.assertEqual(cr.registrant_id, self.group)

spp_change_request_v2/wizards/create_wizard.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,12 @@ def action_create_draft(self):
223223
if target == "group" and not is_group:
224224
raise UserError(_("This request type requires a group registrant, not an individual."))
225225

226+
# Resolve translated strings while the ORM environment is available.
227+
# Calling _() inside a return dict can fail when the cursor context
228+
# is no longer reachable from the call stack.
229+
detail_form_name = _("Change Request Details")
230+
cr_form_name = _("Change Request")
231+
226232
# Create the draft CR (this auto-creates the detail record)
227233
cr = self.env["spp.change.request"].create(
228234
{
@@ -241,7 +247,7 @@ def action_create_draft(self):
241247
"type": "ir.actions.client",
242248
"tag": "open_cr_close_modal",
243249
"params": {
244-
"name": _("Change Request Details"),
250+
"name": detail_form_name,
245251
"res_model": cr.detail_res_model,
246252
"res_id": detail.id,
247253
"view_id": view_id,
@@ -258,7 +264,7 @@ def action_create_draft(self):
258264
"type": "ir.actions.client",
259265
"tag": "open_cr_close_modal",
260266
"params": {
261-
"name": _("Change Request"),
267+
"name": cr_form_name,
262268
"res_model": "spp.change.request",
263269
"res_id": cr.id,
264270
"context": {

spp_claim_169/__manifest__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
"qrcode",
2424
"Pillow",
2525
"claim169",
26+
"jwcrypto",
2627
],
2728
},
2829
"data": [
Lines changed: 46 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?xml version="1.0" encoding="utf-8"?>
1+
<?xml version="1.0" encoding="utf-8" ?>
22
<odoo noupdate="1">
33
<!--
44
GIS Report Demo Data for DRIMS Sri Lanka Demo
@@ -11,20 +11,24 @@
1111
<record id="gis_report_request_distribution" model="spp.gis.report">
1212
<field name="name">Relief Request Distribution</field>
1313
<field name="code">DRIMS_SL_REQUEST_DIST</field>
14-
<field name="description">Geographic distribution of disaster relief requests. Shows which areas have the most pending or active requests to help coordinate response efforts.</field>
15-
<field name="category_id" ref="spp_gis_report.category_disaster_response"/>
14+
<field
15+
name="description"
16+
>Geographic distribution of disaster relief requests. Shows which areas have the most pending or active requests to help coordinate response efforts.</field>
17+
<field name="category_id" ref="spp_gis_report.category_disaster_response" />
1618
<field name="sequence">10</field>
17-
<field name="source_model_id" search="[('model', '=', 'spp.drims.request')]"/>
19+
<field name="source_model_id" search="[('model', '=', 'spp.drims.request')]" />
1820
<field name="area_field_path">destination_area_id</field>
1921
<field name="filter_mode">domain</field>
20-
<field name="filter_domain">[('state', 'not in', ['draft', 'cancelled'])]</field>
22+
<field
23+
name="filter_domain"
24+
>[('state', 'not in', ['draft', 'cancelled'])]</field>
2125
<field name="aggregation_method">count</field>
2226
<field name="base_area_level">1</field>
2327
<field name="normalization_method">raw</field>
2428
<field name="enable_rollup">True</field>
2529
<field name="rollup_method">sum</field>
2630
<field name="rollup_weight_source">count</field>
27-
<field name="color_scheme_id" ref="spp_gis.scheme_viridis"/>
31+
<field name="color_scheme_id" ref="spp_gis.scheme_viridis" />
2832
<field name="threshold_mode">auto_quartile</field>
2933
<field name="bucket_count">5</field>
3034
<field name="refresh_mode">scheduled</field>
@@ -37,21 +41,25 @@
3741
<record id="gis_report_affected_population" model="spp.gis.report">
3842
<field name="name">Affected Population by Area</field>
3943
<field name="code">DRIMS_SL_AFFECTED_POP</field>
40-
<field name="description">Total affected population as reported in disaster relief requests. Helps prioritize areas with the highest number of people in need of assistance.</field>
41-
<field name="category_id" ref="spp_gis_report.category_disaster_response"/>
44+
<field
45+
name="description"
46+
>Total affected population as reported in disaster relief requests. Helps prioritize areas with the highest number of people in need of assistance.</field>
47+
<field name="category_id" ref="spp_gis_report.category_disaster_response" />
4248
<field name="sequence">20</field>
43-
<field name="source_model_id" search="[('model', '=', 'spp.drims.request')]"/>
49+
<field name="source_model_id" search="[('model', '=', 'spp.drims.request')]" />
4450
<field name="area_field_path">destination_area_id</field>
4551
<field name="filter_mode">domain</field>
46-
<field name="filter_domain">[('state', 'not in', ['draft', 'cancelled', 'rejected'])]</field>
52+
<field
53+
name="filter_domain"
54+
>[('state', 'not in', ['draft', 'cancelled', 'rejected'])]</field>
4755
<field name="aggregation_method">sum</field>
4856
<field name="aggregation_field">affected_population</field>
4957
<field name="base_area_level">1</field>
5058
<field name="normalization_method">per_area_sqkm</field>
5159
<field name="enable_rollup">True</field>
5260
<field name="rollup_method">sum</field>
5361
<field name="rollup_weight_source">count</field>
54-
<field name="color_scheme_id" ref="spp_gis.scheme_blues"/>
62+
<field name="color_scheme_id" ref="spp_gis.scheme_blues" />
5563
<field name="threshold_mode">auto_jenks</field>
5664
<field name="bucket_count">5</field>
5765
<field name="refresh_mode">scheduled</field>
@@ -64,20 +72,24 @@
6472
<record id="gis_report_pending_requests" model="spp.gis.report">
6573
<field name="name">Pending Approval Requests</field>
6674
<field name="code">DRIMS_SL_PENDING_REQUESTS</field>
67-
<field name="description">Requests awaiting approval by geographic area. Highlights areas where response coordination needs attention to ensure timely relief delivery.</field>
68-
<field name="category_id" ref="spp_gis_report.category_disaster_response"/>
75+
<field
76+
name="description"
77+
>Requests awaiting approval by geographic area. Highlights areas where response coordination needs attention to ensure timely relief delivery.</field>
78+
<field name="category_id" ref="spp_gis_report.category_disaster_response" />
6979
<field name="sequence">30</field>
70-
<field name="source_model_id" search="[('model', '=', 'spp.drims.request')]"/>
80+
<field name="source_model_id" search="[('model', '=', 'spp.drims.request')]" />
7181
<field name="area_field_path">destination_area_id</field>
7282
<field name="filter_mode">domain</field>
73-
<field name="filter_domain">[('approval_state', 'in', ['pending', 'submitted'])]</field>
83+
<field
84+
name="filter_domain"
85+
>[('approval_state', 'in', ['pending', 'submitted'])]</field>
7486
<field name="aggregation_method">count</field>
7587
<field name="base_area_level">1</field>
7688
<field name="normalization_method">raw</field>
7789
<field name="enable_rollup">True</field>
7890
<field name="rollup_method">sum</field>
7991
<field name="rollup_weight_source">count</field>
80-
<field name="color_scheme_id" ref="spp_gis.scheme_viridis"/>
92+
<field name="color_scheme_id" ref="spp_gis.scheme_viridis" />
8193
<field name="threshold_mode">auto_quartile</field>
8294
<field name="bucket_count">4</field>
8395
<field name="refresh_mode">scheduled</field>
@@ -90,21 +102,25 @@
90102
<record id="gis_report_relief_value" model="spp.gis.report">
91103
<field name="name">Total Relief Value by Area</field>
92104
<field name="code">DRIMS_SL_RELIEF_VALUE</field>
93-
<field name="description">Cumulative value of relief supplies requested by area. Helps track resource distribution and identify areas with high material needs.</field>
94-
<field name="category_id" ref="spp_gis_report.category_disaster_response"/>
105+
<field
106+
name="description"
107+
>Cumulative value of relief supplies requested by area. Helps track resource distribution and identify areas with high material needs.</field>
108+
<field name="category_id" ref="spp_gis_report.category_disaster_response" />
95109
<field name="sequence">40</field>
96-
<field name="source_model_id" search="[('model', '=', 'spp.drims.request')]"/>
110+
<field name="source_model_id" search="[('model', '=', 'spp.drims.request')]" />
97111
<field name="area_field_path">destination_area_id</field>
98112
<field name="filter_mode">domain</field>
99-
<field name="filter_domain">[('state', 'not in', ['draft', 'cancelled', 'rejected'])]</field>
113+
<field
114+
name="filter_domain"
115+
>[('state', 'not in', ['draft', 'cancelled', 'rejected'])]</field>
100116
<field name="aggregation_method">sum</field>
101117
<field name="aggregation_field">total_value</field>
102118
<field name="base_area_level">1</field>
103119
<field name="normalization_method">raw</field>
104120
<field name="enable_rollup">True</field>
105121
<field name="rollup_method">sum</field>
106122
<field name="rollup_weight_source">count</field>
107-
<field name="color_scheme_id" ref="spp_gis.scheme_viridis"/>
123+
<field name="color_scheme_id" ref="spp_gis.scheme_viridis" />
108124
<field name="threshold_mode">auto_quartile</field>
109125
<field name="bucket_count">5</field>
110126
<field name="refresh_mode">scheduled</field>
@@ -117,27 +133,30 @@
117133
<record id="gis_report_fulfillment_progress" model="spp.gis.report">
118134
<field name="name">Request Fulfillment Progress</field>
119135
<field name="code">DRIMS_SL_FULFILLMENT_PCT</field>
120-
<field name="description">Average fulfillment percentage of relief requests by area. Identifies areas where delivery is lagging and additional logistics support may be needed.</field>
121-
<field name="category_id" ref="spp_gis_report.category_disaster_response"/>
136+
<field
137+
name="description"
138+
>Average fulfillment percentage of relief requests by area. Identifies areas where delivery is lagging and additional logistics support may be needed.</field>
139+
<field name="category_id" ref="spp_gis_report.category_disaster_response" />
122140
<field name="sequence">50</field>
123-
<field name="source_model_id" search="[('model', '=', 'spp.drims.request')]"/>
141+
<field name="source_model_id" search="[('model', '=', 'spp.drims.request')]" />
124142
<field name="area_field_path">destination_area_id</field>
125143
<field name="filter_mode">domain</field>
126-
<field name="filter_domain">[('state', 'not in', ['draft', 'cancelled', 'rejected'])]</field>
144+
<field
145+
name="filter_domain"
146+
>[('state', 'not in', ['draft', 'cancelled', 'rejected'])]</field>
127147
<field name="aggregation_method">avg</field>
128148
<field name="aggregation_field">fulfillment_pct</field>
129149
<field name="base_area_level">1</field>
130150
<field name="normalization_method">raw</field>
131151
<field name="enable_rollup">True</field>
132152
<field name="rollup_method">weighted_avg</field>
133153
<field name="rollup_weight_source">count</field>
134-
<field name="color_scheme_id" ref="spp_gis.scheme_viridis"/>
154+
<field name="color_scheme_id" ref="spp_gis.scheme_viridis" />
135155
<field name="threshold_mode">auto_equal</field>
136156
<field name="bucket_count">5</field>
137157
<field name="refresh_mode">scheduled</field>
138158
<field name="refresh_interval">hourly</field>
139159
<field name="auto_create_layer" eval="True" />
140160
<field name="layer_active_on_startup" eval="True" />
141161
</record>
142-
143162
</odoo>

0 commit comments

Comments
 (0)