1
0
forked from test/crm

更新为pagestatus

This commit is contained in:
jingrow 2025-10-23 21:04:02 +08:00
parent 155bed7d19
commit 707722de6d
4 changed files with 11 additions and 11 deletions

View File

@ -238,7 +238,7 @@ class CRMLead(Page):
"modified",
"modified_by",
"idx",
"docstatus",
"pagestatus",
"status",
"email",
"mobile_no",

View File

@ -3,7 +3,7 @@
"content": "[{\"id\":\"1nr6UkvDiL\",\"type\":\"header\",\"data\":{\"text\":\"<span class=\\\"h5\\\"><b>PORTAL</b></span>\",\"col\":12}},{\"id\":\"1hyi8SysUY\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"CRM Portal Page\",\"col\":3}},{\"id\":\"ktENiGaqXQ\",\"type\":\"spacer\",\"data\":{\"col\":12}},{\"id\":\"VgeWLYOuAS\",\"type\":\"paragraph\",\"data\":{\"text\":\"<b>SHORTCUTS</b>\",\"col\":12}},{\"id\":\"A66FpG-K3T\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Leads\",\"col\":3}},{\"id\":\"n9b6N5ebOj\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Deals\",\"col\":3}},{\"id\":\"sGHTXrludH\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Organizations\",\"col\":3}},{\"id\":\"uXZNCdqxy0\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Contacts\",\"col\":3}},{\"id\":\"v1kkMwlntf\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"SLA\",\"col\":3}},{\"id\":\"WRzt4SMh_b\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Assignment Rule\",\"col\":3}},{\"id\":\"TZ7cULX3Tk\",\"type\":\"spacer\",\"data\":{\"col\":12}},{\"id\":\"zpySv0nGVQ\",\"type\":\"paragraph\",\"data\":{\"text\":\"<b>META</b>\",\"col\":12}},{\"id\":\"fa-uKzobpp\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Lead Statuses\",\"col\":3}},{\"id\":\"hxoZghUHP2\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Deal Statuses\",\"col\":3}},{\"id\":\"HbgghUpc8N\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Lead Sources\",\"col\":3}},{\"id\":\"8cPs7Fohb4\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Industries\",\"col\":3}},{\"id\":\"arT4xZ9HWR\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Territories\",\"col\":3}},{\"id\":\"ApHOcISpiJ\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Communication Statuses\",\"col\":3}}]",
"creation": "2023-11-27 13:55:17.090361",
"custom_blocks": [],
"docstatus": 0,
"pagestatus": 0,
"pagetype": "Workspace",
"for_user": "",
"hide_custom": 0,

View File

@ -4,7 +4,7 @@ import jingrow
import phonenumbers
import requests
from jingrow import _
from jingrow.model.docstatus import DocStatus
from jingrow.model.pagestatus import DocStatus
from jingrow.model.dynamic_links import get_dynamic_link_map
from jingrow.utils import floor
from phonenumbers import NumberParseException
@ -134,7 +134,7 @@ def get_linked_docs(pg, method="Delete"):
docs.append({"pg": pg.name, "link_dt": link_dt, "link_field": link_field})
continue
fields = ["name", "docstatus"]
fields = ["name", "pagestatus"]
if meta.istable:
fields.extend(["parent", "parenttype"])
@ -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.docstatus).is_submitted()):
if method != "Delete" and (method != "Cancel" or not DocStatus(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.docstatus).is_cancelled())
(method == "Delete" and not DocStatus(refdoc.pagestatus).is_cancelled())
# linked to a submitted pg when cancelling
or (method == "Cancel" and DocStatus(refdoc.docstatus).is_submitted())
or (method == "Cancel" and DocStatus(refdoc.pagestatus).is_submitted())
)
):
docs.append({"pg": pg.name, "reference_pagetype": df.parent, "reference_docname": df.parent})
@ -198,15 +198,15 @@ def get_dynamic_linked_docs(pg, method="Delete"):
# dynamic link in table
df["table"] = ", `parent`, `parenttype`, `idx`" if meta.istable else ""
for refdoc in jingrow.db.sql(
"""select `name`, `docstatus` {table} from `tab{parent}` where
"""select `name`, `pagestatus` {table} from `tab{parent}` where
`{options}`=%s and `{fieldname}`=%s""".format(**df),
(pg.pagetype, pg.name),
as_dict=True,
):
# linked to an non-cancelled pg when deleting
# or linked to a submitted pg when cancelling
if (method == "Delete" and not DocStatus(refdoc.docstatus).is_cancelled()) or (
method == "Cancel" and DocStatus(refdoc.docstatus).is_submitted()
if (method == "Delete" and not DocStatus(refdoc.pagestatus).is_cancelled()) or (
method == "Cancel" and DocStatus(refdoc.pagestatus).is_submitted()
):
reference_pagetype = refdoc.parenttype if meta.istable else df.parent
reference_docname = refdoc.parent if meta.istable else refdoc.name

View File

@ -263,7 +263,7 @@ const fields = createResource({
'creation',
'modified',
'modified_by',
'docstatus',
'pagestatus',
'_comments',
'_user_tags',
'_assign',