def get_messages_from_page_or_report(doctype, name, module=None): if not module: module = webnotes.conn.get_value(doctype, name, "module") file_path = webnotes.get_module_path(module, doctype, name, name) messages = get_messages_from_file(file_path + ".js") return clean(messages)
def get_messages_from_doctype(name): messages = [] meta = webnotes.get_doctype(name) messages = [meta[0].name, meta[0].description, meta[0].module] for d in meta.get({"doctype":"DocField"}): messages.extend([d.label, d.description]) if d.fieldtype=='Select' and d.options \ and not d.options.startswith("link:") \ and not d.options.startswith("attach_files:"): options = d.options.split('\n') if not "icon" in options[0]: messages.extend(options) # extract from js, py files doctype_file_path = webnotes.get_module_path(meta[0].module, "doctype", meta[0].name, meta[0].name) messages.extend(get_messages_from_file(doctype_file_path + ".js")) return clean(messages)
def get_module_path(module): """Returns path of the given module""" return webnotes.get_module_path(module)