diff --git a/src/etools/applications/partners/models.py b/src/etools/applications/partners/models.py index 48beaf8b5f..8916be06aa 100644 --- a/src/etools/applications/partners/models.py +++ b/src/etools/applications/partners/models.py @@ -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() @@ -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( diff --git a/src/etools/applications/partners/permission_matrix/intervention_permissions.csv b/src/etools/applications/partners/permission_matrix/intervention_permissions.csv index ad4435e556..09a0090246 100644 --- a/src/etools/applications/partners/permission_matrix/intervention_permissions.csv +++ b/src/etools/applications/partners/permission_matrix/intervention_permissions.csv @@ -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 diff --git a/src/etools/applications/partners/permissions.py b/src/etools/applications/partners/permissions.py index 8835d004fa..ae5212b497 100644 --- a/src/etools/applications/partners/permissions.py +++ b/src/etools/applications/partners/permissions.py @@ -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") @@ -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 diff --git a/src/etools/applications/partners/tests/test_models.py b/src/etools/applications/partners/tests/test_models.py index 2d0ec839ef..70a8bc3e66 100644 --- a/src/etools/applications/partners/tests/test_models.py +++ b/src/etools/applications/partners/tests/test_models.py @@ -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'} ] } })