forked from erp-dev/erp
fix: business.object_id maybe null, missing parameters when plate-Order cloned
This commit is contained in:
@@ -121,6 +121,12 @@ class PlateOrderAdmin(admin.ModelAdmin):
|
||||
messages.append(f"{obj.id}: 没有关联的流程实例,无法推进")
|
||||
continue
|
||||
|
||||
# 修复历史/异常数据:确保该订单的流程实例正确绑定到订单(避免 BusinessObject.object_id/content_type 为空)
|
||||
services.ensure_business_object_bound_to_instance(
|
||||
obj.business_object,
|
||||
obj,
|
||||
default_name=f"PlateOrder-{obj.id}",
|
||||
)
|
||||
success, message, state_log = services.advance_to_next_state(obj.business_object, request.user)
|
||||
if success:
|
||||
success_count += 1
|
||||
@@ -375,6 +381,12 @@ class PrintingJobAdmin(admin.ModelAdmin):
|
||||
messages.append(f"PrintingJob #{obj.id}: 没有关联的业务对象,无法推进")
|
||||
continue
|
||||
|
||||
# 修复历史/异常数据:确保该 job 的流程实例正确绑定到 job(避免 BusinessObject.object_id/content_type 为空)
|
||||
services.ensure_business_object_bound_to_instance(
|
||||
obj.business_object,
|
||||
obj,
|
||||
default_name=f"PrintingJob-{obj.id}",
|
||||
)
|
||||
success, message, state_log = services.advance_to_next_state(obj.business_object, request.user)
|
||||
if success:
|
||||
success_count += 1
|
||||
|
||||
Reference in New Issue
Block a user