diff --git a/InvenTree/company/admin.py b/InvenTree/company/admin.py index 45dd769d67..b339a65c0e 100644 --- a/InvenTree/company/admin.py +++ b/InvenTree/company/admin.py @@ -38,7 +38,9 @@ class CompanyAdmin(ImportExportModelAdmin): class SupplierPartResource(ModelResource): - """ Class for managing SupplierPart data import/export """ + """ + Class for managing SupplierPart data import/export + """ part = Field(attribute='part', widget=widgets.ForeignKeyWidget(Part)) @@ -51,7 +53,7 @@ class SupplierPartResource(ModelResource): class Meta: model = SupplierPart skip_unchanged = True - report_skipped = False + report_skipped = True clean_model_instances = True diff --git a/InvenTree/company/migrations/0031_auto_20210103_2215.py b/InvenTree/company/migrations/0031_auto_20210103_2215.py new file mode 100644 index 0000000000..a8ff0d9d63 --- /dev/null +++ b/InvenTree/company/migrations/0031_auto_20210103_2215.py @@ -0,0 +1,61 @@ +# Generated by Django 3.0.7 on 2021-01-03 11:15 + +import InvenTree.fields +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('part', '0060_merge_20201112_1722'), + ('company', '0030_auto_20201112_1112'), + ] + + operations = [ + migrations.AlterField( + model_name='supplierpart', + name='MPN', + field=models.CharField(blank=True, help_text='Manufacturer part number', max_length=100, null=True, verbose_name='MPN'), + ), + migrations.AlterField( + model_name='supplierpart', + name='SKU', + field=models.CharField(help_text='Supplier stock keeping unit', max_length=100, verbose_name='SKU'), + ), + migrations.AlterField( + model_name='supplierpart', + name='description', + field=models.CharField(blank=True, help_text='Supplier part description', max_length=250, null=True, verbose_name='Description'), + ), + migrations.AlterField( + model_name='supplierpart', + name='link', + field=InvenTree.fields.InvenTreeURLField(blank=True, help_text='URL for external supplier part link', null=True, verbose_name='Link'), + ), + migrations.AlterField( + model_name='supplierpart', + name='manufacturer', + field=models.ForeignKey(blank=True, help_text='Select manufacturer', limit_choices_to={'is_manufacturer': True}, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='manufactured_parts', to='company.Company', verbose_name='Manufacturer'), + ), + migrations.AlterField( + model_name='supplierpart', + name='note', + field=models.CharField(blank=True, help_text='Notes', max_length=100, null=True, verbose_name='Note'), + ), + migrations.AlterField( + model_name='supplierpart', + name='packaging', + field=models.CharField(blank=True, help_text='Part packaging', max_length=50, null=True), + ), + migrations.AlterField( + model_name='supplierpart', + name='part', + field=models.ForeignKey(help_text='Select part', limit_choices_to={'purchaseable': True}, on_delete=django.db.models.deletion.CASCADE, related_name='supplier_parts', to='part.Part', verbose_name='Base Part'), + ), + migrations.AlterField( + model_name='supplierpart', + name='supplier', + field=models.ForeignKey(help_text='Select supplier', limit_choices_to={'is_supplier': True}, on_delete=django.db.models.deletion.CASCADE, related_name='supplied_parts', to='company.Company', verbose_name='Supplier'), + ), + ] diff --git a/InvenTree/company/models.py b/InvenTree/company/models.py index 81718a9acd..e4386712c8 100644 --- a/InvenTree/company/models.py +++ b/InvenTree/company/models.py @@ -313,7 +313,6 @@ class SupplierPart(models.Model): verbose_name=_('Base Part'), limit_choices_to={ 'purchaseable': True, - 'is_template': False, }, help_text=_('Select part'), ) @@ -321,31 +320,55 @@ class SupplierPart(models.Model): supplier = models.ForeignKey(Company, on_delete=models.CASCADE, related_name='supplied_parts', limit_choices_to={'is_supplier': True}, + verbose_name=_('Supplier'), help_text=_('Select supplier'), ) - SKU = models.CharField(max_length=100, help_text=_('Supplier stock keeping unit')) + SKU = models.CharField( + max_length=100, + verbose_name=_('SKU'), + help_text=_('Supplier stock keeping unit') + ) manufacturer = models.ForeignKey( Company, on_delete=models.SET_NULL, related_name='manufactured_parts', - limit_choices_to={'is_manufacturer': True}, + limit_choices_to={ + 'is_manufacturer': True + }, + verbose_name=_('Manufacturer'), help_text=_('Select manufacturer'), null=True, blank=True ) - MPN = models.CharField(max_length=100, blank=True, help_text=_('Manufacturer part number')) + MPN = models.CharField( + max_length=100, blank=True, null=True, + verbose_name=_('MPN'), + help_text=_('Manufacturer part number') + ) - link = InvenTreeURLField(blank=True, help_text=_('URL for external supplier part link')) + link = InvenTreeURLField( + blank=True, null=True, + verbose_name=_('Link'), + help_text=_('URL for external supplier part link') + ) - description = models.CharField(max_length=250, blank=True, help_text=_('Supplier part description')) + description = models.CharField( + max_length=250, blank=True, null=True, + verbose_name=_('Description'), + help_text=_('Supplier part description') + ) - note = models.CharField(max_length=100, blank=True, help_text=_('Notes')) + note = models.CharField( + max_length=100, blank=True, null=True, + verbose_name=_('Note'), + help_text=_('Notes') + ) base_cost = models.DecimalField(max_digits=10, decimal_places=3, default=0, validators=[MinValueValidator(0)], help_text=_('Minimum charge (e.g. stocking fee)')) - packaging = models.CharField(max_length=50, blank=True, help_text=_('Part packaging')) + packaging = models.CharField(max_length=50, blank=True, null=True, help_text=_('Part packaging')) multiple = models.PositiveIntegerField(default=1, validators=[MinValueValidator(1)], help_text=('Order multiple'))