Skip to content

Commit

Permalink
Use bids validation wrapper where needed
Browse files Browse the repository at this point in the history
  • Loading branch information
annawzz committed Oct 30, 2017
1 parent e18ee58 commit 4cad1b8
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions openprocurement/tender/esco/models.py
Expand Up @@ -226,6 +226,7 @@ def validate_annualCostsReduction(self, data, value):
if len(value) != 21:
raise ValidationError('annual costs reduction should be set for 21 period')

@bids_validation_wrapper
def validate_yearlyPaymentsPercentage(self, data, value):
if get_tender(data['__parent__']).fundingKind == 'other' and (value < Decimal('0.8') or value > Decimal('1')):
raise ValidationError('yearlyPaymentsPercentage should be greater than 0.8 and less than 1')
Expand All @@ -237,6 +238,7 @@ class LotValue(BaseLotValue):

value = ModelType(ESCOValue, required=True)

@bids_validation_wrapper
def validate_value(self, data, value):
if value and isinstance(data['__parent__'], Model) and (data['__parent__'].status not in ('invalid', 'deleted', 'draft')) and data['relatedLot']:
lots = [i for i in get_tender(data['__parent__']).lots if i.id == data['relatedLot']]
Expand Down

0 comments on commit 4cad1b8

Please sign in to comment.