Skip to content

Commit

Permalink
Merge pull request #3467 from unicef/staging
Browse files Browse the repository at this point in the history
Staging
  • Loading branch information
robertavram authored Mar 30, 2023
2 parents 1e9e4ae + a4646d7 commit 0c44509
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/etools/applications/partners/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2864,6 +2864,11 @@ def merge_amendment(self):
self.is_active = False
self.save()

# TODO: Technical debt - remove after tempoorary exception for ended amendments is removed.
if self.intervention.status == self.intervention.ENDED:
if self.intervention.end >= datetime.date.today() >= self.intervention.start:
self.intervention.status = self.intervention.ACTIVE

self.intervention.save(amendment_number=self.intervention.amendments.filter(is_active=False).count())

amended_intervention.delete()
Expand Down Expand Up @@ -3270,7 +3275,7 @@ def send_notification(self):
'intervention_number': self.review.intervention.reference_number,
'meeting_date': self.review.meeting_date.strftime('%d-%m-%Y'),
'user_name': self.user.get_full_name(),
'url': '{}{}'.format(settings.HOST, self.review.intervention.get_frontend_object_url(suffix='review'))
'url': self.review.intervention.get_frontend_object_url(suffix='review')
}

send_notification_with_template(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Field no,Field Name,Group,Condition,Status,Action,Allowed
3.2.7,amendments,*,,Draft,View,FALSE
3.2.8,amendments,Unicef Focal Point,not_in_amendment_mode,Signed,Edit,TRUE
3.2.9,amendments,Unicef Focal Point,not_in_amendment_mode,Active,Edit,TRUE
3.2.9,amendments,Unicef Focal Point,post_epd_temp_conditions,Ended,Edit,TRUE
3.3.7,attachments,*,not_in_amendment_mode,*,View,TRUE
3.3.7,attachments,Unicef Focal Point,not_in_amendment_mode,Draft,Edit,TRUE
3.3.7,attachments,Partner User,not_in_amendment_mode,Draft,Edit,TRUE
Expand Down
14 changes: 14 additions & 0 deletions src/etools/applications/partners/permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,19 @@ def __init__(self, **kwargs):
def user_added_amendment(instance):
return instance.in_amendment is True

# TODO: remove this as sooon as it expires on July first. Technical Debt - hard coded exception
def post_epd_temp_conditions(i):
# quick fix for offices that have not added their amendments in the system before the release date.
today = datetime.date.today()
available_til = datetime.date(2023, 7, 1)
begin_date = datetime.date(2022, 12, 1)
release_date = datetime.date(2023, 4, 30)
if i.end and begin_date <= i.end < release_date \
and today < available_til \
and i.document_type != "SSFA":
return True
return False

def prp_mode_off():
return tenant_switch_is_active("prp_mode_off")

Expand Down Expand Up @@ -213,6 +226,7 @@ def not_ssfa(instance):
'unlocked_or_spd': not not_spd(self.instance) or unlocked(self.instance),
'unicef_not_accepted_spd_non_hum': unicef_not_accepted_spd_non_hum(self.instance),
'not_ssfa+unicef_not_accepted': not_ssfa(self.instance) and unicef_not_accepted(self.instance),
'post_epd_temp_conditions': post_epd_temp_conditions(self.instance),
}

# override get_permissions to enable us to prevent old interventions from being blocked on transitions
Expand Down
1 change: 1 addition & 0 deletions src/etools/applications/partners/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -680,6 +680,7 @@ def test_permission_structure(self):
'true': [
{'status': 'signed', 'group': 'Unicef Focal Point', 'condition': 'not_in_amendment_mode'},
{'status': 'active', 'group': 'Unicef Focal Point', 'condition': 'not_in_amendment_mode'},
{'status': 'ended', 'group': 'Unicef Focal Point', 'condition': 'post_epd_temp_conditions'}
]
}
})
Expand Down

0 comments on commit 0c44509

Please sign in to comment.