forked from erp-dev/erp
fix: has_started was not exclude is_cancelled=True status node
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user