Compare commits

...
Author SHA1 Message Date
Phin Wolkwitz 2713cafe62 [wip] Validate price suggestions against default price 2026-09-03 17:20:40 +02:00
2 changed files with 16 additions and 0 deletions
+5
View File
@@ -363,6 +363,11 @@ class ItemSerializer(SalesChannelMigrationMixin, I18nAwareModelSerializer):
"Gift card products should not be admission products at the same time."
))
if data.get('free_price_suggestion') and data.get('free_price_suggestion') < data.get('default_price'):
raise ValidationError(_(
"Your price suggestion cannot be less than the default price. "
))
return data
def validate_category(self, value):
+11
View File
@@ -889,6 +889,9 @@ class ItemUpdateForm(I18nModelForm):
Item.clean_media_settings(self.event, d.get('media_policy'), d.get('media_type'), d.get('issue_giftcard'))
if d.get('free_price_suggestion') and d.get('free_price_suggestion') < d.get('default_price'):
self.add_error('free_price_suggestion', _("Your price suggestion cannot be less than the default price. "))
return d
class Meta:
@@ -1126,6 +1129,14 @@ class ItemVariationForm(I18nModelForm):
"If a valid membership is required, at least one valid membership type needs to be selected."
)
)
if (
d.get('free_price_suggestion')
and d.get('default_price')
and d.get('free_price_suggestion') < d.get('default_price')
):
self.add_error('free_price_suggestion', _("Your price suggestion cannot be less than the default price. "))
return d
def save(self, commit=True):