feat: add is standard option
This commit is contained in:
parent
8e1df1e034
commit
4441e765c9
3 changed files with 19 additions and 6 deletions
|
|
@ -2,7 +2,12 @@
|
|||
// For license information, please see license.txt
|
||||
|
||||
frappe.ui.form.on('Desk Page', {
|
||||
// refresh: function(frm) {
|
||||
refresh: function(frm) {
|
||||
frm.get_field("is_standard").toggle(frappe.boot.developer_mode);
|
||||
|
||||
// }
|
||||
if (frm.doc.is_standard && !frappe.boot.developer_mode) {
|
||||
frm.set_read_only();
|
||||
frm.disable_save();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@
|
|||
"icon",
|
||||
"column_break_3",
|
||||
"onboarding",
|
||||
"is_standard",
|
||||
"developer_mode_only",
|
||||
"disable_user_customization",
|
||||
"pin_to_top",
|
||||
|
|
@ -152,10 +153,16 @@
|
|||
"fieldname": "section_break_18",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Link Cards"
|
||||
},
|
||||
{
|
||||
"default": "0",
|
||||
"fieldname": "is_standard",
|
||||
"fieldtype": "Check",
|
||||
"label": "Is Standard"
|
||||
}
|
||||
],
|
||||
"links": [],
|
||||
"modified": "2020-03-02 20:08:44.856046",
|
||||
"modified": "2020-03-05 15:39:17.658280",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Desk",
|
||||
"name": "Desk Page",
|
||||
|
|
|
|||
|
|
@ -10,9 +10,10 @@ from frappe.model.document import Document
|
|||
|
||||
class DeskPage(Document):
|
||||
def validate(self):
|
||||
if (not (frappe.flags.in_install or frappe.flags.in_patch or frappe.flags.in_test or frappe.flags.in_fixtures)
|
||||
and not frappe.conf.developer_mode):
|
||||
if (self.is_standard and not frappe.conf.developer_mode and \
|
||||
not (frappe.flags.in_install or frappe.flags.in_patch or frappe.flags.in_test or frappe.flags.in_fixtures)):
|
||||
frappe.throw(_("You need to be in developer mode to edit this document"))
|
||||
|
||||
def on_update(self):
|
||||
export_to_files(record_list=[['Desk Page', self.name]], record_module=self.module)
|
||||
if frappe.conf.developer_mode and not self.is_standard:
|
||||
export_to_files(record_list=[['Desk Page', self.name]], record_module=self.module)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue