BREAKING CHANGE: rename child tables of Workspace

This commit is contained in:
Rushabh Mehta 2021-01-12 13:33:15 +05:30
parent a29074c9da
commit 7fd6346bf8
16 changed files with 77 additions and 70 deletions

View file

@ -472,7 +472,7 @@ def get_custom_workspace_for_user(page):
@frappe.whitelist()
def save_customization(page, config):
"""Save customizations as a separate doctype in Desk page per user
"""Save customizations as a separate doctype in Workspace per user
Args:
page (string): Name of the page to be edited
@ -498,9 +498,9 @@ def save_customization(page, config):
config = _dict(loads(config))
if config.charts:
page_doc.charts = prepare_widget(config.charts, "Desk Chart", "charts")
page_doc.charts = prepare_widget(config.charts, "Workspace Chart", "charts")
if config.shortcuts:
page_doc.shortcuts = prepare_widget(config.shortcuts, "Desk Shortcut", "shortcuts")
page_doc.shortcuts = prepare_widget(config.shortcuts, "Workspace Shortcut", "shortcuts")
if config.cards:
page_doc.build_links_table_from_cards(config.cards)

View file

@ -3,7 +3,7 @@
frappe.ui.form.on('Workspace', {
setup: function(frm) {
frappe.meta.get_field('Desk Link', 'only_for').no_default = true;
frappe.meta.get_field('Workspace Link', 'only_for').no_default = true;
},
refresh: function(frm) {

View file

@ -1,6 +1,5 @@
{
"actions": [],
"allow_rename": 1,
"autoname": "field:label",
"beta": 1,
"creation": "2020-01-23 13:45:59.470592",
@ -52,14 +51,14 @@
"fieldname": "charts",
"fieldtype": "Table",
"label": "Charts",
"options": "Desk Chart"
"options": "Workspace Chart"
},
{
"depends_on": "eval:!doc.extends_another_page || !doc.is_standard || frappe.boot.developer_mode",
"fieldname": "shortcuts",
"fieldtype": "Table",
"label": "Shortcuts",
"options": "Desk Shortcut"
"options": "Workspace Shortcut"
},
{
"fieldname": "restrict_to_domain",
@ -206,11 +205,11 @@
"fieldname": "links",
"fieldtype": "Table",
"label": "Links",
"options": "Desk Link"
"options": "Workspace Link"
}
],
"links": [],
"modified": "2021-01-12 11:26:57.362224",
"modified": "2021-01-12 12:34:32.372386",
"modified_by": "Administrator",
"module": "Desk",
"name": "Workspace",

View file

@ -26,10 +26,10 @@
],
"istable": 1,
"links": [],
"modified": "2020-03-31 13:33:13.128804",
"modified": "2021-01-12 13:13:25.781925",
"modified_by": "Administrator",
"module": "Desk",
"name": "Desk Chart",
"name": "Workspace Chart",
"owner": "Administrator",
"permissions": [],
"quick_entry": 1,

View file

@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2020, Frappe Technologies and contributors
# Copyright (c) 2021, Frappe Technologies and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
# import frappe
from frappe.model.document import Document
class DeskChart(Document):
class WorkspaceChart(Document):
pass

View file

@ -76,6 +76,11 @@
"fieldname": "column_break_7",
"fieldtype": "Column Break"
},
{
"fieldname": "dependencies",
"fieldtype": "Data",
"label": "Dependencies"
},
{
"fieldname": "only_for",
"fieldtype": "Link",
@ -94,20 +99,15 @@
"fieldname": "is_query_report",
"fieldtype": "Check",
"label": "Is Query Report"
},
{
"fieldname": "dependencies",
"fieldtype": "Data",
"label": "Dependencies"
}
],
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2020-11-30 19:12:50.067888",
"modified": "2021-01-12 13:13:12.379443",
"modified_by": "Administrator",
"module": "Desk",
"name": "Desk Link",
"name": "Workspace Link",
"owner": "Administrator",
"permissions": [],
"quick_entry": 1,

View file

@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2020, Frappe Technologies and contributors
# Copyright (c) 2021, Frappe Technologies and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
# import frappe
from frappe.model.document import Document
class DeskShortcut(Document):
class WorkspaceLink(Document):
pass

View file

