Skip to content

Commit 591bcbc

Browse files
fix(lint): resolve pre-commit errors across case and GRM modules
- Replace deprecated <data noupdate="1"> with <odoo noupdate="1"> - Split mixed noupdate XML files into groups + rules files - Add priority=99 to views using position="replace" - Wrap error strings in _() for translation compliance - Fix "OpenSPP" -> "OpenSPP.org" author in manifests - Replace self.name with self.id in log to avoid PII - Apply auto-fixes from prettier, oca-gen-addon-readme, manifest-website
1 parent 6671bf0 commit 591bcbc

75 files changed

Lines changed: 1143 additions & 1184 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

spp_case_base/README.rst

Lines changed: 60 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,14 @@ OpenSPP Case Management Base
1010
!! source digest: sha256:e58edc2517398a8339ded8ff8bf1eb6b07df10f996637a160c55d36dbf41b8a6
1111
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1212
13-
.. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png
14-
:target: https://odoo-community.org/page/development-status
15-
:alt: Alpha
16-
.. |badge2| image:: https://img.shields.io/badge/license-LGPL--3-blue.png
13+
.. |badge1| image:: https://img.shields.io/badge/license-LGPL--3-blue.png
1714
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
1815
:alt: License: LGPL-3
19-
.. |badge3| image:: https://img.shields.io/badge/github-OpenSPP%2Fopenspp--modules-lightgray.png?logo=github
20-
:target: https://github.com/OpenSPP/openspp-modules/tree/19.0/spp_case_base
21-
:alt: OpenSPP/openspp-modules
16+
.. |badge2| image:: https://img.shields.io/badge/github-OpenSPP%2FOpenSPP2-lightgray.png?logo=github
17+
:target: https://github.com/OpenSPP/OpenSPP2/tree/19.0/spp_case_base
18+
:alt: OpenSPP/OpenSPP2
2219

23-
|badge1| |badge2| |badge3|
20+
|badge1| |badge2|
2421

2522
Case management system for social protection programs. Tracks cases from
2623
intake through assessment, intervention planning, and closure with
@@ -45,43 +42,42 @@ Key Capabilities
4542
Key Models
4643
~~~~~~~~~~
4744

48-
+--------------------------------+------------------------------------+
49-
| Model | Description |
50-
+================================+====================================+
51-
| ``spp.case`` | Core case record with client and |
52-
| | assignment |
53-
+--------------------------------+------------------------------------+
54-
| ``spp.case.type`` | Case type with default intensity |
55-
| | and caseload |
56-
+--------------------------------+------------------------------------+
57-
| ``spp.case.stage`` | Workflow stage with phase and |
58-
| | requirements |
59-
+--------------------------------+------------------------------------+
60-
| ``spp.case.assessment`` | Assessment with risk score and |
61-
| | findings |
62-
+--------------------------------+------------------------------------+
63-
| ``spp.case.intervention.plan`` | Versioned plan with approval |
64-
| | workflow |
65-
+--------------------------------+------------------------------------+
66-
| ``spp.case.intervention`` | Individual intervention with |
67-
| | status tracking |
68-
+--------------------------------+------------------------------------+
69-
| ``spp.case.visit`` | Client visit with type and notes |
70-
+--------------------------------+------------------------------------+
71-
| ``spp.case.note`` | Case note with confidentiality |
72-
| | flag |
73-
+--------------------------------+------------------------------------+
74-
| ``spp.case.referral`` | External service referral with |
75-
| | status |
76-
+--------------------------------+------------------------------------+
77-
| ``spp.case.team`` | Team with supervisor and members |
78-
+--------------------------------+------------------------------------+
79-
| ``spp.case.risk.factor`` | Risk factor with severity weight |
80-
+--------------------------------+------------------------------------+
81-
| ``spp.case.vulnerability`` | Vulnerability for assessment |
82-
+--------------------------------+------------------------------------+
83-
| ``spp.case.closure.reason`` | Closure reason with outcome type |
84-
+--------------------------------+------------------------------------+
45+
+--------------------------------+-------------------------------------+
46+
| Model | Description |
47+
+================================+=====================================+
48+
| ``spp.case`` | Core case record with client and |
49+
| | assignment |
50+
+--------------------------------+-------------------------------------+
51+
| ``spp.case.type`` | Case type with default intensity |
52+
| | and caseload |
53+
+--------------------------------+-------------------------------------+
54+
| ``spp.case.stage`` | Workflow stage with phase and |
55+
| | requirements |
56+
+--------------------------------+-------------------------------------+
57+
| ``spp.case.assessment`` | Assessment with risk score and |
58+
| | findings |
59+
+--------------------------------+-------------------------------------+
60+
| ``spp.case.intervention.plan`` | Versioned plan with approval |
61+
| | workflow |
62+
+--------------------------------+-------------------------------------+
63+
| ``spp.case.intervention`` | Individual intervention with status |
64+
| | tracking |
65+
+--------------------------------+-------------------------------------+
66+
| ``spp.case.visit`` | Client visit with type and notes |
67+
+--------------------------------+-------------------------------------+
68+
| ``spp.case.note`` | Case note with confidentiality flag |
69+
+--------------------------------+-------------------------------------+
70+
| ``spp.case.referral`` | External service referral with |
71+
| | status |
72+
+--------------------------------+-------------------------------------+
73+
| ``spp.case.team`` | Team with supervisor and members |
74+
+--------------------------------+-------------------------------------+
75+
| ``spp.case.risk.factor`` | Risk factor with severity weight |
76+
+--------------------------------+-------------------------------------+
77+
| ``spp.case.vulnerability`` | Vulnerability for assessment |
78+
+--------------------------------+-------------------------------------+
79+
| ``spp.case.closure.reason`` | Closure reason with outcome type |
80+
+--------------------------------+-------------------------------------+
8581

