refactor: desk page update handling
This commit is contained in:
parent
bdb34ea006
commit
52bf52790d
1 changed files with 9 additions and 3 deletions
|
|
@ -10,13 +10,19 @@ from frappe.model.document import Document
|
|||
|
||||
class DeskPage(Document):
|
||||
def validate(self):
|
||||
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)):
|
||||
if (self.is_standard and not frappe.conf.developer_mode and not disable_saving_as_standard()):
|
||||
frappe.throw(_("You need to be in developer mode to edit this document"))
|
||||
|
||||
def on_update(self):
|
||||
if frappe.flags.in_install or frappe.flags.in_patch or frappe.flags.in_test or frappe.flags.in_fixtures:
|
||||
if disable_saving_as_standard():
|
||||
return
|
||||
|
||||
if frappe.conf.developer_mode and self.is_standard:
|
||||
export_to_files(record_list=[['Desk Page', self.name]], record_module=self.module)
|
||||
|
||||
def disable_saving_as_standard():
|
||||
return frappe.flags.in_install or \
|
||||
frappe.flags.in_patch or \
|
||||
frappe.flags.in_test or \
|
||||
frappe.flags.in_fixtures or \
|
||||
frappe.flags.in_migrate
|
||||
Loading…
Add table
Reference in a new issue