diff --git a/InvenTree/company/fixtures/company.yaml b/InvenTree/company/fixtures/company.yaml new file mode 100644 index 0000000000..7f95b6ec26 --- /dev/null +++ b/InvenTree/company/fixtures/company.yaml @@ -0,0 +1,14 @@ +# Sample company data + +- model: company.company + fields: + name: ACME + description: A Cool Military Enterprise +- model: company.company + fields: + name: Appel Computers + description: Think more differenter +- model: company.company + fields: + name: Zerg Corp + description: We eat the competition \ No newline at end of file diff --git a/InvenTree/company/fixtures/price_breaks.yaml b/InvenTree/company/fixtures/price_breaks.yaml new file mode 100644 index 0000000000..6616ab36b1 --- /dev/null +++ b/InvenTree/company/fixtures/price_breaks.yaml @@ -0,0 +1,47 @@ +# Price breaks for supplier parts + +# Price breaks for ACME0001 + +- model: company.supplierpricebreak + fields: + part: 1 + quantity: 1 + cost: 10 + +- model: company.supplierpricebreak + fields: + part: 1 + quantity: 5 + cost: 7.50 + +- model: company.supplierpricebreak + fields: + part: 1 + quantity: 25 + cost: 3.50 + +# Price breaks for ACME0002 +- model: company.supplierpricebreak + fields: + part: 2 + quantity: 5 + cost: 7.00 + +- model: company.supplierpricebreak + fields: + part: 2 + quantity: 50 + cost: 1.25 + +# Price breaks for ZERGLPHS +- model: company.supplierpricebreak + fields: + part: 4 + quantity: 25 + cost: 8 + +- model: company.supplierpricebreak + fields: + part: 4 + quantity: 100 + cost: 1.25 \ No newline at end of file diff --git a/InvenTree/company/fixtures/supplier_part.yaml b/InvenTree/company/fixtures/supplier_part.yaml new file mode 100644 index 0000000000..f0076974d5 --- /dev/null +++ b/InvenTree/company/fixtures/supplier_part.yaml @@ -0,0 +1,31 @@ +# Supplier Parts + +# M2x4 LPHS from ACME +- model: company.supplierpart + pk: 1 + fields: + part: 1 + supplier: 1 + SKU: 'ACME0001' + +- model: company.supplierpart + pk: 2 + fields: + part: 1 + supplier: 1 + SKU: 'ACME0002' + +# M2x4 LPHS from Zerg Corp +- model: company.supplierpart + pk: 3 + fields: + part: 1 + supplier: 3 + SKU: 'ZERGLPHS' + +- model: company.supplierpart + pk: 4 + fields: + part: 2 + supplier: 2 + SKU: 'ZERGM312' diff --git a/InvenTree/company/forms.py b/InvenTree/company/forms.py index 0ad63b9d63..76b1c1342c 100644 --- a/InvenTree/company/forms.py +++ b/InvenTree/company/forms.py @@ -57,7 +57,6 @@ class EditSupplierPartForm(HelperForm): 'note', 'base_cost', 'multiple', - 'minimum', 'packaging', 'lead_time' ] diff --git a/InvenTree/company/migrations/0003_remove_supplierpart_minimum.py b/InvenTree/company/migrations/0003_remove_supplierpart_minimum.py new file mode 100644 index 0000000000..21ec25ebbf --- /dev/null +++ b/InvenTree/company/migrations/0003_remove_supplierpart_minimum.py @@ -0,0 +1,17 @@ +# Generated by Django 2.2 on 2019-05-21 03:51 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('company', '0002_auto_20190520_2204'), + ] + + operations = [ + migrations.RemoveField( + model_name='supplierpart', + name='minimum', + ), + ] diff --git a/InvenTree/company/models.py b/InvenTree/company/models.py index be6cf10f7c..5c3b3291ff 100644 --- a/InvenTree/company/models.py +++ b/InvenTree/company/models.py @@ -173,7 +173,6 @@ class SupplierPart(models.Model): note: Longer form note field base_cost: Base charge added to order independent of quantity e.g. "Reeling Fee" multiple: Multiple that the part is provided in - minimum: MOQ (minimum order quantity) required for purchase lead_time: Supplier lead time packaging: packaging that the part is supplied in, e.g. "Reel" """ @@ -217,8 +216,6 @@ class SupplierPart(models.Model): multiple = models.PositiveIntegerField(default=1, validators=[MinValueValidator(1)], help_text='Order multiple') - minimum = models.PositiveIntegerField(default=1, validators=[MinValueValidator(1)], help_text='Minimum order quantity (MOQ)') - lead_time = models.DurationField(blank=True, null=True) @property @@ -256,10 +253,6 @@ class SupplierPart(models.Model): if len(price_breaks) == 0: return None - # Minimum ordering requirement - if moq and self.minimum > quantity: - quantity = self.minimum - # Order multiples if multiples: quantity = int(math.ceil(quantity / self.multiple) * self.multiple) diff --git a/InvenTree/company/templates/company/partdetail.html b/InvenTree/company/templates/company/partdetail.html index 5d0eee89a9..812ceacf04 100644 --- a/InvenTree/company/templates/company/partdetail.html +++ b/InvenTree/company/templates/company/partdetail.html @@ -66,9 +66,6 @@ InvenTree | {{ company.name }} - Parts {% if part.base_cost > 0 %}