Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/291-fix-the-bug-when-entitlement…
Browse files Browse the repository at this point in the history
…s-are-generated-and-cycles-are-created' into release/dev-15.1.1.15
  • Loading branch information
gonzalesedwin1123 committed Jan 23, 2024
2 parents 46e53e3 + 6bbd78b commit 3f6bec6
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions spp_pmt/models/pmt.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class G2PGroupPMT(models.Model):
x_cst_indv_disability = fields.Boolean("Disability")

# Floating-point field to store the computed PMT score of the group
# TODO: Why this is not stored? We are having performance issue with this in program enrollment.
z_ind_grp_pmt_score = fields.Float(
"PMT Score of the group",
compute="_compute_pmt_score",
Expand Down Expand Up @@ -47,8 +48,8 @@ def _compute_area(self):
rec.area_calc = area_calc

def _compute_pmt_score(self):

hh_area = self.area_id
# TODO: FIx issue with self returning more than 1 record
hh_area = self[0].area_id # Temporary fix, get only the 1st record.

model = self.env["ir.model"].search([("model", "=", "res.partner")])

Expand All @@ -63,6 +64,9 @@ def _compute_pmt_score(self):
if fields:
for field in fields:
if hh_area:
_logger.info(
"pmt.py: self.area_id: %s - %s" % (self.area_id, hh_area)
)
areas = field.area_ids.filtered(lambda a: a.name.id == hh_area.id)
if areas:
weights.update({field.name: areas[0].weight})
Expand Down

0 comments on commit 3f6bec6

Please sign in to comment.