From 52c3a63c61fd776fd1959c4f150e5b989f9cc5b2 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Wed, 17 Apr 2019 00:48:01 +1000 Subject: [PATCH] Updated SupplierPriceBreak page --- .../company/templates/company/index.html | 2 +- .../company/templates/company/partdetail.html | 33 +++++++++++++++++++ InvenTree/part/forms.py | 7 ++++ .../migrations/0010_auto_20190417_0045.py | 24 ++++++++++++++ InvenTree/part/models.py | 4 +-- 5 files changed, 67 insertions(+), 3 deletions(-) create mode 100644 InvenTree/part/migrations/0010_auto_20190417_0045.py diff --git a/InvenTree/company/templates/company/index.html b/InvenTree/company/templates/company/index.html index bb2ee3413c..a9cb7e2700 100644 --- a/InvenTree/company/templates/company/index.html +++ b/InvenTree/company/templates/company/index.html @@ -6,7 +6,7 @@

Companies

-

+
diff --git a/InvenTree/company/templates/company/partdetail.html b/InvenTree/company/templates/company/partdetail.html index 0710e10053..644dc5760e 100644 --- a/InvenTree/company/templates/company/partdetail.html +++ b/InvenTree/company/templates/company/partdetail.html @@ -44,10 +44,43 @@ {% endif %} +{% if part.note %} + +{% endif %} + + +{% if part.multiple > 1 %} + +{% endif %} +{% if part.base_cost > 0 %} + +{% endif %} +{% if part.minimum > 1 %} + +{% endif %}
Manufacturer{{ part.manufacturer }}
MPN{{ part.MPN }}
Note{{ part.note }}
Pricing
Single Price{{ part.single_price }}
Order Multiple{{ part.multiple }}
Base Price (Flat Fee){{ part.base_cost }}
Minimum Order Quantity{{ part.minimum }}

+

Price Breaks

+ + + + + + +{% for pb in part.price_breaks.all %} + + + + +{% endfor %} +
QuantityPrice
{{ pb.quantity }}{{ pb.cost }}
+ +
+ +
+ {% include 'modals.html' %} {% endblock %} diff --git a/InvenTree/part/forms.py b/InvenTree/part/forms.py index 977d6e5ef3..28d9941326 100644 --- a/InvenTree/part/forms.py +++ b/InvenTree/part/forms.py @@ -99,4 +99,11 @@ class EditSupplierPartForm(HelperForm): 'URL', 'manufacturer', 'MPN', + 'note', + 'single_price', + 'base_cost', + 'multiple', + 'minimum', + 'packaging', + 'lead_time' ] diff --git a/InvenTree/part/migrations/0010_auto_20190417_0045.py b/InvenTree/part/migrations/0010_auto_20190417_0045.py new file mode 100644 index 0000000000..1040afc67c --- /dev/null +++ b/InvenTree/part/migrations/0010_auto_20190417_0045.py @@ -0,0 +1,24 @@ +# Generated by Django 2.2 on 2019-04-16 14:45 + +import django.core.validators +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('part', '0009_auto_20190417_0019'), + ] + + operations = [ + migrations.AlterField( + model_name='supplierpart', + name='minimum', + field=models.PositiveIntegerField(default=1, help_text='Minimum order quantity (MOQ)', validators=[django.core.validators.MinValueValidator(1)]), + ), + migrations.AlterField( + model_name='supplierpart', + name='multiple', + field=models.PositiveIntegerField(default=1, help_text='Order multiple', validators=[django.core.validators.MinValueValidator(1)]), + ), + ] diff --git a/InvenTree/part/models.py b/InvenTree/part/models.py index c7d6f8903f..800ca5e41a 100644 --- a/InvenTree/part/models.py +++ b/InvenTree/part/models.py @@ -488,10 +488,10 @@ class SupplierPart(models.Model): packaging = models.CharField(max_length=50, blank=True, help_text='Part packaging') # multiple that the part is provided in - multiple = models.PositiveIntegerField(default=1, validators=[MinValueValidator(0)], help_text='Order multiple') + multiple = models.PositiveIntegerField(default=1, validators=[MinValueValidator(1)], help_text='Order multiple') # Mimumum number required to order - minimum = models.PositiveIntegerField(default=1, validators=[MinValueValidator(0)], help_text='Minimum order quantity (MOQ)') + minimum = models.PositiveIntegerField(default=1, validators=[MinValueValidator(1)], help_text='Minimum order quantity (MOQ)') # lead time for parts that cannot be delivered immediately lead_time = models.DurationField(blank=True, null=True)