Example #1
0
	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))
Example #2
0
    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))
Example #3
0
	def on_update(self):
		"""
			Writes the .json for this page and if write_content is checked,
			it will write out a .html file
		"""
		if self.flags.do_not_update_json:
			return

		from frappe.core.doctype.doctype.doctype import make_module_and_roles
		make_module_and_roles(self, "roles")

		from frappe.modules.utils import export_module_json
		path = export_module_json(self, self.standard=='Yes', self.module)

		if path:
			# 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))
Example #4
0
	def on_update(self):
		"""
			Writes the .json for this page and if write_content is checked,
			it will write out a .html file
		"""
		if self.flags.do_not_update_json:
			return

		from frappe.core.doctype.doctype.doctype import make_module_and_roles
		make_module_and_roles(self, "roles")

		from frappe.modules.utils import export_module_json
		path = export_module_json(self, self.standard=='Yes', self.module)

		if path:
			# 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))