8682
Configuration
8783
~~~~~~~~~~~~~
@@ -144,10 +140,6 @@ Dependencies
144140

145141
``base``, ``mail``, ``portal``, ``spp_security``
146142

147-
.. IMPORTANT::
148-
This is an alpha version, the data model and design can change at any time without warning.
149-
Only for development or testing purpose, do not use in production.
150-
151143
**Table of contents**
152144

153145
.. contents::
@@ -156,10 +148,10 @@ Dependencies
156148
Bug Tracker
157149
===========
158150

159-
Bugs are tracked on `GitHub Issues <https://github.com/OpenSPP/openspp-modules/issues>`_.
151+
Bugs are tracked on `GitHub Issues <https://github.com/OpenSPP/OpenSPP2/issues>`_.
160152
In case of trouble, please check there if your issue has already been reported.
161153
If you spotted it first, help us to smash it by providing a detailed and welcomed
162-
`feedback <https://github.com/OpenSPP/openspp-modules/issues/new?body=module:%20spp_case_base%0Aversion:%2019.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
154+
`feedback <https://github.com/OpenSPP/OpenSPP2/issues/new?body=module:%20spp_case_base%0Aversion:%2019.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
163155

164156
Do not contact contributors directly about support or help with technical issues.
165157

@@ -169,11 +161,25 @@ Credits
169161
Authors
170162
-------
171163

172-
* OpenSPP
164+
* OpenSPP.org
173165

174166
Maintainers
175167
-----------
176168

177-
This module is part of the `OpenSPP/openspp-modules <https://github.com/OpenSPP/openspp-modules/tree/19.0/spp_case_base>`_ project on GitHub.
169+
.. |maintainer-jeremi| image:: https://github.com/jeremi.png?size=40px
170+
:target: https://github.com/jeremi
171+
:alt: jeremi
172+
.. |maintainer-gonzalesedwin1123| image:: https://github.com/gonzalesedwin1123.png?size=40px
173+
:target: https://github.com/gonzalesedwin1123
174+
:alt: gonzalesedwin1123
175+
.. |maintainer-emjay0921| image:: https://github.com/emjay0921.png?size=40px
176+
:target: https://github.com/emjay0921
177+
:alt: emjay0921
178+
179+
Current maintainers:
180+
181+
|maintainer-jeremi| |maintainer-gonzalesedwin1123| |maintainer-emjay0921|
182+
183+
This module is part of the `OpenSPP/OpenSPP2 <https://github.com/OpenSPP/OpenSPP2/tree/19.0/spp_case_base>`_ project on GitHub.
178184

179-
You are welcome to contribute.
185+
You are welcome to contribute.

spp_case_base/__manifest__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
"version": "19.0.1.0.0",
55
"category": "OpenSPP/Monitoring",
66
"summary": "Core case management functionality for OpenSPP",
7-
"author": "OpenSPP",
8-
"website": "https://github.com/OpenSPP/openspp-modules",
7+
"author": "OpenSPP.org",
8+
"website": "https://github.com/OpenSPP/OpenSPP2",
99
"license": "LGPL-3",
1010
"development_status": "Stable",
1111
"maintainers": ["jeremi", "gonzalesedwin1123", "emjay0921"],

