更新为pagestatus
This commit is contained in:
parent
155bed7d19
commit
707722de6d
@ -238,7 +238,7 @@ class CRMLead(Page):
|
|||||||
"modified",
|
"modified",
|
||||||
"modified_by",
|
"modified_by",
|
||||||
"idx",
|
"idx",
|
||||||
"docstatus",
|
"pagestatus",
|
||||||
"status",
|
"status",
|
||||||
"email",
|
"email",
|
||||||
"mobile_no",
|
"mobile_no",
|
||||||
|
|||||||
@ -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}}]",
|
"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",
|
"creation": "2023-11-27 13:55:17.090361",
|
||||||
"custom_blocks": [],
|
"custom_blocks": [],
|
||||||
"docstatus": 0,
|
"pagestatus": 0,
|
||||||
"pagetype": "Workspace",
|
"pagetype": "Workspace",
|
||||||
"for_user": "",
|
"for_user": "",
|
||||||
"hide_custom": 0,
|
"hide_custom": 0,
|
||||||
|
|||||||
@ -4,7 +4,7 @@ import jingrow
|
|||||||
import phonenumbers
|
import phonenumbers
|
||||||
import requests
|
import requests
|
||||||
from jingrow import _
|
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.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
|
||||||
@ -134,7 +134,7 @@ def get_linked_docs(pg, method="Delete"):
|
|||||||
docs.append({"pg": pg.name, "link_dt": link_dt, "link_field": link_field})
|
docs.append({"pg": pg.name, "link_dt": link_dt, "link_field": link_field})
|
||||||
continue
|
continue
|
||||||
|
|
||||||
fields = ["name", "docstatus"]
|
fields = ["name", "pagestatus"]
|
||||||
|
|
||||||
if meta.istable:
|
if meta.istable:
|
||||||
fields.extend(["parent", "parenttype"])
|
fields.extend(["parent", "parenttype"])
|
||||||
@ -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.docstatus).is_submitted()):
|
if method != "Delete" and (method != "Cancel" or not DocStatus(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.docstatus).is_cancelled())
|
(method == "Delete" and not DocStatus(refdoc.pagestatus).is_cancelled())
|
||||||
# linked to a submitted pg when cancelling
|
# 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})
|
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
|
# dynamic link in table
|
||||||
df["table"] = ", `parent`, `parenttype`, `idx`" if meta.istable else ""
|
df["table"] = ", `parent`, `parenttype`, `idx`" if meta.istable else ""
|
||||||
for refdoc in jingrow.db.sql(
|
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),
|
`{options}`=%s and `{fieldname}`=%s""".format(**df),
|
||||||
(pg.pagetype, pg.name),
|
(pg.pagetype, pg.name),
|
||||||
as_dict=True,
|
as_dict=True,
|
||||||
):
|
):
|
||||||
# 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.docstatus).is_cancelled()) or (
|
if (method == "Delete" and not DocStatus(refdoc.pagestatus).is_cancelled()) or (
|
||||||
method == "Cancel" and DocStatus(refdoc.docstatus).is_submitted()
|
method == "Cancel" and DocStatus(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
|
||||||
|
|||||||
@ -263,7 +263,7 @@ const fields = createResource({
|
|||||||
'creation',
|
'creation',
|
||||||
'modified',
|
'modified',
|
||||||
'modified_by',
|
'modified_by',
|
||||||
'docstatus',
|
'pagestatus',
|
||||||
'_comments',
|
'_comments',
|
||||||
'_user_tags',
|
'_user_tags',
|
||||||
'_assign',
|
'_assign',
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user