Update validator for supplier price break

This commit is contained in:
Oliver Walters 2019-05-18 16:32:48 +10:00
parent 92632b2ef7
commit a3cd54875c
2 changed files with 20 additions and 2 deletions

View File

@ -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)]),
),
]

View File

@ -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)])