Skip to content
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

14.0 t0735 - fcp state not correct when suspension and reactivation lifecycle are on the same date #1844

Merged
merged 2 commits into from
Mar 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions child_compassion/models/project_compassion.py
Original file line number Diff line number Diff line change
Expand Up @@ -475,11 +475,17 @@ def _get_months(self):
def _compute_suspension_state(self):
for project in self.filtered("lifecycle_ids"):
last_info = project.lifecycle_ids[0]
if last_info.type == "Suspension":
reactivation_lifecycle = project.lifecycle_ids.filtered(
lambda r: r.date == last_info.date and r.type == "Reactivation")

# If it exists, lifecycle with type 'Reactivation' is determinant
determinant_lifecycle = reactivation_lifecycle or last_info
if determinant_lifecycle.type == "Suspension":
project.suspension = (
"fund-suspended" if last_info.hold_cdsp_funds else "suspended"
"fund-suspended" if determinant_lifecycle.hold_cdsp_funds
else "suspended"
)
elif last_info.type == "Reactivation":
elif determinant_lifecycle.type == "Reactivation":
project.suspension = False

@api.depends("covid_status_ids")
Expand Down
Loading