def export_doc(self): from frappe.modules.export_file import export_to_files if self.doc.is_standard == 'Yes' and (conf.get('developer_mode') or 0) == 1: export_to_files(record_list=[['Report', self.doc.name]], record_module=frappe.db.get_value( "DocType", self.doc.ref_doctype, "module"))
def on_update(self): if self.ref_doctype: module = frappe.db.get_value('DocType', self.ref_doctype, 'module') else: module = self.slide_module export_to_files(record_list=[['Onboarding Slide', self.name]], record_module=module)
def on_update(self): """ Writes the .txt for this page and if write_content is checked, it will write out a .html file """ from frappe.core.doctype.doctype.doctype import make_module_and_roles make_module_and_roles(self, "roles") if not frappe.flags.in_import and getattr( conf, 'developer_mode', 0) and self.standard == 'Yes': from frappe.modules.export_file import export_to_files from frappe.modules import get_module_path, scrub import os export_to_files(record_list=[['Page', self.name]]) # write files path = os.path.join(get_module_path(self.module), 'page', scrub(self.name), scrub(self.name)) # js if not os.path.exists(path + '.js'): with open(path + '.js', 'w') as f: f.write( """frappe.pages['%s'].on_page_load = function(wrapper) { var page = frappe.ui.make_app_page({ parent: wrapper, title: '%s', single_column: true }); }""" % (self.name, self.title))
def export_doc(self): # export if self.standard == 'Yes' and (frappe.conf.get('developer_mode') or 0) == 1: module = frappe.db.get_value("DocType", self.doc_type, "module") from frappe.modules.export_file import export_to_files export_to_files(record_list=[['Print Format', self.name]], record_module= module)
def export_doc(self): # export if self.standard == 'Yes' and (frappe.conf.get('developer_mode') or 0) == 1: from frappe.modules.export_file import export_to_files export_to_files(record_list=[['Print Format', self.name]], record_module=self.module)
def on_update(self): if disable_saving_as_standard(): return if frappe.conf.developer_mode and self.is_standard: export_to_files(record_list=[['Workspace', self.name]], record_module=self.module)
def on_update(self): """ Writes the .txt for this page and if write_content is checked, it will write out a .html file """ if not frappe.flags.in_import and getattr(frappe.get_conf(),'developer_mode', 0) and self.is_standard: from frappe.modules.export_file import export_to_files from frappe.modules import get_module_path, scrub import os # json export_to_files(record_list=[['Web Form', self.name]]) # write files path = os.path.join(get_module_path(self.module), 'web_form', scrub(self.name), scrub(self.name)) # js if not os.path.exists(path + '.js'): with open(path + '.js', 'w') as f: f.write("""frappe.ready(function() { // bind events here })""") # py if not os.path.exists(path + '.py'): with open(path + '.py', 'w') as f: f.write("""from __future__ import unicode_literals import frappe def get_context(context): # do your magic here pass """)
def on_update(self): """ Writes the .txt for this page and if write_content is checked, it will write out a .html file """ from frappe import conf from frappe.core.doctype.doctype.doctype import make_module_and_roles make_module_and_roles(self, "roles") if not frappe.flags.in_import and getattr(conf,'developer_mode', 0) and self.standard=='Yes': from frappe.modules.export_file import export_to_files from frappe.modules import get_module_path, scrub import os export_to_files(record_list=[['Page', self.name]]) # write files path = os.path.join(get_module_path(self.module), 'page', scrub(self.name), scrub(self.name)) # js if not os.path.exists(path + '.js'): with open(path + '.js', 'w') as f: f.write("""frappe.pages['%s'].on_page_load = function(wrapper) { var page = frappe.ui.make_app_page({ parent: wrapper, title: '%s', single_column: true }); }""" % (self.name, self.title))
def on_update(self): if frappe.conf.developer_mode: export_to_files(record_list=[['Module Onboarding', self.name]], record_module=self.module) for step in self.steps: export_to_files(record_list=[['Onboarding Step', step.step]], record_module=self.module)
def on_update(self): if self.is_default: # make all other dashboards non-default frappe.db.sql('''update tabDashboard set is_default = 0 where name != %s''', self.name) if frappe.conf.developer_mode and self.is_standard: export_to_files(record_list=[['Dashboard', self.name, self.module + ' Dashboard']], record_module=self.module)
def export_doc(self): if frappe.flags.in_import: return if self.is_standard == "Yes" and (frappe.local.conf.get("developer_mode") or 0) == 1: export_to_files(record_list=[["Report", self.name]], record_module=self.module) self.create_report_py()
def export_doc(self): if frappe.flags.in_import: return if self.is_standard == 'Yes' and (frappe.local.conf.get('developer_mode') or 0) == 1: export_to_files(record_list=[['Report', self.name]], record_module=self.module, create_init=True) self.create_report_py()
def on_update(self): if frappe.conf.developer_mode: # custom to standard if self.standard: export_to_files(record_list=[["Web Template", self.name]], create_init=True) self.create_template_file() # standard to custom was_standard = (self.get_doc_before_save() or {}).get("standard") if was_standard and not self.standard: self.template = self.get_template(standard=True) rmtree(self.get_template_folder())
def export_module_json(doc, is_standard, module): """Make a folder for the given doc and add its json file (make it a standard object that will be synced)""" if (not frappe.flags.in_import and getattr(frappe.get_conf(),'developer_mode', 0) and is_standard): from frappe.modules.export_file import export_to_files # json export_to_files(record_list=[[doc.doctype, doc.name]], record_module=module) path = os.path.join(frappe.get_module_path(module), scrub(doc.doctype), scrub(doc.name), scrub(doc.name)) return path
def export_module_json(doc, is_standard, module): """Make a folder for the given doc and add its json file (make it a standard object that will be synced)""" if (not frappe.flags.in_import and getattr(frappe.get_conf(),'developer_mode', 0) and is_standard): from frappe.modules.export_file import export_to_files # json export_to_files(record_list=[[doc.doctype, doc.name]], record_module=module, create_init=is_standard) path = os.path.join(frappe.get_module_path(module), scrub(doc.doctype), scrub(doc.name), scrub(doc.name)) return path
def on_update(self): # update custom fields in mappings self.make_custom_fields_for_mappings() if frappe.flags.in_import or frappe.flags.in_test: return if frappe.local.conf.get('developer_mode'): record_list = [['Data Migration Plan', self.name]] for m in self.mappings: record_list.append(['Data Migration Mapping', m.mapping]) export_to_files(record_list=record_list, record_module=self.module) for m in self.mappings: dt, dn = scrub_dt_dn('Data Migration Mapping', m.mapping) create_init_py(get_module_path(self.module), dt, dn)
def on_update(self): # update custom fields in mappings self.make_custom_fields_for_mappings() if frappe.flags.in_import or frappe.flags.in_test: return if frappe.local.conf.get('developer_mode'): record_list =[['Data Migration Plan', self.name]] for m in self.mappings: record_list.append(['Data Migration Mapping', m.mapping]) export_to_files(record_list=record_list, record_module=self.module) for m in self.mappings: dt, dn = scrub_dt_dn('Data Migration Mapping', m.mapping) create_init_py(get_module_path(self.module), dt, dn)
def on_update(self): """ Writes the .txt for this page and if write_content is checked, it will write out a .html file """ if not frappe.flags.in_import and getattr( frappe.get_conf(), 'developer_mode', 0) and self.is_standard: from frappe.modules.export_file import export_to_files from frappe.modules import get_module_path, scrub import os # json export_to_files(record_list=[['Web Form', self.name]]) # write files path = os.path.join(get_module_path(self.module), 'web_form', scrub(self.name), scrub(self.name)) # js if not os.path.exists(path + '.js'): with open(path + '.js', 'w') as f: f.write("""frappe.ready(function() { // bind events here })""") # py if not os.path.exists(path + '.py'): with open(path + '.py', 'w') as f: f.write("""from __future__ import unicode_literals import frappe def get_context(context): # do your magic here pass """)
def on_update(self): if frappe.conf.developer_mode and self.is_standard: export_to_files([['Form Tour', self.name]], self.module)
def export_doc(self): """Export to standard folder `[module]/doctype/[name]/[name].json`.""" from frappe.modules.export_file import export_to_files export_to_files(record_list=[['DocType', self.name]])
def export_doc(self): from frappe.modules.export_file import export_to_files if self.is_standard == 'Yes' and (conf.get('developer_mode') or 0) == 1: export_to_files(record_list=[['Report', self.name]], record_module=self.module)
def export_doc(self): from frappe.modules.export_file import export_to_files export_to_files(record_list=[['DocType', self.name]])
def export_doc(self): from frappe.modules.export_file import export_to_files if self.is_standard == 'Yes' and ( frappe.local.conf.get('developer_mode') or 0) == 1: export_to_files(record_list=[['Report', self.name]], record_module=self.module)
def on_update(self): frappe.cache().delete_key('chart-data:{}'.format(self.name)) if frappe.conf.developer_mode and self.is_standard: export_to_files(record_list=[['Dashboard Chart', self.name]], record_module=self.module)
def export_doc(self): """Export to standard folder `[module]/website_theme/[name]/[name].json`.""" from frappe.modules.export_file import export_to_files export_to_files(record_list=[['Website Theme', self.name]], create_init=True)
def export_doc(self): """Export to standard folder `[module]/website_theme/[name]/[name].json`.""" from frappe.modules.export_file import export_to_files export_to_files(record_list=[['Website Theme', self.name]])
def on_update(self): export_to_files(record_list=[[self.doctype, self.name]], record_module=self.module, create_init=True)
def export_doc(self): """Export to standard folder `[module]/doctype/[name]/[name].json`.""" from frappe.modules.export_file import export_to_files export_to_files(record_list=[['DocType', self.name]], create_init=True)
def on_update(self): if frappe.conf.developer_mode and self.is_standard: export_to_files(record_list=[['Number Card', self.name]], record_module=self.module)
def on_update(self): if self.standard and frappe.conf.developer_mode: export_to_files(record_list=[["Web Template", self.name]], create_init=True) self.create_template_file()