25 lines
732 B
Python
25 lines
732 B
Python
import frappe
|
|
|
|
LOGO = "/assets/makap_backend/images/makap-icon.png"
|
|
TARGETS = {
|
|
"Navbar Settings": ["app_logo"],
|
|
"Website Settings": ["app_logo", "banner_image", "favicon", "splash_image"],
|
|
"System Settings": ["app_logo"],
|
|
}
|
|
|
|
|
|
def apply_logo():
|
|
done = []
|
|
for doctype, fields in TARGETS.items():
|
|
if not frappe.db.exists("DocType", doctype):
|
|
continue
|
|
meta = frappe.get_meta(doctype)
|
|
for field in fields:
|
|
if meta.has_field(field):
|
|
frappe.db.set_single_value(doctype, field, LOGO)
|
|
done.append("{0}.{1}".format(doctype, field))
|
|
frappe.db.commit()
|
|
frappe.clear_cache()
|
|
print("Logo set on: " + ", ".join(done))
|
|
return done
|