コード例 #1
0
ファイル: meta.py プロジェクト: AhmedHamedTN/frappe
	def set_translations(self, lang):
		self.set("__messages", frappe.get_lang_dict("doctype", self.name))

		# set translations for grid templates
		if self.get("__form_grid_templates"):
			for content in self.get("__form_grid_templates").values():
				messages = extract_messages_from_code(content)
				messages = make_dict_from_messages(messages)
				self.get("__messages").update(messages, as_value=True)
コード例 #2
0
	def set_translations(self, lang):
		self.set("__messages", frappe.get_lang_dict("doctype", self.name))

		# set translations for grid templates
		if self.get("__form_grid_templates"):
			for content in self.get("__form_grid_templates").values():
				messages = extract_messages_from_code(content)
				messages = make_dict_from_messages(messages)
				self.get("__messages").update(messages, as_value=True)
コード例 #3
0
def getdoc(doctype, name, user=None):
    """
	Loads a doclist for a given document. This method is called directly from the client.
	Requries "doctype", "name" as form variables.
	Will also call the "onload" method on the document.
	"""

    if not (doctype and name):
        raise Exception, 'doctype and name required!'

    if not name:
        name = doctype

    if not frappe.db.exists(doctype, name):
        return []

    try:
        doc = frappe.get_doc(doctype, name)
        run_onload(doc)

        if not doc.has_permission("read"):
            raise frappe.PermissionError, "read"

        # add file list
        get_docinfo(doc)

    except Exception:
        frappe.errprint(frappe.utils.get_traceback())
        frappe.msgprint(_('Did not load'))
        raise

    if doc and not name.startswith('_'):
        frappe.user.update_recent(doctype, name)

    if (doctype == "Report" and frappe.lang != "en"):
        frappe.response["translated_message"] = make_dict_from_messages(
            get_messages_from_report(name))

    frappe.response.docs.append(doc)
コード例 #4
0
ファイル: load.py プロジェクト: 81552433qqcom/frappe
def getdoc(doctype, name, user=None):
	"""
	Loads a doclist for a given document. This method is called directly from the client.
	Requries "doctype", "name" as form variables.
	Will also call the "onload" method on the document.
	"""

	if not (doctype and name):
		raise Exception, 'doctype and name required!'

	if not name:
		name = doctype

	if not frappe.db.exists(doctype, name):
		return []

	try:
		doc = frappe.get_doc(doctype, name)
		run_onload(doc)

		if not doc.has_permission("read"):
			raise frappe.PermissionError, "read"

		# add file list
		get_docinfo(doc)

	except Exception:
		frappe.errprint(frappe.utils.get_traceback())
		frappe.msgprint(_('Did not load'))
		raise

	if doc and not name.startswith('_'):
		frappe.user.update_recent(doctype, name)

	if(doctype == "Report" and 	frappe.lang != "en"):
		frappe.response["translated_message"] = make_dict_from_messages(get_messages_from_report(name))

	frappe.response.docs.append(doc)