update to pagestatus
This commit is contained in:
parent
d7fa8e6d0f
commit
4a1f86467b
@ -13,7 +13,7 @@ context("Report View", () => {
|
||||
title: "Pg 1",
|
||||
description: "Random Text",
|
||||
enabled: 0,
|
||||
docstatus: 1, // submit document
|
||||
pagestatus: 1, // submit document
|
||||
},
|
||||
true
|
||||
);
|
||||
@ -23,7 +23,7 @@ context("Report View", () => {
|
||||
cy.intercept("POST", "api/method/jingrow.client.set_value").as("value-update");
|
||||
cy.visit(`/app/List/${pagetype_name}/Report`);
|
||||
|
||||
// check status column added from docstatus
|
||||
// check status column added from pagestatus
|
||||
cy.get(".dt-row-0 > .dt-cell--col-3").should("contain", "Submitted");
|
||||
let cell = cy.get(".dt-row-0 > .dt-cell--col-4");
|
||||
|
||||
|
||||
@ -1849,7 +1849,7 @@ def copy_pg(pg: "Document", ignore_no_copy: bool = True) -> "Document":
|
||||
fields_to_clear = ["name", "owner", "creation", "modified", "modified_by"]
|
||||
|
||||
if not local.flags.in_test:
|
||||
fields_to_clear.append("docstatus")
|
||||
fields_to_clear.append("pagestatus")
|
||||
|
||||
if not isinstance(pg, dict):
|
||||
d = pg.as_dict()
|
||||
|
||||
@ -305,8 +305,8 @@ class TestAutoAssign(JingrowTestCase):
|
||||
assignment_rule.rule = "Round Robin"
|
||||
assignment_rule.extend("assignment_days", self.days)
|
||||
assignment_rule.append("users", {"user": "test@example.com"})
|
||||
assignment_rule.assign_condition = "docstatus == 1"
|
||||
assignment_rule.unassign_condition = "docstatus == 2"
|
||||
assignment_rule.assign_condition = "pagestatus == 1"
|
||||
assignment_rule.unassign_condition = "pagestatus == 2"
|
||||
assignment_rule.save()
|
||||
|
||||
# create a submittable pg
|
||||
|
||||
@ -244,7 +244,7 @@ class AutoRepeat(Document):
|
||||
return new_pg
|
||||
|
||||
def update_pg(self, new_pg, reference_pg):
|
||||
new_pg.docstatus = 0
|
||||
new_pg.pagestatus = 0
|
||||
if new_pg.meta.get_field("set_posting_time"):
|
||||
new_pg.set("set_posting_time", 1)
|
||||
|
||||
@ -283,7 +283,7 @@ class AutoRepeat(Document):
|
||||
fields=["name", "from_date", "to_date"],
|
||||
filters=[
|
||||
["auto_repeat", "=", self.name],
|
||||
["docstatus", "<", 2],
|
||||
["pagestatus", "<", 2],
|
||||
],
|
||||
order_by="creation desc",
|
||||
limit=1,
|
||||
|
||||
@ -227,9 +227,9 @@ class TestAutoRepeat(JingrowTestCase):
|
||||
data = get_auto_repeat_entries(current_date)
|
||||
create_repeated_entries(data)
|
||||
docnames = jingrow.get_all(
|
||||
pg.reference_pagetype, filters={"auto_repeat": pg.name}, fields=["docstatus"], limit=1
|
||||
pg.reference_pagetype, filters={"auto_repeat": pg.name}, fields=["pagestatus"], limit=1
|
||||
)
|
||||
self.assertEqual(docnames[0].docstatus, 1)
|
||||
self.assertEqual(docnames[0].pagestatus, 1)
|
||||
|
||||
|
||||
def make_auto_repeat(**args):
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
"content": "[{\"id\":\"-P-RG1wVHg\",\"type\":\"header\",\"data\":{\"text\":\"<span class=\\\"h4\\\"><b>Your Shortcuts</b></span>\",\"col\":12}},{\"id\":\"sR-UFcO7II\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Import Data\",\"col\":3}},{\"id\":\"IkcVmgWb3z\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"ToDo\",\"col\":3}},{\"id\":\"6wir-jZFRE\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"File\",\"col\":3}},{\"id\":\"45a1jzQkTm\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Assignment Rule\",\"col\":3}},{\"id\":\"LdZrgvxxo7\",\"type\":\"spacer\",\"data\":{\"col\":12}},{\"id\":\"yNSSTIaDWZ\",\"type\":\"header\",\"data\":{\"text\":\"<span class=\\\"h4\\\"><b>Documents</b></span>\",\"col\":12}},{\"id\":\"0yceBIfhHM\",\"type\":\"card\",\"data\":{\"card_name\":\"Data\",\"col\":4}},{\"id\":\"42WbBA9rpj\",\"type\":\"card\",\"data\":{\"card_name\":\"Tools\",\"col\":4}},{\"id\":\"wE9n7TIrAc\",\"type\":\"card\",\"data\":{\"card_name\":\"Alerts and Notifications\",\"col\":4}},{\"id\":\"7_U7_xCOos\",\"type\":\"card\",\"data\":{\"card_name\":\"Email\",\"col\":4}},{\"id\":\"3imoh2oqsJ\",\"type\":\"card\",\"data\":{\"card_name\":\"Printing\",\"col\":4}},{\"id\":\"SlYKJZj5r3\",\"type\":\"card\",\"data\":{\"card_name\":\"Automation\",\"col\":4}},{\"id\":\"O7jrc2YQTN\",\"type\":\"card\",\"data\":{\"card_name\":\"Newsletter\",\"col\":4}}]",
|
||||
"creation": "2020-03-02 14:53:24.980279",
|
||||
"custom_blocks": [],
|
||||
"docstatus": 0,
|
||||
"pagestatus": 0,
|
||||
"pagetype": "Workspace",
|
||||
"for_user": "",
|
||||
"hide_custom": 0,
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
"apply_user_permissions": 1,
|
||||
"creation": "2017-01-19 12:57:22.881566",
|
||||
"disabled": 0,
|
||||
"docstatus": 0,
|
||||
"pagestatus": 0,
|
||||
"pagetype": "Report",
|
||||
"idx": 2,
|
||||
"is_standard": "Yes",
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"creation": "2021-11-23 12:38:52.807353",
|
||||
"docstatus": 0,
|
||||
"pagestatus": 0,
|
||||
"pagetype": "Form Tour",
|
||||
"first_document": 0,
|
||||
"idx": 0,
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
{
|
||||
"content": null,
|
||||
"creation": "2019-01-08 19:19:48.073410",
|
||||
"docstatus": 0,
|
||||
"pagestatus": 0,
|
||||
"pagetype": "Page",
|
||||
"idx": 0,
|
||||
"modified": "2020-12-16 12:29:08.610352",
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"creation": "2013-01-01 11:00:01.000000",
|
||||
"docstatus": 0,
|
||||
"pagestatus": 0,
|
||||
"pagetype": "Page",
|
||||
"icon": "fa fa-lock",
|
||||
"idx": 1,
|
||||
|
||||
@ -295,7 +295,7 @@ def export_json(pagetype, path, filters=None, or_filters=None, name=None, order_
|
||||
for v in pg.values():
|
||||
if isinstance(v, list):
|
||||
for child in v:
|
||||
for key in (*del_keys, "docstatus", "pagetype", "modified", "name"):
|
||||
for key in (*del_keys, "pagestatus", "pagetype", "modified", "name"):
|
||||
if key in child:
|
||||
del child[key]
|
||||
|
||||
|
||||
@ -1090,7 +1090,7 @@ def build_fields_dict_for_column_matching(parent_pagetype):
|
||||
else:
|
||||
standard_fields = [
|
||||
{"label": "Owner", "fieldname": "owner"},
|
||||
{"label": "Document Status", "fieldname": "docstatus", "fieldtype": "Int"},
|
||||
{"label": "Document Status", "fieldname": "pagestatus", "fieldtype": "Int"},
|
||||
]
|
||||
|
||||
out = []
|
||||
|
||||
@ -48,9 +48,9 @@ def restore(name, alert=True):
|
||||
|
||||
try:
|
||||
pg.insert()
|
||||
except jingrow.DocstatusTransitionError:
|
||||
except jingrow.PagestatusTransitionError:
|
||||
jingrow.msgprint(_("Cancelled Document restored as Draft"))
|
||||
pg.docstatus = 0
|
||||
pg.pagestatus = 0
|
||||
active_workflow = get_workflow_name(pg.pagetype)
|
||||
if active_workflow:
|
||||
workflow_state_fieldname = jingrow.get_value("Workflow", active_workflow, "workflow_state_field")
|
||||
|
||||
@ -151,7 +151,7 @@ class PageField(Document):
|
||||
unsaved = "unsaved" if not self.name else ""
|
||||
pagetype = self.__class__.__name__
|
||||
|
||||
docstatus = f" docstatus={self.docstatus}" if self.docstatus else ""
|
||||
pagestatus = f" pagestatus={self.pagestatus}" if self.pagestatus else ""
|
||||
parent = f" parent={self.parent}" if getattr(self, "parent", None) else ""
|
||||
|
||||
return f"<{self.fieldtype}{pagetype}: {self.fieldname}{docstatus}{parent}{unsaved}>"
|
||||
return f"<{self.fieldtype}{pagetype}: {self.fieldname}{pagestatus}{parent}{unsaved}>"
|
||||
|
||||
@ -465,7 +465,7 @@ class PageType(Document):
|
||||
"parenttype",
|
||||
"file_list",
|
||||
"flags",
|
||||
"docstatus",
|
||||
"pagestatus",
|
||||
)
|
||||
for d in self.get("fields"):
|
||||
if d.fieldtype:
|
||||
|
||||
@ -405,8 +405,8 @@ class TestDocType(JingrowTestCase):
|
||||
cancel_all_linked_docs(dump_docs)
|
||||
data_link_pg.cancel()
|
||||
data_pg.load_from_db()
|
||||
self.assertEqual(data_link_pg.docstatus, 2)
|
||||
self.assertEqual(data_pg.docstatus, 2)
|
||||
self.assertEqual(data_link_pg.pagestatus, 2)
|
||||
self.assertEqual(data_pg.pagestatus, 2)
|
||||
|
||||
# delete pagetype record
|
||||
data_pg.delete()
|
||||
@ -491,13 +491,13 @@ class TestDocType(JingrowTestCase):
|
||||
|
||||
data_pg.load_from_db()
|
||||
data_pg_2.load_from_db()
|
||||
self.assertEqual(data_link_pg_1.docstatus, 2)
|
||||
self.assertEqual(data_link_pg_1.pagestatus, 2)
|
||||
|
||||
# linked pg is canceled
|
||||
self.assertEqual(data_pg_2.docstatus, 2)
|
||||
self.assertEqual(data_pg_2.pagestatus, 2)
|
||||
|
||||
# ignored pagetype 2 during cancel
|
||||
self.assertEqual(data_pg.docstatus, 1)
|
||||
self.assertEqual(data_pg.pagestatus, 1)
|
||||
|
||||
# delete pagetype record
|
||||
data_pg.cancel()
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
"add_total_row": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"disabled": 0,
|
||||
"docstatus": 0,
|
||||
"pagestatus": 0,
|
||||
"pagetype": "Report",
|
||||
"is_standard": "No",
|
||||
"javascript": null,
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
"add_total_row": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"disabled": 0,
|
||||
"docstatus": 0,
|
||||
"pagestatus": 0,
|
||||
"pagetype": "Report",
|
||||
"is_standard": "No",
|
||||
"javascript": null,
|
||||
|
||||
@ -1039,7 +1039,7 @@ def user_query(pagetype, txt, searchfield, start, page_len, filters):
|
||||
|
||||
list_filters = {
|
||||
"enabled": 1,
|
||||
"docstatus": ["<", 2],
|
||||
"pagestatus": ["<", 2],
|
||||
}
|
||||
|
||||
# Check if we have a search term, and decide the filters depending on the search term
|
||||
|
||||
@ -152,9 +152,9 @@ def get_diff(old, new, for_child=False, compare_cancelled=False):
|
||||
if old_value != new_value:
|
||||
out.changed.append((df.fieldname, old_value, new_value))
|
||||
|
||||
# name & docstatus
|
||||
# name & pagestatus
|
||||
if not for_child:
|
||||
for key in ("name", "docstatus"):
|
||||
for key in ("name", "pagestatus"):
|
||||
old_value = getattr(old, key)
|
||||
new_value = getattr(new, key)
|
||||
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
"creation": "2022-10-19 02:25:24.326791",
|
||||
"disable_prepared_report": 0,
|
||||
"disabled": 0,
|
||||
"docstatus": 0,
|
||||
"pagestatus": 0,
|
||||
"pagetype": "Report",
|
||||
"filters": [],
|
||||
"idx": 0,
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
"apply_user_permissions": 1,
|
||||
"creation": "2015-02-05 06:01:35.060098",
|
||||
"disabled": 0,
|
||||
"docstatus": 0,
|
||||
"pagestatus": 0,
|
||||
"pagetype": "Report",
|
||||
"idx": 2,
|
||||
"is_standard": "Yes",
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
"add_total_row": 0,
|
||||
"creation": "2014-06-03 05:20:35.218263",
|
||||
"disabled": 0,
|
||||
"docstatus": 0,
|
||||
"pagestatus": 0,
|
||||
"pagetype": "Report",
|
||||
"idx": 3,
|
||||
"is_standard": "Yes",
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
"columns": [],
|
||||
"creation": "2024-12-18 11:58:00.693755",
|
||||
"disabled": 0,
|
||||
"docstatus": 0,
|
||||
"pagestatus": 0,
|
||||
"pagetype": "Report",
|
||||
"filters": [],
|
||||
"idx": 0,
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
"add_total_row": 0,
|
||||
"creation": "2018-03-15 18:37:48.783779",
|
||||
"disabled": 0,
|
||||
"docstatus": 0,
|
||||
"pagestatus": 0,
|
||||
"pagetype": "Report",
|
||||
"idx": 0,
|
||||
"is_standard": "Yes",
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
"client_script": "jingrow.web_form.after_load = () => {\n if (window.location.pathname.endsWith(\"/new\") && jingrow.session.user) {\n let current_path = window.location.href;\n window.location.href = current_path.replace(\"/new\", \"/\" + jingrow.session.user);\n }\n}",
|
||||
"creation": "2016-09-19 05:16:59.242754",
|
||||
"pg_type": "User",
|
||||
"docstatus": 0,
|
||||
"pagestatus": 0,
|
||||
"pagetype": "Web Form",
|
||||
"idx": 0,
|
||||
"introduction_text": "",
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
"content": "[{\"id\":\"5nnLaQeoFa\",\"type\":\"header\",\"data\":{\"text\":\"<span style=\\\"font-size: 18px; letter-spacing: 0.18px;\\\"><b>Get started</b><br></span>\",\"col\":12}},{\"id\":\"HXRmktXYHy\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"PageType\",\"col\":3}},{\"id\":\"pYALX3MwBW\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Customize Form\",\"col\":3}},{\"id\":\"XC78DuYB65\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Report\",\"col\":3}},{\"id\":\"XPm50Ppq3J\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Client Script\",\"col\":3}},{\"id\":\"yoU6nWiT83\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Server Script\",\"col\":3}},{\"id\":\"5UgFESBY0N\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Print Format Builder\",\"col\":3}},{\"id\":\"0gE0s-S70E\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"System Settings\",\"col\":3}},{\"id\":\"62hseENHbd\",\"type\":\"spacer\",\"data\":{\"col\":12}},{\"id\":\"tOCrOgLW1G\",\"type\":\"header\",\"data\":{\"text\":\"<span style=\\\"font-size: 18px; letter-spacing: 0.18px;\\\"><b>Components to build your app</b></span>\",\"col\":12}},{\"id\":\"cJ6CVsa8qW\",\"type\":\"card\",\"data\":{\"card_name\":\"Models\",\"col\":4}},{\"id\":\"MmEJpjEdGR\",\"type\":\"card\",\"data\":{\"card_name\":\"Views\",\"col\":4}},{\"id\":\"2ZdtgxQZqq\",\"type\":\"card\",\"data\":{\"card_name\":\"Customization\",\"col\":4}},{\"id\":\"NPFolijIcb\",\"type\":\"card\",\"data\":{\"card_name\":\"Scripting\",\"col\":4}},{\"id\":\"BIHjudL0T_\",\"type\":\"card\",\"data\":{\"card_name\":\"Modules\",\"col\":4}},{\"id\":\"iK3JQ9RXJE\",\"type\":\"card\",\"data\":{\"card_name\":\"Packages\",\"col\":4}},{\"id\":\"TiO9FCUUeC\",\"type\":\"card\",\"data\":{\"card_name\":\"System Logs\",\"col\":4}}]",
|
||||
"creation": "2021-01-02 10:51:16.579957",
|
||||
"custom_blocks": [],
|
||||
"docstatus": 0,
|
||||
"pagestatus": 0,
|
||||
"pagetype": "Workspace",
|
||||
"for_user": "",
|
||||
"hide_custom": 0,
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
"content": "[{\"id\":\"YpGCeLfign\",\"type\":\"header\",\"data\":{\"text\":\"<span class=\\\"h4\\\"><b>Your Shortcuts</b></span>\",\"col\":12}},{\"id\":\"b7abeqw4NZ\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"User\",\"col\":3}},{\"id\":\"eghSJPhZRC\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Role\",\"col\":3}},{\"id\":\"uAzl_lT_C0\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Permission Manager\",\"col\":3}},{\"id\":\"EpBz2lplSt\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"User Profile\",\"col\":3}},{\"id\":\"vHWhzaFoAH\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"User Type\",\"col\":3}},{\"id\":\"oFB4l28FMU\",\"type\":\"spacer\",\"data\":{\"col\":12}},{\"id\":\"yJNNylguxk\",\"type\":\"header\",\"data\":{\"text\":\"<span class=\\\"h4\\\"><b>Reports & Masters</b></span>\",\"col\":12}},{\"id\":\"NMpIkExl3i\",\"type\":\"card\",\"data\":{\"card_name\":\"Users\",\"col\":4}},{\"id\":\"VepG3durKm\",\"type\":\"card\",\"data\":{\"card_name\":\"Logs\",\"col\":4}},{\"id\":\"S9FeWt7xXE\",\"type\":\"card\",\"data\":{\"card_name\":\"Permissions\",\"col\":4}}]",
|
||||
"creation": "2020-03-02 15:12:16.754449",
|
||||
"custom_blocks": [],
|
||||
"docstatus": 0,
|
||||
"pagestatus": 0,
|
||||
"pagetype": "Workspace",
|
||||
"for_user": "",
|
||||
"hide_custom": 0,
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
"content": "[{\"id\":\"2eyXSHwMTE\",\"type\":\"header\",\"data\":{\"text\":\"<span class=\\\"h2\\\">Hi,</span>\",\"col\":12}},{\"id\":\"ZusKvFOXgu\",\"type\":\"paragraph\",\"data\":{\"text\":\"I guess you don't have access to any workspace yet, but you can create one just for yourself. Click on the <b>Create Workspace</b> button to create one.<br>\",\"col\":12}}]",
|
||||
"creation": "2023-07-28 17:14:28.608321",
|
||||
"custom_blocks": [],
|
||||
"docstatus": 0,
|
||||
"pagestatus": 0,
|
||||
"pagetype": "Workspace",
|
||||
"for_user": "",
|
||||
"hide_custom": 0,
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
{
|
||||
"docstatus": 0,
|
||||
"pagestatus": 0,
|
||||
"pagetype": "PageType",
|
||||
"name": "new-pagetype-2",
|
||||
"__islocal": 1,
|
||||
@ -38,7 +38,7 @@
|
||||
"engine": "InnoDB",
|
||||
"permissions": [
|
||||
{
|
||||
"docstatus": 0,
|
||||
"pagestatus": 0,
|
||||
"pagetype": "PagePerm",
|
||||
"name": "new-pageperm-2",
|
||||
"__islocal": 1,
|
||||
@ -71,7 +71,7 @@
|
||||
"module": "Custom",
|
||||
"fields": [
|
||||
{
|
||||
"docstatus": 0,
|
||||
"pagestatus": 0,
|
||||
"pagetype": "PageField",
|
||||
"name": "new-pagefield-1",
|
||||
"__islocal": 1,
|
||||
@ -117,7 +117,7 @@
|
||||
"label": "member_name"
|
||||
},
|
||||
{
|
||||
"docstatus": 0,
|
||||
"pagestatus": 0,
|
||||
"pagetype": "PageField",
|
||||
"name": "new-pagefield-2",
|
||||
"__islocal": 1,
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
{
|
||||
"docstatus": 0,
|
||||
"pagestatus": 0,
|
||||
"pagetype": "PageType",
|
||||
"name": "new-pagetype-1",
|
||||
"__islocal": 1,
|
||||
@ -38,7 +38,7 @@
|
||||
"engine": "InnoDB",
|
||||
"permissions": [
|
||||
{
|
||||
"docstatus": 0,
|
||||
"pagestatus": 0,
|
||||
"pagetype": "PagePerm",
|
||||
"name": "new-pageperm-1",
|
||||
"__islocal": 1,
|
||||
@ -71,7 +71,7 @@
|
||||
"module": "Custom",
|
||||
"fields": [
|
||||
{
|
||||
"docstatus": 0,
|
||||
"pagestatus": 0,
|
||||
"pagetype": "PageField",
|
||||
"name": "new-pagefield-1",
|
||||
"__islocal": 1,
|
||||
@ -117,7 +117,7 @@
|
||||
"label": "member_name"
|
||||
},
|
||||
{
|
||||
"docstatus": 0,
|
||||
"pagestatus": 0,
|
||||
"pagetype": "PageField",
|
||||
"name": "new-pagefield-2",
|
||||
"__islocal": 1,
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"creation": "2021-11-23 12:22:32.922700",
|
||||
"docstatus": 0,
|
||||
"pagestatus": 0,
|
||||
"pagetype": "Form Tour",
|
||||
"first_document": 0,
|
||||
"idx": 0,
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
}
|
||||
],
|
||||
"creation": "2021-11-23 12:21:11.384229",
|
||||
"docstatus": 0,
|
||||
"pagestatus": 0,
|
||||
"pagetype": "Module Onboarding",
|
||||
"documentation_url": "https://docs.jingrow.com/docs/v13/user/manual/en/customize-jerp",
|
||||
"idx": 0,
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
"action_label": "Learn how to add Custom Fields",
|
||||
"creation": "2021-11-23 12:21:09.479808",
|
||||
"description": "Every form in JERP has a standard set of fields. If you need to capture some information, but there is no standard Field available for it, you can insert Custom Field for it.\n\nOnce custom fields are added, you can use them for reports and analytics charts as well.\n",
|
||||
"docstatus": 0,
|
||||
"pagestatus": 0,
|
||||
"pagetype": "Onboarding Step",
|
||||
"idx": 0,
|
||||
"is_complete": 0,
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
"action_label": "Learn more about creating new DocTypes",
|
||||
"creation": "2021-11-23 12:30:04.407568",
|
||||
"description": "A PageType (Document Type) is used to insert forms in JERP. Forms such as Customer, Orders, and Invoices are Doctypes in the backend. You can also create new DocTypes to create new forms in JERP as per your business needs.",
|
||||
"docstatus": 0,
|
||||
"pagestatus": 0,
|
||||
"pagetype": "Onboarding Step",
|
||||
"idx": 0,
|
||||
"is_complete": 0,
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
"action": "Watch Video",
|
||||
"creation": "2021-11-23 13:57:45.091427",
|
||||
"description": "Each document created in JERP can have a unique ID generated for it, using a prefix defined for it. Though each document has some prefix pre-configured, you can further customize it using tools like Naming Series Tool and Document Naming Rule.\n",
|
||||
"docstatus": 0,
|
||||
"pagestatus": 0,
|
||||
"pagetype": "Onboarding Step",
|
||||
"idx": 0,
|
||||
"is_complete": 0,
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
"action_label": "Learn about Standard and Custom Print Formats",
|
||||
"creation": "2021-11-23 15:04:12.728513",
|
||||
"description": "Print Formats allow you can define looks for documents when printed or converted to PDF. You can also create a custom Print Format using drag-and-drop tools.",
|
||||
"docstatus": 0,
|
||||
"pagestatus": 0,
|
||||
"pagetype": "Onboarding Step",
|
||||
"idx": 0,
|
||||
"is_complete": 0,
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
"action_label": "Learn more about Report Builders",
|
||||
"creation": "2021-11-24 17:04:18.762838",
|
||||
"description": "In each module, you will find a host of single-click reports, ranging from financial statements to sales and purchase analytics and stock tracking reports. If a required new report is not available out-of-the-box, you can create custom reports in JERP by pulling values from the same multiple JERP tables.\n",
|
||||
"docstatus": 0,
|
||||
"pagestatus": 0,
|
||||
"pagetype": "Onboarding Step",
|
||||
"idx": 0,
|
||||
"is_complete": 0,
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
"action": "Watch Video",
|
||||
"creation": "2021-11-23 14:00:27.208500",
|
||||
"description": "In JERP, you can add your Employees as Users, and give them restricted access. Tools like Role Permission and User Permission allow you to define rules which give restricted access to the user to masters and transactions.",
|
||||
"docstatus": 0,
|
||||
"pagestatus": 0,
|
||||
"pagetype": "Onboarding Step",
|
||||
"idx": 0,
|
||||
"is_complete": 0,
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
"action": "Watch Video",
|
||||
"creation": "2021-11-23 13:58:58.530044",
|
||||
"description": "Workflows allow you to define custom rules for the approval process of a particular document in JERP. You can also set complex Workflow Rules and set approval conditions.",
|
||||
"docstatus": 0,
|
||||
"pagestatus": 0,
|
||||
"pagetype": "Onboarding Step",
|
||||
"idx": 0,
|
||||
"is_complete": 0,
|
||||
|
||||
@ -133,7 +133,7 @@ class CustomField(Document):
|
||||
"parenttype",
|
||||
"file_list",
|
||||
"flags",
|
||||
"docstatus",
|
||||
"pagestatus",
|
||||
)
|
||||
if not self.fieldname:
|
||||
label = self.label
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
"columns": [],
|
||||
"creation": "2023-01-25 15:02:21.896117",
|
||||
"disabled": 0,
|
||||
"docstatus": 0,
|
||||
"pagestatus": 0,
|
||||
"pagetype": "Report",
|
||||
"filters": [],
|
||||
"idx": 0,
|
||||
|
||||
@ -64,7 +64,7 @@ class Database:
|
||||
OPTIONAL_COLUMNS = ("_user_tags", "_comments", "_assign", "_liked_by")
|
||||
DEFAULT_SHORTCUTS = ("_Login", "__user", "_Full Name", "Today", "__today", "now", "Now")
|
||||
STANDARD_VARCHAR_COLUMNS = ("name", "owner", "modified_by")
|
||||
DEFAULT_COLUMNS = ("name", "creation", "modified", "modified_by", "owner", "docstatus", "idx")
|
||||
DEFAULT_COLUMNS = ("name", "creation", "modified", "modified_by", "owner", "pagestatus", "idx")
|
||||
CHILD_TABLE_COLUMNS = ("parent", "parenttype", "parentfield")
|
||||
MAX_WRITES_PER_TRANSACTION = 200_000
|
||||
|
||||
|
||||
@ -13,7 +13,7 @@ CREATE TABLE `tabPageField` (
|
||||
`modified` datetime(6) DEFAULT NULL,
|
||||
`modified_by` varchar(255) DEFAULT NULL,
|
||||
`owner` varchar(255) DEFAULT NULL,
|
||||
`docstatus` int(1) NOT NULL DEFAULT 0,
|
||||
`pagestatus` int(1) NOT NULL DEFAULT 0,
|
||||
`parent` varchar(255) DEFAULT NULL,
|
||||
`parentfield` varchar(255) DEFAULT NULL,
|
||||
`parenttype` varchar(255) DEFAULT NULL,
|
||||
@ -87,7 +87,7 @@ CREATE TABLE `tabPagePerm` (
|
||||
`modified` datetime(6) DEFAULT NULL,
|
||||
`modified_by` varchar(255) DEFAULT NULL,
|
||||
`owner` varchar(255) DEFAULT NULL,
|
||||
`docstatus` int(1) NOT NULL DEFAULT 0,
|
||||
`pagestatus` int(1) NOT NULL DEFAULT 0,
|
||||
`parent` varchar(255) DEFAULT NULL,
|
||||
`parentfield` varchar(255) DEFAULT NULL,
|
||||
`parenttype` varchar(255) DEFAULT NULL,
|
||||
@ -123,7 +123,7 @@ CREATE TABLE `tabPageType Action` (
|
||||
`modified` datetime(6) DEFAULT NULL,
|
||||
`modified_by` varchar(140) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
|
||||
`owner` varchar(140) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
|
||||
`docstatus` int(1) NOT NULL DEFAULT 0,
|
||||
`pagestatus` int(1) NOT NULL DEFAULT 0,
|
||||
`parent` varchar(140) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
|
||||
`parentfield` varchar(140) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
|
||||
`parenttype` varchar(140) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
|
||||
@ -148,7 +148,7 @@ CREATE TABLE `tabPageType Link` (
|
||||
`modified` datetime(6) DEFAULT NULL,
|
||||
`modified_by` varchar(140) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
|
||||
`owner` varchar(140) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
|
||||
`docstatus` int(1) NOT NULL DEFAULT 0,
|
||||
`pagestatus` int(1) NOT NULL DEFAULT 0,
|
||||
`parent` varchar(140) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
|
||||
`parentfield` varchar(140) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
|
||||
`parenttype` varchar(140) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
|
||||
@ -172,7 +172,7 @@ CREATE TABLE `tabPageType` (
|
||||
`modified` datetime(6) DEFAULT NULL,
|
||||
`modified_by` varchar(255) DEFAULT NULL,
|
||||
`owner` varchar(255) DEFAULT NULL,
|
||||
`docstatus` int(1) NOT NULL DEFAULT 0,
|
||||
`pagestatus` int(1) NOT NULL DEFAULT 0,
|
||||
`idx` int(8) NOT NULL DEFAULT 0,
|
||||
`search_fields` varchar(255) DEFAULT NULL,
|
||||
`issingle` int(1) NOT NULL DEFAULT 0,
|
||||
@ -297,7 +297,7 @@ CREATE TABLE `tabFile` (
|
||||
`modified` datetime(6) DEFAULT NULL,
|
||||
`modified_by` varchar(255) DEFAULT NULL,
|
||||
`owner` varchar(255) DEFAULT NULL,
|
||||
`docstatus` int(1) NOT NULL DEFAULT 0,
|
||||
`pagestatus` int(1) NOT NULL DEFAULT 0,
|
||||
`parent` varchar(255) DEFAULT NULL,
|
||||
`parentfield` varchar(255) DEFAULT NULL,
|
||||
`parenttype` varchar(255) DEFAULT NULL,
|
||||
@ -325,7 +325,7 @@ CREATE TABLE `tabDefaultValue` (
|
||||
`modified` datetime(6) DEFAULT NULL,
|
||||
`modified_by` varchar(255) DEFAULT NULL,
|
||||
`owner` varchar(255) DEFAULT NULL,
|
||||
`docstatus` int(1) NOT NULL DEFAULT 0,
|
||||
`pagestatus` int(1) NOT NULL DEFAULT 0,
|
||||
`parent` varchar(255) DEFAULT NULL,
|
||||
`parentfield` varchar(255) DEFAULT NULL,
|
||||
`parenttype` varchar(255) DEFAULT NULL,
|
||||
|
||||
@ -52,7 +52,7 @@ class MariaDBTable(DBTable):
|
||||
modified datetime(6),
|
||||
modified_by varchar({varchar_len}),
|
||||
owner varchar({varchar_len}),
|
||||
docstatus int(1) not null default '0',
|
||||
pagestatus int(1) not null default '0',
|
||||
idx int(8) not null default '0',
|
||||
{additional_definitions})
|
||||
ENGINE={engine}
|
||||
|
||||
@ -13,7 +13,7 @@ CREATE TABLE "tabPageField" (
|
||||
"modified" timestamp(6) DEFAULT NULL,
|
||||
"modified_by" varchar(255) DEFAULT NULL,
|
||||
"owner" varchar(255) DEFAULT NULL,
|
||||
"docstatus" smallint NOT NULL DEFAULT 0,
|
||||
"pagestatus" smallint NOT NULL DEFAULT 0,
|
||||
"parent" varchar(255) DEFAULT NULL,
|
||||
"parentfield" varchar(255) DEFAULT NULL,
|
||||
"parenttype" varchar(255) DEFAULT NULL,
|
||||
@ -87,7 +87,7 @@ CREATE TABLE "tabPagePerm" (
|
||||
"modified" timestamp(6) DEFAULT NULL,
|
||||
"modified_by" varchar(255) DEFAULT NULL,
|
||||
"owner" varchar(255) DEFAULT NULL,
|
||||
"docstatus" smallint NOT NULL DEFAULT 0,
|
||||
"pagestatus" smallint NOT NULL DEFAULT 0,
|
||||
"parent" varchar(255) DEFAULT NULL,
|
||||
"parentfield" varchar(255) DEFAULT NULL,
|
||||
"parenttype" varchar(255) DEFAULT NULL,
|
||||
@ -124,7 +124,7 @@ CREATE TABLE "tabPageType Action" (
|
||||
"modified" timestamp(6) DEFAULT NULL,
|
||||
"modified_by" varchar(255) DEFAULT NULL,
|
||||
"owner" varchar(255) DEFAULT NULL,
|
||||
"docstatus" smallint NOT NULL DEFAULT 0,
|
||||
"pagestatus" smallint NOT NULL DEFAULT 0,
|
||||
"parent" varchar(255) DEFAULT NULL,
|
||||
"parentfield" varchar(255) DEFAULT NULL,
|
||||
"parenttype" varchar(255) DEFAULT NULL,
|
||||
@ -149,7 +149,7 @@ CREATE TABLE "tabPageType Link" (
|
||||
"modified" timestamp(6) DEFAULT NULL,
|
||||
"modified_by" varchar(255) DEFAULT NULL,
|
||||
"owner" varchar(255) DEFAULT NULL,
|
||||
"docstatus" smallint NOT NULL DEFAULT 0,
|
||||
"pagestatus" smallint NOT NULL DEFAULT 0,
|
||||
"parent" varchar(255) DEFAULT NULL,
|
||||
"parentfield" varchar(255) DEFAULT NULL,
|
||||
"parenttype" varchar(255) DEFAULT NULL,
|
||||
@ -175,7 +175,7 @@ CREATE TABLE "tabPageType" (
|
||||
"modified" timestamp(6) DEFAULT NULL,
|
||||
"modified_by" varchar(255) DEFAULT NULL,
|
||||
"owner" varchar(255) DEFAULT NULL,
|
||||
"docstatus" smallint NOT NULL DEFAULT 0,
|
||||
"pagestatus" smallint NOT NULL DEFAULT 0,
|
||||
"idx" bigint NOT NULL DEFAULT 0,
|
||||
"search_fields" varchar(255) DEFAULT NULL,
|
||||
"issingle" smallint NOT NULL DEFAULT 0,
|
||||
@ -302,7 +302,7 @@ CREATE TABLE "tabFile" (
|
||||
"modified" timestamp(6) DEFAULT NULL,
|
||||
"modified_by" varchar(255) DEFAULT NULL,
|
||||
"owner" varchar(255) DEFAULT NULL,
|
||||
"docstatus" smallint NOT NULL DEFAULT 0,
|
||||
"pagestatus" smallint NOT NULL DEFAULT 0,
|
||||
"parent" varchar(255) DEFAULT NULL,
|
||||
"parentfield" varchar(255) DEFAULT NULL,
|
||||
"parenttype" varchar(255) DEFAULT NULL,
|
||||
@ -331,7 +331,7 @@ CREATE TABLE "tabDefaultValue" (
|
||||
"modified" timestamp(6) DEFAULT NULL,
|
||||
"modified_by" varchar(255) DEFAULT NULL,
|
||||
"owner" varchar(255) DEFAULT NULL,
|
||||
"docstatus" smallint NOT NULL DEFAULT 0,
|
||||
"pagestatus" smallint NOT NULL DEFAULT 0,
|
||||
"parent" varchar(255) DEFAULT NULL,
|
||||
"parentfield" varchar(255) DEFAULT NULL,
|
||||
"parenttype" varchar(255) DEFAULT NULL,
|
||||
|
||||
@ -33,7 +33,7 @@ class PostgresTable(DBTable):
|
||||
jingrow.db.create_sequence(self.pagetype, check_not_exists=True)
|
||||
name_column = "name bigint primary key"
|
||||
|
||||
# TODO: set docstatus length
|
||||
# TODO: set pagestatus length
|
||||
# create table
|
||||
jingrow.db.sql(
|
||||
f"""create table `{self.table_name}` (
|
||||
@ -42,7 +42,7 @@ class PostgresTable(DBTable):
|
||||
modified timestamp(6),
|
||||
modified_by varchar({varchar_len}),
|
||||
owner varchar({varchar_len}),
|
||||
docstatus smallint not null default '0',
|
||||
pagestatus smallint not null default '0',
|
||||
idx bigint not null default '0',
|
||||
{additional_definitions}
|
||||
)"""
|
||||
|
||||
@ -48,7 +48,7 @@ def get_submitted_linked_docs(pagetype: str, name: str, ignore_pagetypes_on_canc
|
||||
docs = []
|
||||
|
||||
for dt, names in visited_documents.items():
|
||||
docs.extend([{"pagetype": dt, "name": name, "docstatus": 1} for name in names])
|
||||
docs.extend([{"pagetype": dt, "name": name, "pagestatus": 1} for name in names])
|
||||
|
||||
return {"docs": docs, "count": len(docs)}
|
||||
|
||||
@ -119,7 +119,7 @@ class SubmittableDocumentTree:
|
||||
parent_names.copy(),
|
||||
field,
|
||||
get_parent_if_child_table_pg=True,
|
||||
parent_filters=[("docstatus", "=", 1)],
|
||||
parent_filters=[("pagestatus", "=", 1)],
|
||||
allowed_parents=self.get_link_sources(),
|
||||
)
|
||||
or {}
|
||||
@ -401,7 +401,7 @@ def validate_linked_pg(docinfo, ignore_pagetypes_on_cancel_all=None):
|
||||
return False
|
||||
|
||||
# skip draft or cancelled documents
|
||||
if docinfo.get("docstatus") != 1:
|
||||
if docinfo.get("pagestatus") != 1:
|
||||
return False
|
||||
|
||||
# skip other doctypes since they don't need to be cancelled
|
||||
@ -452,7 +452,7 @@ def get_linked_docs(pagetype: str, name: str, linkinfo: dict | None = None) -> d
|
||||
"fieldtype": ["not in", ("Image", "HTML", "Button", *jingrow.model.table_fields)],
|
||||
},
|
||||
)
|
||||
] + ["name", "modified", "docstatus"]
|
||||
] + ["name", "modified", "pagestatus"]
|
||||
|
||||
if add_fields := link_context.get("add_fields"):
|
||||
fields += add_fields
|
||||
|
||||
@ -223,7 +223,7 @@ class FormMeta(Meta):
|
||||
def load_print_formats(self):
|
||||
print_formats = jingrow.db.sql(
|
||||
"""select * FROM `tabPrint Format`
|
||||
WHERE pg_type=%s AND docstatus<2 and disabled=0""",
|
||||
WHERE pg_type=%s AND pagestatus<2 and disabled=0""",
|
||||
(self.name,),
|
||||
as_dict=1,
|
||||
update={"pagetype": "Print Format"},
|
||||
|
||||
@ -6,7 +6,7 @@ import json
|
||||
import jingrow
|
||||
from jingrow.core.pagetype.submission_queue.submission_queue import queue_submission
|
||||
from jingrow.desk.form.load import run_onload
|
||||
from jingrow.model.docstatus import DocStatus
|
||||
from jingrow.model.pagestatus import PageStatus
|
||||
from jingrow.monitor import add_data_to_monitor
|
||||
from jingrow.utils.scheduler import is_scheduler_inactive
|
||||
from jingrow.utils.telemetry import capture_pg
|
||||
@ -23,14 +23,14 @@ def savedocs(pg, action):
|
||||
set_local_name(pg)
|
||||
|
||||
# action
|
||||
pg.docstatus = {
|
||||
"Save": DocStatus.DRAFT,
|
||||
"Submit": DocStatus.SUBMITTED,
|
||||
"Update": DocStatus.SUBMITTED,
|
||||
"Cancel": DocStatus.CANCELLED,
|
||||
pg.pagestatus = {
|
||||
"Save": PageStatus.DRAFT,
|
||||
"Submit": PageStatus.SUBMITTED,
|
||||
"Update": PageStatus.SUBMITTED,
|
||||
"Cancel": PageStatus.CANCELLED,
|
||||
}[action]
|
||||
|
||||
if pg.docstatus.is_submitted():
|
||||
if pg.pagestatus.is_submitted():
|
||||
if action == "Submit" and pg.meta.queue_in_background and not is_scheduler_inactive():
|
||||
queue_submission(pg, action)
|
||||
return
|
||||
@ -43,7 +43,7 @@ def savedocs(pg, action):
|
||||
send_updated_docs(pg)
|
||||
|
||||
add_data_to_monitor(pagetype=pg.pagetype, action=action)
|
||||
status_message = "Submitted" if pg.docstatus.is_submitted() else "Saved"
|
||||
status_message = "Submitted" if pg.pagestatus.is_submitted() else "Saved"
|
||||
jingrow.msgprint(jingrow._(status_message), indicator="green", alert=True)
|
||||
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
{
|
||||
"content": null,
|
||||
"creation": "2015-09-24 01:26:06.225378",
|
||||
"docstatus": 0,
|
||||
"pagestatus": 0,
|
||||
"pagetype": "Page",
|
||||
"modified": "2015-09-24 01:26:06.225378",
|
||||
"modified_by": "Administrator",
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
{
|
||||
"content": null,
|
||||
"creation": "2017-06-06 02:54:24.785360",
|
||||
"docstatus": 0,
|
||||
"pagestatus": 0,
|
||||
"pagetype": "Page",
|
||||
"idx": 0,
|
||||
"modified": "2019-09-27 17:44:51.909947",
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
{
|
||||
"content": null,
|
||||
"creation": "2013-10-04 13:49:33",
|
||||
"docstatus": 0,
|
||||
"pagestatus": 0,
|
||||
"pagetype": "Page",
|
||||
"idx": 1,
|
||||
"modified": "2017-04-12 18:45:00.774654",
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
{
|
||||
"content": null,
|
||||
"creation": "2019-07-22 12:23:38.425877",
|
||||
"docstatus": 0,
|
||||
"pagestatus": 0,
|
||||
"pagetype": "Page",
|
||||
"idx": 0,
|
||||
"modified": "2020-03-02 15:17:13.041650",
|
||||
|
||||
@ -81,17 +81,17 @@ def _bulk_action(pagetype, docnames, action, data, task_id=None):
|
||||
pg = jingrow.get_pg(pagetype, docname)
|
||||
try:
|
||||
message = ""
|
||||
if action == "submit" and pg.docstatus.is_draft():
|
||||
if action == "submit" and pg.pagestatus.is_draft():
|
||||
if pg.meta.queue_in_background and not is_scheduler_inactive():
|
||||
queue_submission(pg, action)
|
||||
message = _("Queuing {0} for Submission").format(pagetype)
|
||||
else:
|
||||
pg.submit()
|
||||
message = _("Submitting {0}").format(pagetype)
|
||||
elif action == "cancel" and pg.docstatus.is_submitted():
|
||||
elif action == "cancel" and pg.pagestatus.is_submitted():
|
||||
pg.cancel()
|
||||
message = _("Cancelling {0}").format(pagetype)
|
||||
elif action == "update" and not pg.docstatus.is_cancelled():
|
||||
elif action == "update" and not pg.pagestatus.is_cancelled():
|
||||
pg.update(data)
|
||||
pg.save()
|
||||
message = _("Updating {0}").format(pagetype)
|
||||
|
||||
@ -27,22 +27,22 @@ class TestBulkUpdate(JingrowTestCase):
|
||||
time.sleep(0.2)
|
||||
|
||||
def test_bulk_submit_in_background(self):
|
||||
unsubmitted = jingrow.get_all(self.pagetype, {"docstatus": 0}, limit=5, pluck="name")
|
||||
unsubmitted = jingrow.get_all(self.pagetype, {"pagestatus": 0}, limit=5, pluck="name")
|
||||
failed = submit_cancel_or_update_docs(self.pagetype, unsubmitted, action="submit")
|
||||
self.assertEqual(failed, [])
|
||||
|
||||
def check_docstatus(docs, status):
|
||||
def check_pagestatus(docs, status):
|
||||
jingrow.db.rollback()
|
||||
matching_docs = jingrow.get_all(
|
||||
self.pagetype, {"docstatus": status, "name": ("in", docs)}, pluck="name"
|
||||
self.pagetype, {"pagestatus": status, "name": ("in", docs)}, pluck="name"
|
||||
)
|
||||
return set(matching_docs) == set(docs)
|
||||
|
||||
unsubmitted = jingrow.get_all(self.pagetype, {"docstatus": 0}, limit=20, pluck="name")
|
||||
unsubmitted = jingrow.get_all(self.pagetype, {"pagestatus": 0}, limit=20, pluck="name")
|
||||
submit_cancel_or_update_docs(self.pagetype, unsubmitted, action="submit")
|
||||
|
||||
self.wait_for_assertion(lambda: check_docstatus(unsubmitted, 1))
|
||||
self.wait_for_assertion(lambda: check_pagestatus(unsubmitted, 1))
|
||||
|
||||
submitted = jingrow.get_all(self.pagetype, {"docstatus": 1}, limit=20, pluck="name")
|
||||
submitted = jingrow.get_all(self.pagetype, {"pagestatus": 1}, limit=20, pluck="name")
|
||||
submit_cancel_or_update_docs(self.pagetype, submitted, action="cancel")
|
||||
self.wait_for_assertion(lambda: check_docstatus(submitted, 2))
|
||||
self.wait_for_assertion(lambda: check_pagestatus(submitted, 2))
|
||||
|
||||
@ -125,7 +125,7 @@ def get(
|
||||
filters = []
|
||||
|
||||
# don't include cancelled documents
|
||||
filters.append([chart.document_type, "docstatus", "<", 2, False])
|
||||
filters.append([chart.document_type, "pagestatus", "<", 2, False])
|
||||
|
||||
if chart.chart_type == "Group By":
|
||||
chart_config = get_group_by_chart_config(chart, filters)
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
"apply_user_permissions": 1,
|
||||
"creation": "2013-02-25 14:26:30",
|
||||
"disabled": 0,
|
||||
"docstatus": 0,
|
||||
"pagestatus": 0,
|
||||
"pagetype": "Report",
|
||||
"idx": 3,
|
||||
"is_standard": "Yes",
|
||||
|
||||
@ -240,8 +240,8 @@ def parse_json(data):
|
||||
data["or_filters"] = json.loads(or_filters)
|
||||
if (fields := data.get("fields")) and isinstance(fields, str):
|
||||
data["fields"] = ["*"] if fields == "*" else json.loads(fields)
|
||||
if isinstance(data.get("docstatus"), str):
|
||||
data["docstatus"] = json.loads(data["docstatus"])
|
||||
if isinstance(data.get("pagestatus"), str):
|
||||
data["pagestatus"] = json.loads(data["pagestatus"])
|
||||
if isinstance(data.get("save_user_settings"), str):
|
||||
data["save_user_settings"] = json.loads(data["save_user_settings"])
|
||||
else:
|
||||
@ -690,7 +690,7 @@ def get_filter_dashboard_data(stats, pagetype, filters=None):
|
||||
"Float",
|
||||
"Currency",
|
||||
"Percent",
|
||||
] and tag["name"] not in ["docstatus"]:
|
||||
] and tag["name"] not in ["pagestatus"]:
|
||||
stats[tag["name"]] = list(tagcount)
|
||||
if stats[tag["name"]]:
|
||||
data = [
|
||||
|
||||
@ -43,7 +43,7 @@ def get_children(pagetype, parent="", **filters):
|
||||
|
||||
def _get_children(pagetype, parent="", ignore_permissions=False):
|
||||
parent_field = "parent_" + jingrow.scrub(pagetype)
|
||||
filters = [[f"ifnull(`{parent_field}`,'')", "=", parent], ["docstatus", "<", 2]]
|
||||
filters = [[f"ifnull(`{parent_field}`,'')", "=", parent], ["pagestatus", "<", 2]]
|
||||
|
||||
meta = jingrow.get_meta(pagetype)
|
||||
|
||||
|
||||
@ -201,7 +201,7 @@ def get_context(context):
|
||||
if self.set_property_after_alert:
|
||||
allow_update = True
|
||||
if (
|
||||
pg.docstatus.is_submitted()
|
||||
pg.pagestatus.is_submitted()
|
||||
and not pg.meta.get_field(self.set_property_after_alert).allow_on_submit
|
||||
):
|
||||
allow_update = False
|
||||
@ -384,11 +384,11 @@ def get_context(context):
|
||||
return None
|
||||
|
||||
print_settings = jingrow.get_pg("Print Settings", "Print Settings")
|
||||
if (pg.docstatus == 0 and not print_settings.allow_print_for_draft) or (
|
||||
pg.docstatus == 2 and not print_settings.allow_print_for_cancelled
|
||||
if (pg.pagestatus == 0 and not print_settings.allow_print_for_draft) or (
|
||||
pg.pagestatus == 2 and not print_settings.allow_print_for_cancelled
|
||||
):
|
||||
# ignoring attachment as draft and cancelled documents are not allowed to print
|
||||
status = "Draft" if pg.docstatus == 0 else "Cancelled"
|
||||
status = "Draft" if pg.pagestatus == 0 else "Cancelled"
|
||||
jingrow.throw(
|
||||
_(
|
||||
"""Not allowed to attach {0} document, please enable Allow Print For {0} in Print Settings"""
|
||||
|
||||
@ -149,7 +149,7 @@ class CancelledLinkError(LinkValidationError):
|
||||
pass
|
||||
|
||||
|
||||
class DocstatusTransitionError(ValidationError):
|
||||
class PagestatusTransitionError(ValidationError):
|
||||
pass
|
||||
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
"content": "[{\"id\":\"NPK_AfSLQ2\",\"type\":\"header\",\"data\":{\"text\":\"<span class=\\\"h4\\\"><b>Reports & Masters</b></span>\",\"col\":12}},{\"id\":\"lDOo58F7ZI\",\"type\":\"card\",\"data\":{\"card_name\":\"Backup\",\"col\":4}},{\"id\":\"ij1pcK8jst\",\"type\":\"card\",\"data\":{\"card_name\":\"Google Services\",\"col\":4}},{\"id\":\"aTlMujEHpN\",\"type\":\"card\",\"data\":{\"card_name\":\"Authentication\",\"col\":4}},{\"id\":\"gY5NXKtXss\",\"type\":\"card\",\"data\":{\"card_name\":\"Settings\",\"col\":4}},{\"id\":\"n_CI3GGqW-\",\"type\":\"card\",\"data\":{\"card_name\":\"Push Notifications\",\"col\":4}}]",
|
||||
"creation": "2020-03-02 15:16:18.714190",
|
||||
"custom_blocks": [],
|
||||
"docstatus": 0,
|
||||
"pagestatus": 0,
|
||||
"pagetype": "Workspace",
|
||||
"for_user": "",
|
||||
"hide_custom": 0,
|
||||
|
||||
@ -1765,7 +1765,7 @@ msgstr "提交评论需填写所有字段。"
|
||||
|
||||
#. Description of the 'Document States' (Table) field in PageType 'Workflow'
|
||||
#: jingrow/workflow/pagetype/workflow/workflow.json
|
||||
msgid "All possible Workflow States and roles of the workflow. Docstatus Options: 0 is \"Saved\", 1 is \"Submitted\" and 2 is \"Cancelled\""
|
||||
msgid "All possible Workflow States and roles of the workflow. Pagestatus Options: 0 is \"Saved\", 1 is \"Submitted\" and 2 is \"Cancelled\""
|
||||
msgstr "所有可能的工作流程状态和工作流程角色。文档状态选项:0 表示 \"已保存\",1 表示 \"已提交\",2 表示 \"已取消\""
|
||||
|
||||
#: jingrow/utils/password_strength.py:179
|
||||
@ -4183,11 +4183,11 @@ msgid "Cannot cancel {0}."
|
||||
msgstr "无法取消{0}"
|
||||
|
||||
#: jingrow/model/document.py:891
|
||||
msgid "Cannot change docstatus from 0 (Draft) to 2 (Cancelled)"
|
||||
msgid "Cannot change pagestatus from 0 (Draft) to 2 (Cancelled)"
|
||||
msgstr "无法将文档状态从0(草稿)更改为2(已取消)"
|
||||
|
||||
#: jingrow/model/document.py:905
|
||||
msgid "Cannot change docstatus from 1 (Submitted) to 0 (Draft)"
|
||||
msgid "Cannot change pagestatus from 1 (Submitted) to 0 (Draft)"
|
||||
msgstr "无法将文档状态从1(已提交)更改为0(草稿)"
|
||||
|
||||
#: jingrow/public/js/workflow_builder/utils.js:170
|
||||
@ -7516,13 +7516,13 @@ msgid "DocShare"
|
||||
msgstr "文档共享"
|
||||
|
||||
#: jingrow/workflow/pagetype/workflow/workflow.js:264
|
||||
msgid "DocStatus of the following states have changed:<br><strong>{0}</strong><br>\n"
|
||||
"\t\t\t\tDo you want to update the docstatus of existing documents in those states?<br>\n"
|
||||
"\t\t\t\tThis does not undo any effect bought in by the document's existing docstatus.\n"
|
||||
msgid "PageStatus of the following states have changed:<br><strong>{0}</strong><br>\n"
|
||||
"\t\t\t\tDo you want to update the pagestatus of existing documents in those states?<br>\n"
|
||||
"\t\t\t\tThis does not undo any effect bought in by the document's existing pagestatus.\n"
|
||||
"\t\t\t\t"
|
||||
msgstr "以下状态的文档状态已更改:<br><strong>{0}</strong><br>\n"
|
||||
"\t\t\t\t您想更新这些状态下现有文档的 docstatus 吗?<br>\n"
|
||||
"\t\t\t\t这不会消除文档现有 docstatus 所带来的任何影响。\n"
|
||||
"\t\t\t\t您想更新这些状态下现有文档的 pagestatus 吗?<br>\n"
|
||||
"\t\t\t\t这不会消除文档现有 pagestatus 所带来的任何影响。\n"
|
||||
"\t\t\t\t"
|
||||
|
||||
#. Label of a Link field in PageType 'Amended Document Naming Settings'
|
||||
@ -13187,7 +13187,7 @@ msgid "Invalid column"
|
||||
msgstr "无效列"
|
||||
|
||||
#: jingrow/model/document.py:894 jingrow/model/document.py:908
|
||||
msgid "Invalid docstatus"
|
||||
msgid "Invalid pagestatus"
|
||||
msgstr "文档状态无效"
|
||||
|
||||
#: jingrow/public/js/jingrow/utils/dashboard_utils.js:229
|
||||
|
||||
@ -86,7 +86,7 @@ default_fields = (
|
||||
"creation",
|
||||
"modified",
|
||||
"modified_by",
|
||||
"docstatus",
|
||||
"pagestatus",
|
||||
"idx",
|
||||
)
|
||||
DEFAULT_FIELDS = frozenset(default_fields)
|
||||
@ -153,7 +153,7 @@ std_fields = [
|
||||
{"fieldname": "_liked_by", "fieldtype": "Data", "label": "Liked By"},
|
||||
{"fieldname": "_comments", "fieldtype": "Text", "label": "Comments"},
|
||||
{"fieldname": "_assign", "fieldtype": "Text", "label": "Assigned To"},
|
||||
{"fieldname": "docstatus", "fieldtype": "Int", "label": "Document Status"},
|
||||
{"fieldname": "pagestatus", "fieldtype": "Int", "label": "Document Status"},
|
||||
]
|
||||
|
||||
|
||||
|
||||
@ -17,7 +17,7 @@ from jingrow.model import (
|
||||
get_permitted_fields,
|
||||
table_fields,
|
||||
)
|
||||
from jingrow.model.docstatus import DocStatus
|
||||
from jingrow.model.pagestatus import PageStatus
|
||||
from jingrow.model.dynamic_links import invalidate_distinct_link_pagetypes
|
||||
from jingrow.model.naming import set_new_name
|
||||
from jingrow.model.utils.link_count import notify_link_count
|
||||
@ -325,8 +325,8 @@ class BaseDocument:
|
||||
value.parenttype = self.pagetype
|
||||
value.parentfield = key
|
||||
|
||||
if value.__dict__.get("docstatus") is None:
|
||||
value.__dict__["docstatus"] = DocStatus.DRAFT
|
||||
if value.__dict__.get("pagestatus") is None:
|
||||
value.__dict__["pagestatus"] = PageStatus.DRAFT
|
||||
|
||||
if not getattr(value, "idx", None):
|
||||
if table := getattr(self, key, None):
|
||||
@ -436,8 +436,8 @@ class BaseDocument:
|
||||
self.__dict__[key] = None
|
||||
|
||||
if self.__dict__[key] is None:
|
||||
if key == "docstatus":
|
||||
self.__dict__[key] = DocStatus.DRAFT
|
||||
if key == "pagestatus":
|
||||
self.__dict__[key] = PageStatus.DRAFT
|
||||
elif key == "idx":
|
||||
self.__dict__[key] = 0
|
||||
|
||||
@ -462,21 +462,21 @@ class BaseDocument:
|
||||
return self.get("__islocal")
|
||||
|
||||
@property
|
||||
def docstatus(self) -> DocStatus:
|
||||
value = self.__dict__.get("docstatus")
|
||||
def pagestatus(self) -> PageStatus:
|
||||
value = self.__dict__.get("pagestatus")
|
||||
|
||||
if not isinstance(value, DocStatus):
|
||||
value = DocStatus(value or 0)
|
||||
self.__dict__["docstatus"] = value
|
||||
if not isinstance(value, PageStatus):
|
||||
value = PageStatus(value or 0)
|
||||
self.__dict__["pagestatus"] = value
|
||||
|
||||
return value
|
||||
|
||||
@docstatus.setter
|
||||
def docstatus(self, value) -> None:
|
||||
if not isinstance(value, DocStatus):
|
||||
value = DocStatus(value or 0)
|
||||
@pagestatus.setter
|
||||
def pagestatus(self, value) -> None:
|
||||
if not isinstance(value, PageStatus):
|
||||
value = PageStatus(value or 0)
|
||||
|
||||
self.__dict__["docstatus"] = value
|
||||
self.__dict__["pagestatus"] = value
|
||||
|
||||
def as_dict(
|
||||
self,
|
||||
@ -729,8 +729,8 @@ class BaseDocument:
|
||||
elif df.fieldtype in ("Float", "Currency", "Percent"):
|
||||
self.set(df.fieldname, flt(self.get(df.fieldname)))
|
||||
|
||||
# calling the docstatus property does the job
|
||||
self.docstatus
|
||||
# calling the pagestatus property does the job
|
||||
self.pagestatus
|
||||
|
||||
def _get_missing_mandatory_fields(self):
|
||||
"""Get mandatory fields that do not have any values"""
|
||||
@ -844,7 +844,7 @@ class BaseDocument:
|
||||
setattr(self, df.fieldname, values.name)
|
||||
|
||||
for _df in fields_to_fetch:
|
||||
if self.is_new() or not self.docstatus.is_submitted() or _df.allow_on_submit:
|
||||
if self.is_new() or not self.pagestatus.is_submitted() or _df.allow_on_submit:
|
||||
self.set_fetch_from_value(pagetype, _df, values)
|
||||
|
||||
if not meta.istable:
|
||||
@ -857,7 +857,7 @@ class BaseDocument:
|
||||
df.fieldname != "amended_from"
|
||||
and (is_submittable or self.meta.is_submittable)
|
||||
and jingrow.get_meta(pagetype).is_submittable
|
||||
and DocStatus(jingrow.db.get_value(pagetype, docname, "docstatus") or 0).is_cancelled()
|
||||
and PageStatus(jingrow.db.get_value(pagetype, docname, "pagestatus") or 0).is_cancelled()
|
||||
):
|
||||
cancelled_links.append((df.fieldname, docname, get_msg(df, docname)))
|
||||
|
||||
@ -1110,8 +1110,8 @@ class BaseDocument:
|
||||
or (df.get("fieldtype") in ("Data", "Small Text", "Text") and df.get("options") == "Email")
|
||||
or df.get("fieldtype") in ("Attach", "Attach Image", "Barcode", "Code")
|
||||
# cancelled and submit but not update after submit should be ignored
|
||||
or self.docstatus.is_cancelled()
|
||||
or (self.docstatus.is_submitted() and not df.get("allow_on_submit"))
|
||||
or self.pagestatus.is_cancelled()
|
||||
or (self.pagestatus.is_submitted() and not df.get("allow_on_submit"))
|
||||
):
|
||||
continue
|
||||
|
||||
|
||||
@ -32,7 +32,7 @@ def get_new_pg(pagetype, parent_pg=None, parentfield=None, as_dict=False):
|
||||
|
||||
|
||||
def make_new_pg(pagetype):
|
||||
pg = jingrow.get_pg({"pagetype": pagetype, "__islocal": 1, "owner": jingrow.session.user, "docstatus": 0})
|
||||
pg = jingrow.get_pg({"pagetype": pagetype, "__islocal": 1, "owner": jingrow.session.user, "pagestatus": 0})
|
||||
|
||||
set_user_and_static_default_values(pg)
|
||||
|
||||
|
||||
@ -80,7 +80,7 @@ class DatabaseQuery:
|
||||
fields=None,
|
||||
filters=None,
|
||||
or_filters=None,
|
||||
docstatus=None,
|
||||
pagestatus=None,
|
||||
group_by=None,
|
||||
order_by=DefaultOrderBy,
|
||||
limit_start=False,
|
||||
@ -137,7 +137,7 @@ class DatabaseQuery:
|
||||
|
||||
self.filters = filters or []
|
||||
self.or_filters = or_filters or []
|
||||
self.docstatus = docstatus or []
|
||||
self.pagestatus = pagestatus or []
|
||||
self.group_by = group_by
|
||||
self.order_by = order_by
|
||||
self.limit_start = cint(limit_start)
|
||||
@ -1237,7 +1237,7 @@ def get_order_by(pagetype, meta):
|
||||
|
||||
# draft docs always on top
|
||||
if meta.is_submittable:
|
||||
order_by = f"`tab{pagetype}`.docstatus asc, {order_by}"
|
||||
order_by = f"`tab{pagetype}`.pagestatus asc, {order_by}"
|
||||
|
||||
return order_by
|
||||
|
||||
|
||||
@ -9,7 +9,7 @@ import jingrow.defaults
|
||||
import jingrow.model.meta
|
||||
from jingrow import _, get_module_path
|
||||
from jingrow.desk.pagetype.tag.tag import delete_tags_for_document
|
||||
from jingrow.model.docstatus import DocStatus
|
||||
from jingrow.model.pagestatus import PageStatus
|
||||
from jingrow.model.dynamic_links import get_dynamic_link_map
|
||||
from jingrow.model.naming import revert_series_if_last
|
||||
from jingrow.model.utils import is_virtual_pagetype
|
||||
@ -248,7 +248,7 @@ def check_permission_and_not_submitted(page):
|
||||
)
|
||||
|
||||
# check if submitted
|
||||
if page.meta.is_submittable and page.docstatus.is_submitted():
|
||||
if page.meta.is_submittable and page.pagestatus.is_submitted():
|
||||
jingrow.msgprint(
|
||||
_("{0} {1}: Submitted Record cannot be deleted. You must {2} Cancel {3} it first.").format(
|
||||
_(page.pagetype),
|
||||
@ -292,7 +292,7 @@ def check_if_page_is_linked(page, method="Delete"):
|
||||
raise_link_exists_exception(page, link_dt, link_dt)
|
||||
continue
|
||||
|
||||
fields = ["name", "docstatus"]
|
||||
fields = ["name", "pagestatus"]
|
||||
|
||||
if meta.istable:
|
||||
fields.extend(["parent", "parenttype"])
|
||||
@ -305,7 +305,7 @@ def check_if_page_is_linked(page, method="Delete"):
|
||||
if linked_parent_pagetype in ignored_pagetypes:
|
||||
continue
|
||||
|
||||
if method != "Delete" and (method != "Cancel" or not DocStatus(item.docstatus).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 page when deleting or to a submitted page when cancelling
|
||||
continue
|
||||
@ -338,9 +338,9 @@ def check_if_page_is_dynamically_linked(page, method="Delete"):
|
||||
and refdoc.get(df.fieldname) == page.name
|
||||
and (
|
||||
# linked to an non-cancelled page when deleting
|
||||
(method == "Delete" and not DocStatus(refdoc.docstatus).is_cancelled())
|
||||
(method == "Delete" and not PageStatus(refdoc.pagestatus).is_cancelled())
|
||||
# linked to a submitted page when cancelling
|
||||
or (method == "Cancel" and DocStatus(refdoc.docstatus).is_submitted())
|
||||
or (method == "Cancel" and PageStatus(refdoc.pagestatus).is_submitted())
|
||||
)
|
||||
):
|
||||
raise_link_exists_exception(page, df.parent, df.parent)
|
||||
@ -348,15 +348,15 @@ def check_if_page_is_dynamically_linked(page, 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),
|
||||
(page.pagetype, page.name),
|
||||
as_dict=True,
|
||||
):
|
||||
# linked to an non-cancelled page when deleting
|
||||
# or linked to a submitted page 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 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
|
||||
|
||||
@ -9,7 +9,7 @@ import jingrow.defaults
|
||||
import jingrow.model.meta
|
||||
from jingrow import _, get_module_path
|
||||
from jingrow.desk.pagetype.tag.tag import delete_tags_for_document
|
||||
from jingrow.model.docstatus import DocStatus
|
||||
from jingrow.model.pagestatus import PageStatus
|
||||
from jingrow.model.dynamic_links import get_dynamic_link_map
|
||||
from jingrow.model.naming import revert_series_if_last
|
||||
from jingrow.model.utils import is_virtual_pagetype
|
||||
@ -248,7 +248,7 @@ def check_permission_and_not_submitted(pg):
|
||||
)
|
||||
|
||||
# check if submitted
|
||||
if pg.meta.is_submittable and pg.docstatus.is_submitted():
|
||||
if pg.meta.is_submittable and pg.pagestatus.is_submitted():
|
||||
jingrow.msgprint(
|
||||
_("{0} {1}: Submitted Record cannot be deleted. You must {2} Cancel {3} it first.").format(
|
||||
_(pg.pagetype),
|
||||
@ -292,7 +292,7 @@ def check_if_pg_is_linked(pg, method="Delete"):
|
||||
raise_link_exists_exception(pg, link_dt, link_dt)
|
||||
continue
|
||||
|
||||
fields = ["name", "docstatus"]
|
||||
fields = ["name", "pagestatus"]
|
||||
|
||||
if meta.istable:
|
||||
fields.extend(["parent", "parenttype"])
|
||||
@ -305,7 +305,7 @@ def check_if_pg_is_linked(pg, method="Delete"):
|
||||
if linked_parent_pagetype in ignored_pagetypes:
|
||||
continue
|
||||
|
||||
if method != "Delete" and (method != "Cancel" or not DocStatus(item.docstatus).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
|
||||
@ -338,9 +338,9 @@ def check_if_pg_is_dynamically_linked(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 PageStatus(refdoc.pagestatus).is_cancelled())
|
||||
# linked to a submitted pg when cancelling
|
||||
or (method == "Cancel" and DocStatus(refdoc.docstatus).is_submitted())
|
||||
or (method == "Cancel" and PageStatus(refdoc.pagestatus).is_submitted())
|
||||
)
|
||||
):
|
||||
raise_link_exists_exception(pg, df.parent, df.parent)
|
||||
@ -348,15 +348,15 @@ def check_if_pg_is_dynamically_linked(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 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
|
||||
|
||||
@ -1,32 +0,0 @@
|
||||
# Copyright (c) 2022, JINGROW and Contributors
|
||||
# License: MIT. See LICENSE
|
||||
|
||||
|
||||
class DocStatus(int):
|
||||
def is_draft(self):
|
||||
return self == DocStatus.DRAFT
|
||||
|
||||
def is_submitted(self):
|
||||
return self == DocStatus.SUBMITTED
|
||||
|
||||
def is_cancelled(self):
|
||||
return self == DocStatus.CANCELLED
|
||||
|
||||
# following methods have been kept for backwards compatibility
|
||||
|
||||
@staticmethod
|
||||
def draft():
|
||||
return DocStatus.DRAFT
|
||||
|
||||
@staticmethod
|
||||
def submitted():
|
||||
return DocStatus.SUBMITTED
|
||||
|
||||
@staticmethod
|
||||
def cancelled():
|
||||
return DocStatus.CANCELLED
|
||||
|
||||
|
||||
DocStatus.DRAFT = DocStatus(0)
|
||||
DocStatus.SUBMITTED = DocStatus(1)
|
||||
DocStatus.CANCELLED = DocStatus(2)
|
||||
@ -16,7 +16,7 @@ from jingrow.desk.form.document_follow import follow_document
|
||||
from jingrow.integrations.pagetype.webhook import run_webhooks
|
||||
from jingrow.model import optional_fields, table_fields
|
||||
from jingrow.model.base_document import BaseDocument, get_controller
|
||||
from jingrow.model.docstatus import DocStatus
|
||||
from jingrow.model.pagestatus import PageStatus
|
||||
from jingrow.model.naming import set_new_name, validate_name
|
||||
from jingrow.model.utils import is_virtual_pagetype
|
||||
from jingrow.model.workflow import set_workflow_state_on_action, validate_workflow
|
||||
@ -296,7 +296,7 @@ class Document(BaseDocument):
|
||||
|
||||
self._set_defaults()
|
||||
self.set_user_and_timestamp()
|
||||
self.set_docstatus()
|
||||
self.set_pagestatus()
|
||||
self.check_if_latest()
|
||||
self._validate_links()
|
||||
self.check_permission("create")
|
||||
@ -308,7 +308,7 @@ class Document(BaseDocument):
|
||||
self.flags.in_insert = True
|
||||
self.run_before_save_methods()
|
||||
self._validate()
|
||||
self.set_docstatus()
|
||||
self.set_pagestatus()
|
||||
self.flags.in_insert = False
|
||||
|
||||
# run validate, on update etc.
|
||||
@ -404,7 +404,7 @@ class Document(BaseDocument):
|
||||
self.check_permission("write", "save")
|
||||
|
||||
self.set_user_and_timestamp()
|
||||
self.set_docstatus()
|
||||
self.set_pagestatus()
|
||||
self.check_if_latest()
|
||||
self.set_parent_in_children()
|
||||
self.set_name_in_children()
|
||||
@ -419,7 +419,7 @@ class Document(BaseDocument):
|
||||
if self._action == "update_after_submit":
|
||||
self.validate_update_after_submit()
|
||||
|
||||
self.set_docstatus()
|
||||
self.set_pagestatus()
|
||||
|
||||
# parent
|
||||
if self.meta.issingle:
|
||||
@ -437,7 +437,7 @@ class Document(BaseDocument):
|
||||
return self
|
||||
|
||||
def validate_amended_from(self):
|
||||
if jingrow.db.get_value(self.pagetype, self.get("amended_from"), "docstatus") != 2:
|
||||
if jingrow.db.get_value(self.pagetype, self.get("amended_from"), "pagestatus") != 2:
|
||||
message = _(
|
||||
"{0} cannot be amended because it is not cancelled. Please cancel the document before creating an amendment."
|
||||
).format(jingrow.utils.get_link_to_form(self.pagetype, self.get("amended_from")))
|
||||
@ -611,12 +611,12 @@ class Document(BaseDocument):
|
||||
|
||||
jingrow.flags.currently_saving.append((self.pagetype, self.name))
|
||||
|
||||
def set_docstatus(self):
|
||||
# docstatus property automatically sets a docstatus if not set
|
||||
docstatus = self.docstatus
|
||||
def set_pagestatus(self):
|
||||
# pagestatus property automatically sets a pagestatus if not set
|
||||
pagestatus = self.pagestatus
|
||||
|
||||
for d in self.get_all_children():
|
||||
d.set("docstatus", docstatus)
|
||||
d.set("pagestatus", pagestatus)
|
||||
|
||||
def _validate(self):
|
||||
self._validate_mandatory()
|
||||
@ -847,7 +847,7 @@ class Document(BaseDocument):
|
||||
timestamps don't match.
|
||||
|
||||
Will also validate document transitions (Save > Submit > Cancel) calling
|
||||
`self.check_docstatus_transition`."""
|
||||
`self.check_pagestatus_transition`."""
|
||||
|
||||
self.load_pg_before_save(raise_exception=True)
|
||||
|
||||
@ -856,7 +856,7 @@ class Document(BaseDocument):
|
||||
|
||||
# previous is None for new document insert
|
||||
if not previous:
|
||||
self.check_docstatus_transition(0)
|
||||
self.check_pagestatus_transition(0)
|
||||
return
|
||||
|
||||
if cstr(previous.modified) != cstr(self._original_modified):
|
||||
@ -868,11 +868,11 @@ class Document(BaseDocument):
|
||||
)
|
||||
|
||||
if not self.meta.issingle:
|
||||
self.check_docstatus_transition(previous.docstatus)
|
||||
self.check_pagestatus_transition(previous.pagestatus)
|
||||
|
||||
def check_docstatus_transition(self, to_docstatus):
|
||||
"""Ensures valid `docstatus` transition.
|
||||
Valid transitions are (number in brackets is `docstatus`):
|
||||
def check_pagestatus_transition(self, to_pagestatus):
|
||||
"""Ensures valid `pagestatus` transition.
|
||||
Valid transitions are (number in brackets is `pagestatus`):
|
||||
|
||||
- Save (0) > Save (0)
|
||||
- Save (0) > Submit (1)
|
||||
@ -880,34 +880,34 @@ class Document(BaseDocument):
|
||||
- Submit (1) > Cancel (2)
|
||||
|
||||
"""
|
||||
if to_docstatus == DocStatus.DRAFT:
|
||||
if self.docstatus.is_draft():
|
||||
if to_pagestatus == PageStatus.DRAFT:
|
||||
if self.pagestatus.is_draft():
|
||||
self._action = "save"
|
||||
elif self.docstatus.is_submitted():
|
||||
elif self.pagestatus.is_submitted():
|
||||
self._action = "submit"
|
||||
self.check_permission("submit")
|
||||
elif self.docstatus.is_cancelled():
|
||||
raise jingrow.DocstatusTransitionError(
|
||||
_("Cannot change docstatus from 0 (Draft) to 2 (Cancelled)")
|
||||
elif self.pagestatus.is_cancelled():
|
||||
raise jingrow.PagestatusTransitionError(
|
||||
_("Cannot change pagestatus from 0 (Draft) to 2 (Cancelled)")
|
||||
)
|
||||
else:
|
||||
raise jingrow.ValidationError(_("Invalid docstatus"), self.docstatus)
|
||||
raise jingrow.ValidationError(_("Invalid pagestatus"), self.pagestatus)
|
||||
|
||||
elif to_docstatus == DocStatus.SUBMITTED:
|
||||
if self.docstatus.is_submitted():
|
||||
elif to_pagestatus == PageStatus.SUBMITTED:
|
||||
if self.pagestatus.is_submitted():
|
||||
self._action = "update_after_submit"
|
||||
self.check_permission("submit")
|
||||
elif self.docstatus.is_cancelled():
|
||||
elif self.pagestatus.is_cancelled():
|
||||
self._action = "cancel"
|
||||
self.check_permission("cancel")
|
||||
elif self.docstatus.is_draft():
|
||||
raise jingrow.DocstatusTransitionError(
|
||||
_("Cannot change docstatus from 1 (Submitted) to 0 (Draft)")
|
||||
elif self.pagestatus.is_draft():
|
||||
raise jingrow.PagestatusTransitionError(
|
||||
_("Cannot change pagestatus from 1 (Submitted) to 0 (Draft)")
|
||||
)
|
||||
else:
|
||||
raise jingrow.ValidationError(_("Invalid docstatus"), self.docstatus)
|
||||
raise jingrow.ValidationError(_("Invalid pagestatus"), self.pagestatus)
|
||||
|
||||
elif to_docstatus == DocStatus.CANCELLED:
|
||||
elif to_pagestatus == PageStatus.CANCELLED:
|
||||
raise jingrow.ValidationError(_("Cannot edit cancelled document"))
|
||||
|
||||
def set_parent_in_children(self):
|
||||
@ -1071,13 +1071,13 @@ class Document(BaseDocument):
|
||||
_evaluate_alert(alert)
|
||||
|
||||
def _submit(self):
|
||||
"""Submit the document. Sets `docstatus` = 1, then saves."""
|
||||
self.docstatus = DocStatus.SUBMITTED
|
||||
"""Submit the document. Sets `pagestatus` = 1, then saves."""
|
||||
self.pagestatus = PageStatus.SUBMITTED
|
||||
return self.save()
|
||||
|
||||
def _cancel(self):
|
||||
"""Cancel the document. Sets `docstatus` = 2, then saves."""
|
||||
self.docstatus = DocStatus.CANCELLED
|
||||
"""Cancel the document. Sets `pagestatus` = 2, then saves."""
|
||||
self.pagestatus = PageStatus.CANCELLED
|
||||
return self.save()
|
||||
|
||||
def _rename(self, name: str, merge: bool = False, force: bool = False, validate_rename: bool = True):
|
||||
@ -1089,12 +1089,12 @@ class Document(BaseDocument):
|
||||
|
||||
@jingrow.whitelist()
|
||||
def submit(self):
|
||||
"""Submit the document. Sets `docstatus` = 1, then saves."""
|
||||
"""Submit the document. Sets `pagestatus` = 1, then saves."""
|
||||
return self._submit()
|
||||
|
||||
@jingrow.whitelist()
|
||||
def cancel(self):
|
||||
"""Cancel the document. Sets `docstatus` = 2, then saves."""
|
||||
"""Cancel the document. Sets `pagestatus` = 2, then saves."""
|
||||
return self._cancel()
|
||||
|
||||
@jingrow.whitelist()
|
||||
@ -1690,10 +1690,10 @@ class Document(BaseDocument):
|
||||
name = self.name or "unsaved"
|
||||
pagetype = self.__class__.__name__
|
||||
|
||||
docstatus = f" docstatus={self.docstatus}" if self.docstatus else ""
|
||||
pagestatus = f" pagestatus={self.pagestatus}" if self.pagestatus else ""
|
||||
parent = f" parent={self.parent}" if getattr(self, "parent", None) else ""
|
||||
|
||||
return f"<{pagetype}: {name}{docstatus}{parent}>"
|
||||
return f"<{pagetype}: {name}{pagestatus}{parent}>"
|
||||
|
||||
def __str__(self):
|
||||
name = self.name or "unsaved"
|
||||
|
||||
@ -44,7 +44,7 @@ from jingrow.utils.data import add_to_date, get_datetime
|
||||
DEFAULT_FIELD_LABELS = {
|
||||
"name": _lt("ID"),
|
||||
"creation": _lt("Created On"),
|
||||
"docstatus": _lt("Document Status"),
|
||||
"pagestatus": _lt("Document Status"),
|
||||
"idx": _lt("Index"),
|
||||
"modified": _lt("Last Updated On"),
|
||||
"modified_by": _lt("Last Updated By"),
|
||||
@ -836,7 +836,7 @@ def get_default_df(fieldname):
|
||||
if fieldname in ("creation", "modified"):
|
||||
return jingrow._dict(fieldname=fieldname, fieldtype="Datetime")
|
||||
|
||||
elif fieldname in ("idx", "docstatus"):
|
||||
elif fieldname in ("idx", "pagestatus"):
|
||||
return jingrow._dict(fieldname=fieldname, fieldtype="Int")
|
||||
|
||||
return jingrow._dict(fieldname=fieldname, fieldtype="Data")
|
||||
|
||||
32
jingrow/model/pagestatus.py
Normal file
32
jingrow/model/pagestatus.py
Normal file
@ -0,0 +1,32 @@
|
||||
# Copyright (c) 2022, JINGROW and Contributors
|
||||
# License: MIT. See LICENSE
|
||||
|
||||
|
||||
class PageStatus(int):
|
||||
def is_draft(self):
|
||||
return self == PageStatus.DRAFT
|
||||
|
||||
def is_submitted(self):
|
||||
return self == PageStatus.SUBMITTED
|
||||
|
||||
def is_cancelled(self):
|
||||
return self == PageStatus.CANCELLED
|
||||
|
||||
# following methods have been kept for backwards compatibility
|
||||
|
||||
@staticmethod
|
||||
def draft():
|
||||
return PageStatus.DRAFT
|
||||
|
||||
@staticmethod
|
||||
def submitted():
|
||||
return PageStatus.SUBMITTED
|
||||
|
||||
@staticmethod
|
||||
def cancelled():
|
||||
return PageStatus.CANCELLED
|
||||
|
||||
|
||||
PageStatus.DRAFT = PageStatus(0)
|
||||
PageStatus.SUBMITTED = PageStatus(1)
|
||||
PageStatus.CANCELLED = PageStatus(2)
|
||||
@ -19,7 +19,7 @@ STANDARD_FIELD_CONVERSION_MAP = {
|
||||
"_liked_by": "Data",
|
||||
"_comments": "Text",
|
||||
"_assign": "Text",
|
||||
"docstatus": "Int",
|
||||
"pagestatus": "Int",
|
||||
}
|
||||
INCLUDE_DIRECTIVE_PATTERN = re.compile(r"""{% include\s['"](.*)['"]\s%}""")
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ from typing import TYPE_CHECKING, Union
|
||||
|
||||
import jingrow
|
||||
from jingrow import _
|
||||
from jingrow.model.docstatus import DocStatus
|
||||
from jingrow.model.pagestatus import PageStatus
|
||||
from jingrow.utils import cint
|
||||
|
||||
if TYPE_CHECKING:
|
||||
@ -126,10 +126,10 @@ def apply_workflow(pg, action):
|
||||
if next_state.update_field:
|
||||
pg.set(next_state.update_field, next_state.update_value)
|
||||
|
||||
new_docstatus = DocStatus(next_state.pg_status or 0)
|
||||
if pg.docstatus.is_draft() and new_docstatus.is_draft():
|
||||
new_pagestatus = PageStatus(next_state.pg_status or 0)
|
||||
if pg.pagestatus.is_draft() and new_pagestatus.is_draft():
|
||||
pg.save()
|
||||
elif pg.docstatus.is_draft() and new_docstatus.is_submitted():
|
||||
elif pg.pagestatus.is_draft() and new_pagestatus.is_submitted():
|
||||
from jingrow.core.pagetype.submission_queue.submission_queue import queue_submission
|
||||
from jingrow.utils.scheduler import is_scheduler_inactive
|
||||
|
||||
@ -138,9 +138,9 @@ def apply_workflow(pg, action):
|
||||
return
|
||||
|
||||
pg.submit()
|
||||
elif pg.docstatus.is_submitted() and new_docstatus.is_submitted():
|
||||
elif pg.pagestatus.is_submitted() and new_pagestatus.is_submitted():
|
||||
pg.save()
|
||||
elif pg.docstatus.is_submitted() and new_docstatus.is_cancelled():
|
||||
elif pg.pagestatus.is_submitted() and new_pagestatus.is_cancelled():
|
||||
pg.cancel()
|
||||
else:
|
||||
jingrow.throw(_("Illegal Document Status for {0}").format(next_state.state))
|
||||
@ -365,12 +365,12 @@ def set_workflow_state_on_action(pg, workflow_name, action):
|
||||
|
||||
# If workflow state of pg is already correct, don't set workflow state
|
||||
for state in workflow.states:
|
||||
if state.state == pg.get(workflow_state_field) and pg.docstatus == cint(state.pg_status):
|
||||
if state.state == pg.get(workflow_state_field) and pg.pagestatus == cint(state.pg_status):
|
||||
return
|
||||
|
||||
action_map = {"update_after_submit": "1", "submit": "1", "cancel": "2"}
|
||||
docstatus = action_map[action]
|
||||
pagestatus = action_map[action]
|
||||
for state in workflow.states:
|
||||
if state.pg_status == docstatus:
|
||||
if state.pg_status == pagestatus:
|
||||
pg.set(workflow_state_field, state.state)
|
||||
return
|
||||
|
||||
@ -6,7 +6,7 @@ def execute():
|
||||
# auto repeat is not submittable in v12
|
||||
jingrow.reload_pg("automation", "pagetype", "Auto Repeat")
|
||||
jingrow.db.sql("update `tabPagePerm` set submit=0, cancel=0, amend=0 where parent='Auto Repeat'")
|
||||
jingrow.db.sql("update `tabAuto Repeat` set docstatus=0 where docstatus=1 or docstatus=2")
|
||||
jingrow.db.sql("update `tabAuto Repeat` set pagestatus=0 where pagestatus=1 or pagestatus=2")
|
||||
|
||||
for entry in jingrow.get_all("Auto Repeat"):
|
||||
pg = jingrow.get_pg("Auto Repeat", entry.name)
|
||||
|
||||
@ -526,7 +526,7 @@ def get_pagetype_roles(pagetype, access_type="read"):
|
||||
|
||||
def get_perms_for(roles, perm_pagetype="PagePerm"):
|
||||
"""Get perms for given roles"""
|
||||
filters = {"permlevel": 0, "docstatus": 0, "role": ["in", roles]}
|
||||
filters = {"permlevel": 0, "pagestatus": 0, "role": ["in", roles]}
|
||||
return jingrow.get_all(perm_pagetype, fields=["*"], filters=filters)
|
||||
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"creation": "2021-11-22 15:26:53.878805",
|
||||
"docstatus": 0,
|
||||
"pagestatus": 0,
|
||||
"pagetype": "Form Tour",
|
||||
"idx": 0,
|
||||
"is_standard": 1,
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"creation": "2021-11-24 17:31:44.978996",
|
||||
"docstatus": 0,
|
||||
"pagestatus": 0,
|
||||
"pagetype": "Form Tour",
|
||||
"first_document": 0,
|
||||
"idx": 0,
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
{
|
||||
"content": null,
|
||||
"creation": "2020-10-09 17:23:15.163030",
|
||||
"docstatus": 0,
|
||||
"pagestatus": 0,
|
||||
"pagetype": "Page",
|
||||
"idx": 0,
|
||||
"modified": "2020-10-09 17:23:15.163030",
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
{
|
||||
"content": null,
|
||||
"creation": "2015-01-27 04:35:43.872918",
|
||||
"docstatus": 0,
|
||||
"pagestatus": 0,
|
||||
"pagetype": "Page",
|
||||
"idx": 0,
|
||||
"modified": "2017-05-03 05:59:33.702308",
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
{
|
||||
"content": null,
|
||||
"creation": "2021-07-10 12:22:16.138485",
|
||||
"docstatus": 0,
|
||||
"pagestatus": 0,
|
||||
"pagetype": "Page",
|
||||
"idx": 0,
|
||||
"modified": "2021-07-10 12:22:16.138485",
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
"beta": 0,
|
||||
"creation": "2013-01-10 16:34:24",
|
||||
"custom": 0,
|
||||
"docstatus": 0,
|
||||
"pagestatus": 0,
|
||||
"pagetype": "PageType",
|
||||
"document_type": "Setup",
|
||||
"editable_grid": 0,
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
"creation": "2017-08-17 02:00:12.502887",
|
||||
"css": "/*\n\tcommon style for whole page\n\tThis should include:\n\t+ page size related settings\n\t+ font family settings\n\t+ line spacing settings\n*/\n.print-format div,\n.print-format span,\n.print-format td,\n.print-format h1,\n.print-format h2,\n.print-format h3,\n.print-format h4 {\n\tfont-family: Georgia, serif;\n}\n\n/* classic format: for-test */",
|
||||
"disabled": 0,
|
||||
"docstatus": 0,
|
||||
"pagestatus": 0,
|
||||
"pagetype": "Print Style",
|
||||
"idx": 1,
|
||||
"modified": "2017-08-18 00:43:48.675833",
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
"creation": "2017-08-17 02:16:58.060374",
|
||||
"css": ".print-heading {\n\ttext-align: right;\n\ttext-transform: uppercase;\n\tcolor: #666;\n\tpadding-bottom: 20px;\n\tmargin-bottom: 20px;\n\tborder-bottom: 1px solid #d1d8dd;\n}\n\n.print-heading h2 {\n\tfont-size: 24px;\n}\n\n.print-format th {\n\tbackground-color: #eee !important;\n\tborder-bottom: 0px !important;\n}\n\n.print-format .primary.compact-item {\n font-weight: bold;\n}\n\n/* modern format: for-test */",
|
||||
"disabled": 0,
|
||||
"docstatus": 0,
|
||||
"pagestatus": 0,
|
||||
"pagetype": "Print Style",
|
||||
"idx": 1,
|
||||
"modified": "2020-11-10 13:59:09.976381",
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
"creation": "2017-08-17 02:16:20.992989",
|
||||
"css": ".print-format * {\n\tcolor: #000 !important;\n}\n\n.print-format .alert {\n\tbackground-color: inherit;\n\tborder: 1px dashed #333;\n}\n\n.print-format .table-bordered,\n.print-format .table-bordered > thead > tr > th,\n.print-format .table-bordered > tbody > tr > th,\n.print-format .table-bordered > tfoot > tr > th,\n.print-format .table-bordered > thead > tr > td,\n.print-format .table-bordered > tbody > tr > td,\n.print-format .table-bordered > tfoot > tr > td {\n\tborder: 1px solid #333;\n}\n\n.print-format hr {\n\tborder-top: 1px solid #333;\n}\n\n.print-heading {\n\tborder-bottom: 2px solid #333;\n}\n",
|
||||
"disabled": 0,
|
||||
"docstatus": 0,
|
||||
"pagestatus": 0,
|
||||
"pagetype": "Print Style",
|
||||
"idx": 0,
|
||||
"modified": "2017-08-18 00:44:25.023898",
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
"creation": "2020-10-22 00:00:08.161999",
|
||||
"css": ".print-format {\n font-size: 13px;\n background: white;\n}\n\n.print-heading {\n border-bottom: 1px solid #f4f5f6;\n padding-bottom: 5px;\n margin-bottom: 10px;\n}\n\n.print-heading h2 {\n font-size: 24px;\n}\n\n.print-heading h2 div {\n font-weight: 600;\n}\n\n.print-heading small {\n font-size: 13px !important;\n font-weight: normal;\n line-height: 2.5;\n color: #4c5a67;\n}\n\n.print-format .letter-head {\n margin-bottom: 30px;\n}\n\n.print-format label {\n font-weight: normal;\n font-size: 13px;\n color: #4C5A67;\n margin-bottom: 0;\n}\n\n.print-format .data-field {\n margin-top: 0;\n margin-bottom: 0;\n}\n\n.print-format .value {\n color: #192734;\n line-height: 1.8;\n}\n\n.print-format .section-break:not(:last-child) {\n margin-bottom: 0;\n}\n\n.print-format .row:not(.section-break) {\n line-height: 1.6;\n margin-top: 15px !important;\n}\n\n.print-format .important .value {\n font-size: 13px;\n font-weight: 600;\n}\n\n.print-format th {\n color: #74808b;\n font-weight: normal;\n border-bottom-width: 1px !important;\n}\n\n.print-format .table-bordered td, .print-format .table-bordered th {\n border: 1px solid #f4f5f6;\n}\n\n.print-format .table-bordered {\n border: 1px solid #f4f5f6;\n}\n\n.print-format td, .print-format th {\n padding: 10px !important;\n}\n\n.print-format .primary.compact-item {\n font-weight: normal;\n}\n\n.print-format table td .value {\n font-size: 12px;\n line-height: 1.8;\n}\n",
|
||||
"disabled": 0,
|
||||
"docstatus": 0,
|
||||
"pagestatus": 0,
|
||||
"pagetype": "Print Style",
|
||||
"idx": 0,
|
||||
"modified": "2020-12-14 17:56:37.421390",
|
||||
|
||||
@ -42,7 +42,7 @@ jingrow.ui.form.ControlAttach = class ControlAttach extends jingrow.ui.form.Cont
|
||||
me.frm.attachments.remove_attachment_by_filename(me.value, async () => {
|
||||
await me.parse_validate_and_set_in_model(null);
|
||||
me.refresh();
|
||||
me.frm.pg.docstatus == 1 ? me.frm.save("Update") : me.frm.save();
|
||||
me.frm.pg.pagestatus == 1 ? me.frm.save("Update") : me.frm.save();
|
||||
});
|
||||
} else {
|
||||
me.dataurl = null;
|
||||
@ -138,7 +138,7 @@ jingrow.ui.form.ControlAttach = class ControlAttach extends jingrow.ui.form.Cont
|
||||
if (this.frm) {
|
||||
await this.parse_validate_and_set_in_model(attachment.file_url);
|
||||
this.frm.attachments.update_attachment(attachment);
|
||||
this.frm.pg.docstatus == 1 ? this.frm.save("Update") : this.frm.save();
|
||||
this.frm.pg.pagestatus == 1 ? this.frm.save("Update") : this.frm.save();
|
||||
}
|
||||
this.set_value(attachment.file_url);
|
||||
}
|
||||
|
||||
@ -15,7 +15,7 @@ jingrow.ui.form.ControlCode = class ControlCode extends jingrow.ui.form.ControlT
|
||||
}
|
||||
|
||||
const codeField = this.df.fieldtype === "Code";
|
||||
if ((codeField && this.df.read_only === 1) || (codeField && this.frm.pg.docstatus > 0)) {
|
||||
if ((codeField && this.df.read_only === 1) || (codeField && this.frm.pg.pagestatus > 0)) {
|
||||
this.button = $(
|
||||
`<button
|
||||
class="btn icon-btn"
|
||||
|
||||
@ -196,8 +196,8 @@ jingrow.ui.form.Dashboard = class FormDashboard {
|
||||
this.data &&
|
||||
((this.data.transactions || []).length || (this.data.reports || []).length)
|
||||
) {
|
||||
if (this.data.docstatus && this.frm.pg.docstatus !== this.data.docstatus) {
|
||||
// limited docstatus
|
||||
if (this.data.pagestatus && this.frm.pg.pagestatus !== this.data.pagestatus) {
|
||||
// limited pagestatus
|
||||
return;
|
||||
}
|
||||
this.render_links();
|
||||
|
||||
@ -27,7 +27,7 @@ function get_version_timeline_content(version_pg, frm) {
|
||||
if (data.changed && data.changed.length) {
|
||||
var parts = [];
|
||||
data.changed.every(function (p) {
|
||||
if (p[0] === "docstatus") {
|
||||
if (p[0] === "pagestatus") {
|
||||
if (p[2] === 1) {
|
||||
let message = updater_reference_link
|
||||
? get_user_message(
|
||||
|
||||
@ -432,7 +432,7 @@ jingrow.ui.form.Form = class JingrowForm {
|
||||
this.trigger_onload(switched);
|
||||
|
||||
if (switched) {
|
||||
if (this.show_print_first && this.pg.docstatus === 1) {
|
||||
if (this.show_print_first && this.pg.pagestatus === 1) {
|
||||
// show print view
|
||||
this.print_pg();
|
||||
}
|
||||
@ -441,9 +441,9 @@ jingrow.ui.form.Form = class JingrowForm {
|
||||
// set status classes
|
||||
this.$wrapper
|
||||
.removeClass("validated-form")
|
||||
.toggleClass("editable-form", this.pg.docstatus === 0)
|
||||
.toggleClass("submitted-form", this.pg.docstatus === 1)
|
||||
.toggleClass("cancelled-form", this.pg.docstatus === 2);
|
||||
.toggleClass("editable-form", this.pg.pagestatus === 0)
|
||||
.toggleClass("submitted-form", this.pg.pagestatus === 1)
|
||||
.toggleClass("cancelled-form", this.pg.pagestatus === 2);
|
||||
|
||||
this.show_conflict_message();
|
||||
this.show_submission_queue_banner();
|
||||
@ -677,7 +677,7 @@ jingrow.ui.form.Form = class JingrowForm {
|
||||
}
|
||||
|
||||
if (this.fields_dict["trash_reason"]) {
|
||||
if (this.pg.trash_reason && this.pg.docstatus == 2) {
|
||||
if (this.pg.trash_reason && this.pg.pagestatus == 2) {
|
||||
unhide_field("trash_reason");
|
||||
} else {
|
||||
hide_field("trash_reason");
|
||||
@ -731,9 +731,9 @@ jingrow.ui.form.Form = class JingrowForm {
|
||||
save_or_update() {
|
||||
if (this.save_disabled) return;
|
||||
|
||||
if (this.pg.docstatus === 0) {
|
||||
if (this.pg.pagestatus === 0) {
|
||||
this.save();
|
||||
} else if (this.pg.docstatus === 1 && this.pg.__unsaved) {
|
||||
} else if (this.pg.pagestatus === 1 && this.pg.__unsaved) {
|
||||
this.save("Update");
|
||||
}
|
||||
}
|
||||
@ -1139,7 +1139,7 @@ jingrow.ui.form.Form = class JingrowForm {
|
||||
!this.is_dirty() &&
|
||||
!this.is_new() &&
|
||||
!jingrow.model.has_workflow(this.pagetype) && // show only if no workflow
|
||||
this.pg.docstatus === 0
|
||||
this.pg.pagestatus === 0
|
||||
) {
|
||||
this.dashboard.add_comment(__("Submit this document to confirm"), "blue", true);
|
||||
}
|
||||
@ -1444,7 +1444,7 @@ jingrow.ui.form.Form = class JingrowForm {
|
||||
show_success_action() {
|
||||
const route = jingrow.get_route();
|
||||
if (route[0] !== "Form") return;
|
||||
if (this.meta.is_submittable && this.pg.docstatus !== 1) return;
|
||||
if (this.meta.is_submittable && this.pg.pagestatus !== 1) return;
|
||||
|
||||
const success_action = new jingrow.ui.form.SuccessAction(this);
|
||||
success_action.show();
|
||||
@ -1860,7 +1860,7 @@ jingrow.ui.form.Form = class JingrowForm {
|
||||
if (this.can_make_methods && this.can_make_methods[pagetype]) {
|
||||
return this.can_make_methods[pagetype](this);
|
||||
} else {
|
||||
if (this.meta.is_submittable && this.pg.docstatus !== 1) {
|
||||
if (this.meta.is_submittable && this.pg.pagestatus !== 1) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
@ -2080,7 +2080,7 @@ jingrow.ui.form.Form = class JingrowForm {
|
||||
this.meta.is_submittable &&
|
||||
this.meta.queue_in_background &&
|
||||
!this.pg.__islocal &&
|
||||
this.pg.docstatus === 0
|
||||
this.pg.pagestatus === 0
|
||||
)
|
||||
) {
|
||||
wrapper.length && wrapper.remove();
|
||||
|
||||
@ -132,7 +132,7 @@ export default class GridRowForm {
|
||||
// wait for animation and then focus on the first row
|
||||
var me = this;
|
||||
setTimeout(function () {
|
||||
if ((me.row.frm && me.row.frm.pg.docstatus === 0) || !me.row.frm) {
|
||||
if ((me.row.frm && me.row.frm.pg.pagestatus === 0) || !me.row.frm) {
|
||||
var first = me.form_area.find("input:first");
|
||||
if (
|
||||
first.length &&
|
||||
|
||||
@ -185,7 +185,7 @@ jingrow.ui.form.QuickEntryForm = class QuickEntryForm {
|
||||
},
|
||||
callback: function (r) {
|
||||
if (
|
||||
r?.message?.docstatus === 0 &&
|
||||
r?.message?.pagestatus === 0 &&
|
||||
jingrow.model.can_submit(me.pagetype) &&
|
||||
!jingrow.model.has_workflow(me.pagetype)
|
||||
) {
|
||||
|
||||
@ -116,7 +116,7 @@ jingrow.ui.form.save = function (frm, action, callback, btn) {
|
||||
var has_errors = false;
|
||||
frm.scroll_set = false;
|
||||
|
||||
if (frm.pg.docstatus == 2) return true; // don't check for cancel
|
||||
if (frm.pg.pagestatus == 2) return true; // don't check for cancel
|
||||
|
||||
$.each(jingrow.model.get_all_docs(frm.pg), function (i, pg) {
|
||||
var error_fields = [];
|
||||
|
||||
@ -15,7 +15,7 @@ jingrow.ui.form.SuccessAction = class SuccessAction {
|
||||
|
||||
show() {
|
||||
if (!this.setting) return;
|
||||
if (this.form.pg.docstatus === 0 && !this.is_first_creation()) return;
|
||||
if (this.form.pg.pagestatus === 0 && !this.is_first_creation()) return;
|
||||
|
||||
this.prepare_dom();
|
||||
this.show_alert();
|
||||
|
||||
@ -327,7 +327,7 @@ jingrow.ui.form.Toolbar = class Toolbar {
|
||||
// Print
|
||||
const me = this;
|
||||
const p = this.frm.perm[0];
|
||||
const docstatus = cint(this.frm.pg.docstatus);
|
||||
const pagestatus = cint(this.frm.pg.pagestatus);
|
||||
const is_submittable = jingrow.model.is_submittable(this.frm.pg.pagetype);
|
||||
|
||||
const print_settings = jingrow.model.get_pg(":Print Settings", "Print Settings");
|
||||
@ -336,9 +336,9 @@ jingrow.ui.form.Toolbar = class Toolbar {
|
||||
|
||||
if (
|
||||
!is_submittable ||
|
||||
docstatus == 1 ||
|
||||
(allow_print_for_cancelled && docstatus == 2) ||
|
||||
(allow_print_for_draft && docstatus == 0)
|
||||
pagestatus == 1 ||
|
||||
(allow_print_for_cancelled && pagestatus == 2) ||
|
||||
(allow_print_for_draft && pagestatus == 0)
|
||||
) {
|
||||
if (jingrow.model.can_print(null, me.frm) && !this.frm.meta.issingle) {
|
||||
this.page.add_menu_item(
|
||||
@ -360,7 +360,7 @@ jingrow.ui.form.Toolbar = class Toolbar {
|
||||
}
|
||||
|
||||
// email
|
||||
if (jingrow.model.can_email(null, me.frm) && me.frm.pg.docstatus < 2) {
|
||||
if (jingrow.model.can_email(null, me.frm) && me.frm.pg.pagestatus < 2) {
|
||||
this.page.add_menu_item(
|
||||
__("Email"),
|
||||
function () {
|
||||
@ -438,7 +438,7 @@ jingrow.ui.form.Toolbar = class Toolbar {
|
||||
|
||||
// delete
|
||||
if (
|
||||
cint(me.frm.pg.docstatus) != 1 &&
|
||||
cint(me.frm.pg.pagestatus) != 1 &&
|
||||
!me.frm.pg.__islocal &&
|
||||
!jingrow.model.is_single(me.frm.pagetype) &&
|
||||
jingrow.model.can_delete(me.frm.pagetype)
|
||||
@ -568,11 +568,11 @@ jingrow.ui.form.Toolbar = class Toolbar {
|
||||
return this.frm.meta.allow_auto_repeat && !this.frm.is_new() && !this.frm.pg.auto_repeat;
|
||||
}
|
||||
can_save() {
|
||||
return this.get_docstatus() === 0;
|
||||
return this.get_pagestatus() === 0;
|
||||
}
|
||||
can_submit() {
|
||||
return (
|
||||
this.get_docstatus() === 0 &&
|
||||
this.get_pagestatus() === 0 &&
|
||||
!this.frm.pg.__islocal &&
|
||||
!this.frm.pg.__unsaved &&
|
||||
this.frm.perm[0].submit &&
|
||||
@ -581,17 +581,17 @@ jingrow.ui.form.Toolbar = class Toolbar {
|
||||
}
|
||||
can_update() {
|
||||
return (
|
||||
this.get_docstatus() === 1 &&
|
||||
this.get_pagestatus() === 1 &&
|
||||
!this.frm.pg.__islocal &&
|
||||
this.frm.perm[0].submit &&
|
||||
this.frm.pg.__unsaved
|
||||
);
|
||||
}
|
||||
can_cancel() {
|
||||
return this.get_docstatus() === 1 && this.frm.perm[0].cancel && !this.read_only;
|
||||
return this.get_pagestatus() === 1 && this.frm.perm[0].cancel && !this.read_only;
|
||||
}
|
||||
can_amend() {
|
||||
return this.get_docstatus() === 2 && this.frm.perm[0].amend && !this.read_only;
|
||||
return this.get_pagestatus() === 2 && this.frm.perm[0].amend && !this.read_only;
|
||||
}
|
||||
has_workflow() {
|
||||
if (this._has_workflow === undefined)
|
||||
@ -600,8 +600,8 @@ jingrow.ui.form.Toolbar = class Toolbar {
|
||||
}).length;
|
||||
return this._has_workflow;
|
||||
}
|
||||
get_docstatus() {
|
||||
return cint(this.frm.pg.docstatus);
|
||||
get_pagestatus() {
|
||||
return cint(this.frm.pg.pagestatus);
|
||||
}
|
||||
show_linked_with() {
|
||||
if (!this.frm.linked_with) {
|
||||
|
||||
@ -141,7 +141,7 @@ jingrow.ui.form.States = class FormStates {
|
||||
set_default_state() {
|
||||
var default_state = jingrow.workflow.get_default_state(
|
||||
this.frm.pagetype,
|
||||
this.frm.pg.docstatus
|
||||
this.frm.pg.pagestatus
|
||||
);
|
||||
if (default_state) {
|
||||
this.frm.set_value(this.state_fieldname, default_state);
|
||||
|
||||
@ -17,9 +17,9 @@ export default class BulkOperations {
|
||||
.filter((pg) => {
|
||||
return (
|
||||
!is_submittable ||
|
||||
pg.docstatus === 1 ||
|
||||
(allow_print_for_cancelled && pg.docstatus == 2) ||
|
||||
(allow_print_for_draft && pg.docstatus == 0) ||
|
||||
pg.pagestatus === 1 ||
|
||||
(allow_print_for_cancelled && pg.pagestatus == 2) ||
|
||||
(allow_print_for_draft && pg.pagestatus == 0) ||
|
||||
jingrow.user.has_role("Administrator")
|
||||
);
|
||||
})
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user