def get_standard_permissions(doctype):
	frappe.only_for("System Manager")
	meta = frappe.get_meta(doctype)
	if meta.custom:
		doc = frappe.get_doc('DocType', doctype)
		return [p.as_dict() for p in doc.permissions]
	else:
		# also used to setup permissions via patch
		path = get_file_path(meta.module, "DocType", doctype)
		return read_doc_from_file(path).get("permissions")
Esempio n. 2
0
def get_standard_permissions(doctype):
	frappe.only_for("System Manager")
	meta = frappe.get_meta(doctype)
	if meta.custom:
		doc = frappe.get_doc('DocType', doctype)
		return [p.as_dict() for p in doc.permissions]
	else:
		# also used to setup permissions via patch
		path = get_file_path(meta.module, "DocType", doctype)
		return read_doc_from_file(path).get("permissions")
Esempio n. 3
0
	def try_from_cache():
		filename = action + '.json'
		training_dir = '/training' if settings.is_training else ''
		cache_dir = frappe.get_app_path("erpnext_biotrack",
										"fixtures/offline_sync{training_dir}".format(training_dir=training_dir))

		if not os.path.exists(cache_dir):
			os.mkdir(cache_dir)

		f = frappe.get_app_path("erpnext_biotrack", cache_dir, filename)

		if os.path.exists(f):
			result = read_doc_from_file(f)
		else:
			result = client.post(action, data)
			with open(f, "w") as outfile:
				outfile.write(frappe.as_json(result))

		return result
Esempio n. 4
0
    def try_from_cache():
        filename = action + '.json'
        training_dir = '/training' if settings.is_training else ''
        cache_dir = frappe.get_app_path(
            "erpnext_biotrack", "fixtures/offline_sync{training_dir}".format(
                training_dir=training_dir))

        if not os.path.exists(cache_dir):
            os.mkdir(cache_dir)

        f = frappe.get_app_path("erpnext_biotrack", cache_dir, filename)

        if os.path.exists(f):
            result = read_doc_from_file(f)
        else:
            result = client.post(action, data)
            with open(f, "w") as outfile:
                outfile.write(frappe.as_json(result))

        return result
Esempio n. 5
0
def get_standard_permissions(doctype):
	frappe.only_for("System Manager")
	module = frappe.db.get_value("DocType", doctype, "module")
	path = get_file_path(module, "DocType", doctype)
	return read_doc_from_file(path).get("permissions")
def get_standard_permissions(doctype):
    frappe.only_for("System Manager")
    module = frappe.db.get_value("DocType", doctype, "module")
    path = get_file_path(module, "DocType", doctype)
    return read_doc_from_file(path).get("permissions")