1
0
forked from test/crm

更新为PageStatus

This commit is contained in:
jingrow 2025-10-23 21:05:17 +08:00
parent 707722de6d
commit e819d8aca0

View File

@ -4,7 +4,7 @@ import jingrow
import phonenumbers import phonenumbers
import requests import requests
from jingrow import _ from jingrow import _
from jingrow.model.pagestatus import DocStatus from jingrow.model.pagestatus import PageStatus
from jingrow.model.dynamic_links import get_dynamic_link_map from jingrow.model.dynamic_links import get_dynamic_link_map
from jingrow.utils import floor from jingrow.utils import floor
from phonenumbers import NumberParseException from phonenumbers import NumberParseException
@ -147,7 +147,7 @@ def get_linked_docs(pg, method="Delete"):
if linked_parent_pagetype in ignored_doctypes: if linked_parent_pagetype in ignored_doctypes:
continue continue
if method != "Delete" and (method != "Cancel" or not DocStatus(item.pagestatus).is_submitted()): if method != "Delete" and (method != "Cancel" or not PageStatus(item.pagestatus).is_submitted()):
# don't raise exception if not # don't raise exception if not
# linked to a non-cancelled pg when deleting or to a submitted pg when cancelling # linked to a non-cancelled pg when deleting or to a submitted pg when cancelling
continue continue
@ -188,9 +188,9 @@ def get_dynamic_linked_docs(pg, method="Delete"):
and refdoc.get(df.fieldname) == pg.name and refdoc.get(df.fieldname) == pg.name
and ( and (
# linked to an non-cancelled pg when deleting # linked to an non-cancelled pg when deleting
(method == "Delete" and not DocStatus(refdoc.pagestatus).is_cancelled()) (method == "Delete" and not PageStatus(refdoc.pagestatus).is_cancelled())
# linked to a submitted pg when cancelling # linked to a submitted pg when cancelling
or (method == "Cancel" and DocStatus(refdoc.pagestatus).is_submitted()) or (method == "Cancel" and PageStatus(refdoc.pagestatus).is_submitted())
) )
): ):
docs.append({"pg": pg.name, "reference_pagetype": df.parent, "reference_docname": df.parent}) docs.append({"pg": pg.name, "reference_pagetype": df.parent, "reference_docname": df.parent})
@ -205,8 +205,8 @@ def get_dynamic_linked_docs(pg, method="Delete"):
): ):
# linked to an non-cancelled pg when deleting # linked to an non-cancelled pg when deleting
# or linked to a submitted pg when cancelling # or linked to a submitted pg when cancelling
if (method == "Delete" and not DocStatus(refdoc.pagestatus).is_cancelled()) or ( if (method == "Delete" and not PageStatus(refdoc.pagestatus).is_cancelled()) or (
method == "Cancel" and DocStatus(refdoc.pagestatus).is_submitted() method == "Cancel" and PageStatus(refdoc.pagestatus).is_submitted()
): ):
reference_pagetype = refdoc.parenttype if meta.istable else df.parent reference_pagetype = refdoc.parenttype if meta.istable else df.parent
reference_docname = refdoc.parent if meta.istable else refdoc.name reference_docname = refdoc.parent if meta.istable else refdoc.name