spp_case_base/data/ir_cron.xml

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
<?xml version="1.0" encoding="utf-8" ?>
2-
<odoo>
3-
<data noupdate="1">
4-
<record id="cron_check_case_reviews" model="ir.cron">
5-
<field name="name">Case Management: Check Review Schedules</field>
6-
<field name="model_id" ref="model_spp_case" />
7-
<field name="state">code</field>
8-
<field name="code">model._cron_check_reviews()</field>
9-
<field name="interval_number">1</field>
10-
<field name="interval_type">days</field>
11-
<field name="active" eval="True" />
12-
</record>
13-
</data>
2+
<odoo noupdate="1">
3+
<record id="cron_check_case_reviews" model="ir.cron">
4+
<field name="name">Case Management: Check Review Schedules</field>
5+
<field name="model_id" ref="model_spp_case" />
6+
<field name="state">code</field>
7+
<field name="code">model._cron_check_reviews()</field>
8+
<field name="interval_number">1</field>
9+
<field name="interval_type">days</field>
10+
<field name="active" eval="True" />
11+
</record>
1412
</odoo>

spp_case_base/models/case.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -397,21 +397,27 @@ def _check_stage_requirements(self):
397397

398398
# Check if plan is required
399399
if case.stage_id.is_requires_plan and not case.has_active_plan:
400-
raise ValidationError(f"Stage '{case.stage_id.name}' requires an approved intervention plan.")
400+
raise ValidationError(
401+
_("Stage '%(stage)s' requires an approved intervention plan.", stage=case.stage_id.name)
402+
)
401403

402404
# Check minimum intensity level
403405
if case.stage_id.min_intensity:
404406
if int(case.intensity_level) < int(case.stage_id.min_intensity):
405407
raise ValidationError(
406-
f"Stage '{case.stage_id.name}' requires minimum intensity level {case.stage_id.min_intensity}."
408+
_(
409+
"Stage '%(stage)s' requires minimum intensity level %(level)s.",
410+
stage=case.stage_id.name,
411+
level=case.stage_id.min_intensity,
412+
)
407413
)
408414

