更新为PageStatus
This commit is contained in:
parent
707722de6d
commit
e819d8aca0
@ -4,7 +4,7 @@ import jingrow
|
||||
import phonenumbers
|
||||
import requests
|
||||
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.utils import floor
|
||||
from phonenumbers import NumberParseException
|
||||
@ -147,7 +147,7 @@ def get_linked_docs(pg, method="Delete"):
|
||||
if linked_parent_pagetype in ignored_doctypes:
|
||||
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
|
||||
# linked to a non-cancelled pg when deleting or to a submitted pg when cancelling
|
||||
continue
|
||||
@ -188,9 +188,9 @@ def get_dynamic_linked_docs(pg, method="Delete"):
|
||||
and refdoc.get(df.fieldname) == pg.name
|
||||
and (
|
||||
# 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
|
||||
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})
|
||||
@ -205,8 +205,8 @@ def get_dynamic_linked_docs(pg, method="Delete"):
|
||||
):
|
||||
# linked to an non-cancelled pg when deleting
|
||||
# or linked to a submitted pg when cancelling
|
||||
if (method == "Delete" and not DocStatus(refdoc.pagestatus).is_cancelled()) or (
|
||||
method == "Cancel" and DocStatus(refdoc.pagestatus).is_submitted()
|
||||
if (method == "Delete" and not PageStatus(refdoc.pagestatus).is_cancelled()) or (
|
||||
method == "Cancel" and PageStatus(refdoc.pagestatus).is_submitted()
|
||||
):
|
||||
reference_pagetype = refdoc.parenttype if meta.istable else df.parent
|
||||
reference_docname = refdoc.parent if meta.istable else refdoc.name
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user