1
0
forked from erp-dev/erp

fix: has_started was not exclude is_cancelled=True status node

This commit is contained in:
2025-12-05 22:52:16 +08:00
parent 642d167305
commit e95e61f3ae
2 changed files with 276 additions and 6 deletions

View File

@@ -189,14 +189,15 @@ class PlateOrder(ModelBase):
@property
def has_started(self) -> bool:
"""判断是否已开始"""
"""判断是否已开始(有未撤销的状态记录)"""
if not self.business_object:
return False
# 检查是否有状态流转记录
# 检查未撤销的记录
from stateflow.models import StateFlowRecord
has_records = StateFlowRecord.objects.filter(
business_object=self.business_object
business_object=self.business_object,
is_cancelled=False
).exists()
return has_records
@@ -351,14 +352,15 @@ class PrintingJob(ModelBase):
@property
def has_started(self) -> bool:
"""判断是否已开始(有BusinessObject且有状态记录或不在初始状态"""
"""判断是否已开始(有未撤销的状态记录"""
if not self.business_object:
return False
# 检查是否有状态流转记录
# 检查未撤销的记录
from stateflow.models import StateFlowRecord
has_records = StateFlowRecord.objects.filter(
business_object=self.business_object
business_object=self.business_object,
is_cancelled=False
).exists()
return has_records