wproductflow child字段修改
This commit is contained in:
parent
feebb616a9
commit
b0ea55121b
|
@ -0,0 +1,19 @@
|
||||||
|
# Generated by Django 3.2.9 on 2022-03-17 00:30
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
import django.db.models.deletion
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('wpm', '0054_auto_20220315_1500'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='wproductflow',
|
||||||
|
name='child',
|
||||||
|
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='wpf_child', to='wpm.wproduct'),
|
||||||
|
),
|
||||||
|
]
|
|
@ -100,7 +100,7 @@ class WProduct(CommonAModel):
|
||||||
act_state = models.IntegerField(
|
act_state = models.IntegerField(
|
||||||
'进行状态', default=0, choices=act_state_choices)
|
'进行状态', default=0, choices=act_state_choices)
|
||||||
is_hidden = models.BooleanField('是否隐藏', default=False)
|
is_hidden = models.BooleanField('是否隐藏', default=False)
|
||||||
child = models.ForeignKey('self', blank=True, null=True,
|
child = models.ForeignKey('wpm.wproduct', blank=True, null=True,
|
||||||
on_delete=models.CASCADE, related_name='wp_child')
|
on_delete=models.CASCADE, related_name='wp_child')
|
||||||
remark = models.CharField('备注', max_length=200, null=True, blank=True)
|
remark = models.CharField('备注', max_length=200, null=True, blank=True)
|
||||||
subproduction_plan = models.ForeignKey(SubProductionPlan, verbose_name='当前子生产计划', on_delete=models.CASCADE,
|
subproduction_plan = models.ForeignKey(SubProductionPlan, verbose_name='当前子生产计划', on_delete=models.CASCADE,
|
||||||
|
@ -176,7 +176,7 @@ class WproductFlow(CommonAModel):
|
||||||
act_state = models.IntegerField(
|
act_state = models.IntegerField(
|
||||||
'进行状态', default=0, choices=WProduct.act_state_choices)
|
'进行状态', default=0, choices=WProduct.act_state_choices)
|
||||||
is_hidden = models.BooleanField('是否隐藏', default=False)
|
is_hidden = models.BooleanField('是否隐藏', default=False)
|
||||||
child = models.ForeignKey('self', blank=True, null=True,
|
child = models.ForeignKey('wpm.wproduct', blank=True, null=True,
|
||||||
on_delete=models.CASCADE, related_name='wpf_child')
|
on_delete=models.CASCADE, related_name='wpf_child')
|
||||||
remark = models.CharField('备注', max_length=200, null=True, blank=True)
|
remark = models.CharField('备注', max_length=200, null=True, blank=True)
|
||||||
subproduction_plan = models.ForeignKey(
|
subproduction_plan = models.ForeignKey(
|
||||||
|
|
|
@ -162,9 +162,8 @@ class WpmService(object):
|
||||||
ins = WproductFlow()
|
ins = WproductFlow()
|
||||||
ins.wproduct = instance
|
ins.wproduct = instance
|
||||||
for f in WproductFlow._meta.fields:
|
for f in WproductFlow._meta.fields:
|
||||||
if f.name not in ['id', 'wproduct', 'is_lastlog', 'child']:
|
if f.name not in ['id', 'wproduct', 'is_lastlog']:
|
||||||
setattr(ins, f.name, getattr(instance, f.name, None))
|
setattr(ins, f.name, getattr(instance, f.name, None))
|
||||||
ins.child = instance.child
|
|
||||||
ins.change_str = change_str
|
ins.change_str = change_str
|
||||||
ins.save()
|
ins.save()
|
||||||
|
|
||||||
|
@ -179,9 +178,8 @@ class WpmService(object):
|
||||||
ins = WproductFlow()
|
ins = WproductFlow()
|
||||||
ins.wproduct = i
|
ins.wproduct = i
|
||||||
for f in WproductFlow._meta.fields:
|
for f in WproductFlow._meta.fields:
|
||||||
if f.name not in ['id', 'wproduct', 'is_lastlog', 'child']:
|
if f.name not in ['id', 'wproduct', 'is_lastlog']:
|
||||||
setattr(ins, f.name, getattr(i, f.name, None))
|
setattr(ins, f.name, getattr(i, f.name, None))
|
||||||
ins.child = i.child
|
|
||||||
ins.change_str = change_str
|
ins.change_str = change_str
|
||||||
wfw.append(ins)
|
wfw.append(ins)
|
||||||
WproductFlow.objects.bulk_create(wfw)
|
WproductFlow.objects.bulk_create(wfw)
|
||||||
|
|
Loading…
Reference in New Issue