1
0
forked from erp-dev/erp

added image_name to PlateOrder model

This commit is contained in:
2025-11-27 15:14:34 +08:00
parent a9c75a13fa
commit 0fa153849c
12 changed files with 108 additions and 432 deletions

View File

@@ -16,6 +16,7 @@ class PlateOrder(ModelBase):
plate_date = models.DateTimeField(null=True, blank=True, verbose_name='下版时间')
plate_method = models.CharField(max_length=50, blank=True, null=True, verbose_name='开版方式')
plate_image = models.FileField(upload_to='plate_images/', null=True, blank=True, verbose_name='开版图')
image_name = models.CharField(max_length=100, blank=True, null=True, verbose_name='图片名称')
plate_notes = models.TextField(blank=True, null=True, verbose_name='打版注意事项')
reprint_reason = models.TextField(blank=True, null=True, verbose_name='复版原因')
@@ -113,10 +114,17 @@ class PlateOrder(ModelBase):
"""保存时自动创建 BusinessObject"""
# 先保存以获取 ID如果是新建
is_new = self.pk is None
update_fields = kwargs.get('update_fields')
super().save(*args, **kwargs)
should_auto_create = (
self.process
and not self.business_object
and (is_new or update_fields is None or 'process' in (update_fields or []))
)
# 如果有 process 且没有 business_object则自动创建
if self.process and not self.business_object:
if should_auto_create:
try:
from stateflow.models import Process
process_obj = Process.objects.get(id=self.process)