From a3cd54875c92898cbbb47af31cfaa4229378578f Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Sat, 18 May 2019 16:32:48 +1000 Subject: [PATCH] Update validator for supplier price break --- .../migrations/0029_auto_20190518_1632.py | 19 +++++++++++++++++++ InvenTree/part/models.py | 3 +-- 2 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 InvenTree/part/migrations/0029_auto_20190518_1632.py diff --git a/InvenTree/part/migrations/0029_auto_20190518_1632.py b/InvenTree/part/migrations/0029_auto_20190518_1632.py new file mode 100644 index 0000000000..a5a2d61809 --- /dev/null +++ b/InvenTree/part/migrations/0029_auto_20190518_1632.py @@ -0,0 +1,19 @@ +# Generated by Django 2.2 on 2019-05-18 06:32 + +import django.core.validators +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('part', '0028_auto_20190518_1627'), + ] + + operations = [ + migrations.AlterField( + model_name='supplierpricebreak', + name='quantity', + field=models.PositiveIntegerField(validators=[django.core.validators.MinValueValidator(1)]), + ), + ] diff --git a/InvenTree/part/models.py b/InvenTree/part/models.py index 34f9069f91..42080ba408 100644 --- a/InvenTree/part/models.py +++ b/InvenTree/part/models.py @@ -941,8 +941,7 @@ class SupplierPriceBreak(models.Model): part = models.ForeignKey(SupplierPart, on_delete=models.CASCADE, related_name='price_breaks') - # At least 2 units are required for a 'price break' - Otherwise, just use single-price! - quantity = models.PositiveIntegerField(validators=[MinValueValidator(2)]) + quantity = models.PositiveIntegerField(validators=[MinValueValidator(1)]) cost = models.DecimalField(max_digits=10, decimal_places=3, validators=[MinValueValidator(0)])