Skip to content

Commit

Permalink
Cancelling all awards on canceling award with satisfied complaint
Browse files Browse the repository at this point in the history
  • Loading branch information
kroman0 committed May 12, 2016
1 parent cb083ec commit b07227a
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion openprocurement/tender/limited/views/award.py
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,14 @@ def patch(self):
'items': tender.items,
'contractID': '{}-{}{}'.format(tender.tenderID, self.server_id, len(tender.contracts) +1) }))
# add_next_award(self.request)
elif award_status == 'active' and award.status == 'cancelled' and any([i.status == 'satisfied' for i in award.complaints]):
now = get_now()
for i in tender.awards:
if i.complaintPeriod.endDate > now:
i.complaintPeriod.endDate = now
i.status = 'cancelled'
for i in tender.contracts:
i.status = 'cancelled'
elif award_status == 'active' and award.status == 'cancelled':
now = get_now()
if award.complaintPeriod.endDate > now:
Expand All @@ -530,7 +538,13 @@ def patch(self):
award.complaintPeriod.endDate = calculate_business_date(get_now(), self.stand_still_delta, tender)
# add_next_award(self.request)
elif award_status == 'unsuccessful' and award.status == 'cancelled' and any([i.status == 'satisfied' for i in award.complaints]):
award.complaintPeriod.endDate = get_now()
now = get_now()
for i in tender.awards:
if i.complaintPeriod.endDate > now:
i.complaintPeriod.endDate = now
i.status = 'cancelled'
for i in tender.contracts:
i.status = 'cancelled'
elif award_status != award.status:
self.request.errors.add('body', 'data', 'Can\'t update award in current ({}) status'.format(award_status))
self.request.errors.status = 403
Expand Down

0 comments on commit b07227a

Please sign in to comment.