@ -44,6 +44,36 @@
"label": "DocType View",
"options": "\nList\nReport Builder\nDashboard\nTree\nNew\nCalendar"
},
{
"fieldname": "column_break_4",
"fieldtype": "Column Break"
},
{
"fieldname": "label",
"fieldtype": "Data",
"in_list_view": 1,
"label": "Label",
"reqd": 1
},
{
"depends_on": "eval:frappe.boot.developer_mode",
"fieldname": "icon",
"fieldtype": "Data",
"label": "Icon"
},
{
"depends_on": "eval:frappe.boot.developer_mode",
"fieldname": "restrict_to_domain",
"fieldtype": "Link",
"label": "Restrict to Domain",
"options": "Domain"
},
{
"depends_on": "eval:doc.type == \"DocType\" && frappe.boot.developer_mode",
"fieldname": "section_break_5",
"fieldtype": "Section Break",
"label": "Count Filter"
},
{
"fieldname": "stats_filter",
"fieldtype": "Code",
@ -54,56 +84,25 @@
"fieldname": "column_break_3",
"fieldtype": "Column Break"
},
{
"fieldname": "color",
"fieldtype": "Color",
"label": "Color"
},
{
"description": "For example: {} Open",
"fieldname": "format",
"fieldtype": "Data",
"label": "Format"
},
{
"depends_on": "eval:doc.type == \"DocType\" && frappe.boot.developer_mode",
"fieldname": "section_break_5",
"fieldtype": "Section Break",
"label": "Count Filter"
},
{
"fieldname": "color",
"fieldtype": "Select",
"label": "Color",
"options": "Grey\nGreen\nRed\nOrange\nPink\nYellow\nBlue\nCyan\nTeal"
},
{
"depends_on": "eval:frappe.boot.developer_mode",
"fieldname": "icon",
"fieldtype": "Data",
"label": "Icon"
},
{
"fieldname": "column_break_4",
"fieldtype": "Column Break"
},
{
"depends_on": "eval:frappe.boot.developer_mode",
"fieldname": "restrict_to_domain",
"fieldtype": "Link",
"label": "Restrict to Domain",
"options": "Domain"
},
{
"fieldname": "label",
"fieldtype": "Data",
"in_list_view": 1,
"label": "Label",
"reqd": 1
}
],
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2020-08-12 14:11:55.080390",
"modified": "2021-01-12 13:13:17.571324",
"modified_by": "Administrator",
"module": "Desk",
"name": "Desk Shortcut",
"name": "Workspace Shortcut",
"owner": "Administrator",
"permissions": [],
"quick_entry": 1,

View file

@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2020, Frappe Technologies and contributors
# Copyright (c) 2021, Frappe Technologies and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
# import frappe
from frappe.model.document import Document
class DeskLink(Document):
class WorkspaceShortcut(Document):
pass

View file

@ -52,9 +52,9 @@ def sync_for(app_name, force=0, sync_everything = False, verbose=False, reset_pe
("desk", "onboarding_step"),
("desk", "onboarding_step_map"),
("desk", "module_onboarding"),
("desk", "desk_link"),
("desk", "desk_chart"),
("desk", "desk_shortcut"),
("desk", "workspace_link"),
("desk", "workspace_chart"),
("desk", "workspace_shortcut"),
("desk", "workspace")):
files.append(os.path.join(frappe.get_app_path("frappe"), d[0],
"doctype", d[1], d[1] + ".json"))
@ -68,7 +68,6 @@ def sync_for(app_name, force=0, sync_everything = False, verbose=False, reset_pe
for i, doc_path in enumerate(files):
import_file_by_path(doc_path, force=force, ignore_version=True,
reset_permissions=reset_permissions, for_sync=True)
#print module_name + ' | ' + doctype + ' | ' + name
frappe.db.commit()

View file

@ -60,7 +60,7 @@ def import_file_by_path(path, force=False, data_import=False, pre_process=None,
if not force:
# check if timestamps match
db_modified = frappe.db.get_value(doc['doctype'], doc['name'], 'modified')
if db_modified and doc.get('modified')==get_datetime_str(db_modified):
if db_modified and doc.get('modified')==get_datetime_str(db_modified) and doc['doctype'] != 'Workspace':
return False
original_modified = doc.get("modified")

View file

@ -325,3 +325,4 @@ execute:frappe.delete_doc_if_exists('Page', 'workspace')
execute:frappe.delete_doc_if_exists('Page', 'dashboard', force=1)
frappe.core.doctype.page.patches.drop_unused_pages
execute:frappe.get_doc('Role', 'Guest').save() # remove desk access
frappe.patches.v13_0.rename_desk_page_to_workspace

View file

@ -2,6 +2,15 @@ import frappe
from frappe.model.rename_doc import rename_doc
def execute():
if frappe.db.exists("Doctype", "Desk Page"):
rename_doc('DocType', 'Desk Page', 'Workspace')
frappe.reload_doc('desk', 'doctype', 'workspace')
if frappe.db.exists("DocType", "Desk Page"):
if frappe.db.exists('DocType Workspace'):
# this patch was not added initially, so this page might still exist
frappe.delete_doc('DocType', 'Desk Page')
else:
rename_doc('DocType', 'Desk Page', 'Workspace')
rename_doc('DocType', 'Desk Chart', 'Workspace Chart', ignore_if_exists=True)
rename_doc('DocType', 'Desk Link', 'Workspace Link', ignore_if_exists=True)
rename_doc('DocType', 'Desk Shortcut', 'Workspace Shortcut', ignore_if_exists=True)
frappe.reload_doc('desk', 'doctype', 'workspace')