-
Notifications
You must be signed in to change notification settings - Fork 1
fix(spp_scoring,spp_scoring_programs): scoring validation, eligibility enforcement, and access control #161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
emjay0921
wants to merge
13
commits into
19.0
Choose a base branch
from
feat/spp-scoring-programs
base: 19.0
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
9f903a4
fix(spp_scoring): validate all threshold boundaries for gaps and over…
emjay0921 2d7db71
fix(spp_scoring): improve validation error messages for incomplete mo…
emjay0921 2781ffa
fix(spp_programs): invoke pre/post enrollment hooks in program manager
emjay0921 4cabe1f
fix(spp_scoring_programs): record enrollment score on membership afte…
emjay0921 093b815
fix(spp_scoring_programs): show scoring columns by default in members…
emjay0921 d8096dd
fix(spp_scoring,spp_scoring_programs): max score age 0 forces recalcu…
emjay0921 2f7ebb1
fix(spp_scoring_programs): grant scoring viewer read access to programs
emjay0921 ac9138b
fix(spp_scoring): restrict Activate/Deactivate buttons to scoring man…
emjay0921 12f50d4
feat(spp_scoring): add Scores smart button to registrant form
emjay0921 2720864
fix(spp_scoring): strict mode validates false/invalid values for requ…
emjay0921 1a8bfdb
fix(spp_scoring): duplicate scoring model copies indicators and thres…
emjay0921 ab87b79
fix(spp_scoring): address QA findings on thresholds, smart button, st…
emjay0921 d83e81c
fix(spp_scoring): flag shared-boundary thresholds as overlap (#835 r3)
emjay0921 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| # Part of OpenSPP. See LICENSE file for full copyright and licensing details. | ||
| """Extends res.partner with scoring result count and actions.""" | ||
|
|
||
| from odoo import api, fields, models | ||
|
|
||
|
|
||
| class ResPartner(models.Model): | ||
| """Add scoring smart button to registrant form.""" | ||
|
|
||
| _inherit = "res.partner" | ||
|
|
||
| scoring_result_ids = fields.One2many( | ||
| "spp.scoring.result", | ||
| "registrant_id", | ||
| string="Scoring Results", | ||
| ) | ||
| scoring_result_count = fields.Integer( | ||
| string="# Scores", | ||
| compute="_compute_scoring_result_count", | ||
| ) | ||
|
|
||
| @api.depends("scoring_result_ids") | ||
| def _compute_scoring_result_count(self): | ||
| for partner in self: | ||
| partner.scoring_result_count = len(partner.scoring_result_ids) | ||
|
|
||
| def action_view_scoring_results(self): | ||
| """Open scoring results for this registrant.""" | ||
| self.ensure_one() | ||
| return { | ||
| "name": self.name, | ||
| "type": "ir.actions.act_window", | ||
| "res_model": "spp.scoring.result", | ||
| "view_mode": "list,form", | ||
| "domain": [("registrant_id", "=", self.id)], | ||
| "context": {"default_registrant_id": self.id}, | ||
| } | ||
|
|
||
| def action_score_registrant(self): | ||
| """Open the batch scoring wizard pre-filled for this registrant.""" | ||
| self.ensure_one() | ||
| return { | ||
| "name": "Score Registrant", | ||
| "type": "ir.actions.act_window", | ||
| "res_model": "spp.batch.scoring.wizard", | ||
| "view_mode": "form", | ||
| "target": "new", | ||
| "context": { | ||
| "default_registrant_ids": self.ids, | ||
| "default_domain": f"[('id', '=', {self.id})]", | ||
| }, | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| <?xml version="1.0" encoding="utf-8" ?> | ||
| <odoo> | ||
| <!-- Add Scores smart button to the OpenSPP registrant form. | ||
| spp_registry.view_individuals_form replaces //sheet on res.partner, | ||
| so inheriting base.view_partner_form does not propagate to the | ||
| registry form used by Individuals and Groups. --> | ||
| <record id="view_registrant_form_scoring" model="ir.ui.view"> | ||
| <field name="name">spp_registry.view_registrant_form.scoring</field> | ||
| <field name="model">res.partner</field> | ||
| <field name="inherit_id" ref="spp_registry.view_individuals_form" /> | ||
| <field name="arch" type="xml"> | ||
| <xpath expr="//div[@name='button_box']" position="inside"> | ||
| <button | ||
| name="action_view_scoring_results" | ||
| type="object" | ||
| class="oe_stat_button" | ||
| icon="fa-bar-chart" | ||
| > | ||
| <field | ||
| name="scoring_result_count" | ||
| widget="statinfo" | ||
| string="Scores" | ||
| /> | ||
| </button> | ||
| </xpath> | ||
| </field> | ||
| </record> | ||
| </odoo> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Calling the pre-enrollment hook inside a loop for each member can lead to significant performance bottlenecks during bulk enrollment, as each hook execution might involve complex logic or database queries (like scoring). Consider refactoring the hook API to support batch processing of recordsets for better efficiency.