feat: 供应商里增加外协字段
This commit is contained in:
parent
da8e381b3f
commit
caf83b7e0f
|
@ -0,0 +1,18 @@
|
||||||
|
# Generated by Django 3.2.12 on 2024-07-23 01:32
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('pum', '0005_auto_20240329_0939'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='supplier',
|
||||||
|
name='can_outsource',
|
||||||
|
field=models.BooleanField(default=False, verbose_name='是否可外协'),
|
||||||
|
),
|
||||||
|
]
|
|
@ -12,6 +12,7 @@ class Supplier(CommonBModel):
|
||||||
contact = models.CharField('联系人', max_length=20, default='', blank=True)
|
contact = models.CharField('联系人', max_length=20, default='', blank=True)
|
||||||
contact_phone = models.CharField('联系电话', max_length=11, default='', blank=True)
|
contact_phone = models.CharField('联系电话', max_length=11, default='', blank=True)
|
||||||
address = models.CharField('地址', max_length=200, default='', blank=True)
|
address = models.CharField('地址', max_length=200, default='', blank=True)
|
||||||
|
can_outsource = models.BooleanField('是否可外协', default=False)
|
||||||
|
|
||||||
|
|
||||||
class PuPlan(CommonBModel):
|
class PuPlan(CommonBModel):
|
||||||
|
|
|
@ -23,6 +23,7 @@ class SupplierViewSet(CustomModelViewSet):
|
||||||
queryset = Supplier.objects.all()
|
queryset = Supplier.objects.all()
|
||||||
serializer_class = SupplierSerializer
|
serializer_class = SupplierSerializer
|
||||||
search_fields = ['name', 'contact']
|
search_fields = ['name', 'contact']
|
||||||
|
filterset_fields = ['can_outsource']
|
||||||
|
|
||||||
def perform_destroy(self, instance):
|
def perform_destroy(self, instance):
|
||||||
if PuOrder.objects.filter(supplier=instance).exists():
|
if PuOrder.objects.filter(supplier=instance).exists():
|
||||||
|
|
Loading…
Reference in New Issue