Skip to content

Commit

Permalink
PMT: Enabled JSON library inside compute field
Browse files Browse the repository at this point in the history
  • Loading branch information
mkumar-02 committed Mar 22, 2024
1 parent 81c2b29 commit f174ce1
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
6 changes: 4 additions & 2 deletions g2p_program_registrant_info/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from . import registrant
from . import program_registrant_info
from . import program_membership
from . import entitlement
from . import eligibility_manager
from . import entitlement_manager
from . import ir_model
from . import program_membership
from . import program_registrant_info
from . import registrant
7 changes: 7 additions & 0 deletions g2p_program_registrant_info/models/ir_model.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from odoo.tools.safe_eval import wrap_module

from odoo.addons.base.models import ir_model

ir_model.SAFE_EVAL_BASE.update(
{"json": wrap_module(__import__("json"), ["loads", "dumps"])}
)
4 changes: 1 addition & 3 deletions g2p_proxy_means_test/models/program_registrant_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@
class G2PProgramRegistrantInfo(models.Model):
_inherit = "g2p.program.registrant_info"

pmt_score = fields.Float(
"PMT Score", compute="_compute_pmt_score", digits=(0, 4), store=True
)
pmt_score = fields.Float("PMT Score", compute="_compute_pmt_score", store=True)
program_pmt_config = fields.Boolean(related="program_id.pmt_config", readonly=True)

@api.depends(
Expand Down
2 changes: 1 addition & 1 deletion g2p_proxy_means_test/models/proxy_means_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class ProxyMeanTestParams(models.Model):

program_id = fields.Many2one("g2p.program")
pmt_field = fields.Selection(selection="get_fields_label", string="Field")
pmt_weightage = fields.Float(string="Weightage", digits=(0, 4))
pmt_weightage = fields.Float(string="Weightage")

def get_fields_label(self):
reg_info = self.env["g2p.program.registrant_info"]
Expand Down

0 comments on commit f174ce1

Please sign in to comment.