mirror of
				https://github.com/inventree/InvenTree.git
				synced 2025-11-03 22:55:43 +00:00 
			
		
		
		
	Move SupplierPart and SupplierPriceBreak to the 'Company' app
- https://docs.djangoproject.com/en/2.2/ref/models/options/#django.db.models.Options.db_table - https://stackoverflow.com/questions/3519143/django-how-to-specify-a-database-for-a-model - And others, presumably
This commit is contained in:
		@@ -0,0 +1,52 @@
 | 
			
		||||
# Generated by Django 2.2 on 2019-05-18 07:59
 | 
			
		||||
 | 
			
		||||
import django.core.validators
 | 
			
		||||
from django.db import migrations, models
 | 
			
		||||
import django.db.models.deletion
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class Migration(migrations.Migration):
 | 
			
		||||
 | 
			
		||||
    dependencies = [
 | 
			
		||||
        ('part', '0032_auto_20190518_1759'),
 | 
			
		||||
        ('company', '0006_auto_20190508_2332'),
 | 
			
		||||
    ]
 | 
			
		||||
 | 
			
		||||
    operations = [
 | 
			
		||||
        migrations.CreateModel(
 | 
			
		||||
            name='SupplierPart',
 | 
			
		||||
            fields=[
 | 
			
		||||
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
 | 
			
		||||
                ('SKU', models.CharField(help_text='Supplier stock keeping unit', max_length=100)),
 | 
			
		||||
                ('manufacturer', models.CharField(blank=True, help_text='Manufacturer', max_length=100)),
 | 
			
		||||
                ('MPN', models.CharField(blank=True, help_text='Manufacturer part number', max_length=100)),
 | 
			
		||||
                ('URL', models.URLField(blank=True, help_text='URL for external supplier part link')),
 | 
			
		||||
                ('description', models.CharField(blank=True, help_text='Supplier part description', max_length=250)),
 | 
			
		||||
                ('note', models.CharField(blank=True, help_text='Notes', max_length=100)),
 | 
			
		||||
                ('base_cost', models.DecimalField(decimal_places=3, default=0, help_text='Minimum charge (e.g. stocking fee)', max_digits=10, validators=[django.core.validators.MinValueValidator(0)])),
 | 
			
		||||
                ('packaging', models.CharField(blank=True, help_text='Part packaging', max_length=50)),
 | 
			
		||||
                ('multiple', models.PositiveIntegerField(default=1, help_text='Order multiple', validators=[django.core.validators.MinValueValidator(1)])),
 | 
			
		||||
                ('minimum', models.PositiveIntegerField(default=1, help_text='Minimum order quantity (MOQ)', validators=[django.core.validators.MinValueValidator(1)])),
 | 
			
		||||
                ('lead_time', models.DurationField(blank=True, null=True)),
 | 
			
		||||
                ('part', 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')),
 | 
			
		||||
                ('supplier', models.ForeignKey(help_text='Select supplier', limit_choices_to={'is_supplier': True}, on_delete=django.db.models.deletion.CASCADE, related_name='parts', to='company.Company')),
 | 
			
		||||
            ],
 | 
			
		||||
            options={
 | 
			
		||||
                'db_table': 'part_supplierpart',
 | 
			
		||||
                'unique_together': {('part', 'supplier', 'SKU')},
 | 
			
		||||
            },
 | 
			
		||||
        ),
 | 
			
		||||
        migrations.CreateModel(
 | 
			
		||||
            name='SupplierPriceBreak',
 | 
			
		||||
            fields=[
 | 
			
		||||
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
 | 
			
		||||
                ('quantity', models.PositiveIntegerField(default=1, validators=[django.core.validators.MinValueValidator(1)])),
 | 
			
		||||
                ('cost', models.DecimalField(decimal_places=3, max_digits=10, validators=[django.core.validators.MinValueValidator(0)])),
 | 
			
		||||
                ('part', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='pricebreaks', to='company.SupplierPart')),
 | 
			
		||||
            ],
 | 
			
		||||
            options={
 | 
			
		||||
                'db_table': 'part_supplierpricebreak',
 | 
			
		||||
                'unique_together': {('part', 'quantity')},
 | 
			
		||||
            },
 | 
			
		||||
        ),
 | 
			
		||||
    ]
 | 
			
		||||
		Reference in New Issue
	
	Block a user