409415
def action_close_case(self):
410416
"""Close the case."""
411417
self.ensure_one()
412418
closed_stage = self.env["spp.case.stage"].search([("is_closed", "=", True)], limit=1)
413419
if not closed_stage:
414-
raise ValidationError("No closed stage found. Please configure a closed stage.")
420+
raise ValidationError(_("No closed stage found. Please configure a closed stage."))
415421
self.write(
416422
{
417423
"stage_id": closed_stage.id,
@@ -425,7 +431,7 @@ def action_reopen_case(self):
425431
self.ensure_one()
426432
intake_stage = self.env["spp.case.stage"].search([("phase", "=", "intake"), ("is_closed", "=", False)], limit=1)
427433
if not intake_stage:
428-
raise ValidationError("No intake stage found. Please configure an intake stage.")
434+
raise ValidationError(_("No intake stage found. Please configure an intake stage."))
429435
self.write(
430436
{
431437
"stage_id": intake_stage.id,

spp_case_base/models/case_assessment.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""Case Assessment Model."""
22

3-
from odoo import api, fields, models
3+
from odoo import _, api, fields, models
44
from odoo.exceptions import UserError
55

66

@@ -194,13 +194,13 @@ def _check_risk_score(self):
194194
"""Validate risk score is between 0 and 100."""
195195
for assessment in self:
196196
if assessment.risk_score and (assessment.risk_score < 0 or assessment.risk_score > 100):
197-
raise UserError("Risk score must be between 0 and 100.")
197+
raise UserError(_("Risk score must be between 0 and 100."))
198198

199199
def action_complete(self):
200200
"""Move assessment from draft to completed."""
201201
for assessment in self:
202202
if assessment.state != "draft":
203-
raise UserError("Only draft assessments can be completed.")
203+
raise UserError(_("Only draft assessments can be completed."))
204204
assessment.write({"state": "completed"})
205205
return True
206206

@@ -211,12 +211,12 @@ def action_review(self):
211211
"""
212212
for assessment in self:
213213
if assessment.state != "completed":
214-
raise UserError("Only completed assessments can be reviewed.")
214+
raise UserError(_("Only completed assessments can be reviewed."))
215215

216216
# Check if current user is a supervisor
217217
supervisor_group = self.env.ref("spp_case_base.group_case_supervisor", raise_if_not_found=False)
218218
if supervisor_group and supervisor_group not in self.env.user.group_ids:
219-
raise UserError("Only supervisors can review assessments.")
219+
raise UserError(_("Only supervisors can review assessments."))
220220

221221
assessment.write(
222222
{
@@ -231,7 +231,7 @@ def action_reset_to_draft(self):
231231
"""Reset assessment to draft state."""
232232
for assessment in self:
233233
if assessment.state == "reviewed":
234-
raise UserError("Reviewed assessments cannot be reset to draft.")
234+
raise UserError(_("Reviewed assessments cannot be reset to draft."))
235235
assessment.write(
236236
{
237237
"state": "draft",

spp_case_base/models/case_intervention_plan.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""Case Intervention Plan Model."""
22

3-
from odoo import api, fields, models
3+
from odoo import _, api, fields, models
44
from odoo.exceptions import ValidationError
55

66

@@ -164,13 +164,15 @@ def _check_single_current_plan(self):
164164
]
165165
)
166166
if other_current:
167-
raise ValidationError("Only one plan can be marked as current for a case.")
167+
raise ValidationError(_("Only one plan can be marked as current for a case."))
168168

169169
def action_submit_for_approval(self):
170170
"""Submit plan for approval."""
171171
for plan in self:
172172
if not plan.intervention_ids:
173-
raise ValidationError("Cannot submit plan without interventions. Please add at least one intervention.")
173+
raise ValidationError(
174+
_("Cannot submit plan without interventions. Please add at least one intervention.")
175+
)
174176
plan.state = "pending_approval"
175177
return True
176178

@@ -190,7 +192,7 @@ def action_activate(self):
190192
"""Activate the plan."""
191193
for plan in self:
192194
if plan.state != "approved":
193-
raise ValidationError("Only approved plans can be activated.")
195+
raise ValidationError(_("Only approved plans can be activated."))
194196
plan.state = "active"
195197
return True
196198

@@ -243,7 +245,7 @@ def action_reset_to_draft(self):
243245
"""Reset plan to draft."""
244246
for plan in self:
245247
if plan.state in ["completed", "revised"]:
246-
raise ValidationError("Cannot reset completed or revised plans.")
248+
raise ValidationError(_("Cannot reset completed or revised plans."))
247249
plan.state = "draft"
248250
return True
249251

spp_case_base/models/case_note.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""Case Note Model."""
22

3-
from odoo import api, fields, models
3+
from odoo import _, api, fields, models
44

55

66
class CaseNote(models.Model):
@@ -108,7 +108,7 @@ def create(self, vals_list):
108108
if note.case_id:
109109
note_type_label = dict(note._fields["note_type"].selection).get(note.note_type)
110110
note.case_id.message_post(
111-
body=f"New {note_type_label} added by {note.author_id.name}",
112-
subject=f"Case Note: {note_type_label}",
111+
body=_("New %(type)s added by %(author)s", type=note_type_label, author=note.author_id.name),
112+
subject=_("Case Note: %(type)s", type=note_type_label),
113113
)
114114
return notes

spp_case_base/models/case_referral.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""Case Referral Model."""
22

3-
from odoo import api, fields, models
3+
from odoo import _, api, fields, models
44

55

66
class CaseReferral(models.Model):
@@ -140,7 +140,7 @@ def create(self, vals_list):
140140
for referral in referrals:
141141
if referral.case_id:
142142
referral.case_id.message_post(
143-
body=f"Referral created to {referral.service_name}",
144-
subject="New Referral",
143+
body=_("Referral created to %(service)s", service=referral.service_name),
144+
subject=_("New Referral"),
145145
)
146146
return referrals

spp_case_base/security/compliance.yaml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,17 @@ groups:
4444
tier: 2
4545
privilege_id: privilege_case_user
4646
implied_ids: [group_case_viewer]
47-
comment: "SPECIALIZED ROLE: Manage own cases and case activities. Between Viewer and Officer."
47+
comment:
48+
"SPECIALIZED ROLE: Manage own cases and case activities. Between Viewer and
49+
Officer."
4850

4951
- id: group_case_supervisor
5052
tier: 2
5153
privilege_id: privilege_case_supervisor
5254
implied_ids: [group_case_worker]
53-
comment: "SPECIALIZED ROLE: Supervise team cases and approve plans. Between Officer and Manager."
55+
comment:
56+
"SPECIALIZED ROLE: Supervise team cases and approve plans. Between Officer and
57+
Manager."
5458

5559
- id: group_case_manager
5660
tier: 2
@@ -183,7 +187,8 @@ record_rules:
183187
perm_create: true
184188
perm_unlink: false
185189
domain_pattern: team_records
186-
domain: "['|', ('supervisor_id', '=', user.id), ('team_id.supervisor_id', '=', user.id)]"
190+
domain:
191+
"['|', ('supervisor_id', '=', user.id), ('team_id.supervisor_id', '=', user.id)]"
187192
domain_field: supervisor_id
188193

189194
# Case access - manager sees all

0 commit comments

Comments
 (0)