mirror of
https://github.com/frappe/erpnext.git
synced 2026-03-07 04:24:13 +00:00
feat: default letterhead and print format
(cherry picked from commit 0ea22f9796)
This commit is contained in:
@@ -35,6 +35,7 @@ def after_install():
|
||||
update_roles()
|
||||
make_default_operations()
|
||||
update_pegged_currencies()
|
||||
set_default_print_formats()
|
||||
create_letter_head()
|
||||
frappe.db.commit()
|
||||
|
||||
@@ -301,6 +302,31 @@ def update_pegged_currencies():
|
||||
doc.save()
|
||||
|
||||
|
||||
def set_default_print_formats():
|
||||
default_map = {
|
||||
"Sales Order": "Sales Order with Item Image",
|
||||
"Sales Invoice": "Sales Invoice with Item Image",
|
||||
"Delivery Note": "Delivery Note with Item Image",
|
||||
"Purchase Order": "Purchase Order with Item Image",
|
||||
"Purchase Invoice": "Purchase Invoice with Item Image",
|
||||
"POS Invoice": "POS Invoice with Item Image",
|
||||
}
|
||||
|
||||
for doctype, print_format in default_map.items():
|
||||
if frappe.get_meta(doctype).default_print_format:
|
||||
continue
|
||||
|
||||
frappe.make_property_setter(
|
||||
{
|
||||
"doctype": doctype,
|
||||
"doctype_or_field": "DocType",
|
||||
"property": "default_print_format",
|
||||
"value": print_format,
|
||||
},
|
||||
validate_fields_for_doctype=False,
|
||||
)
|
||||
|
||||
|
||||
def create_letter_head():
|
||||
base_path = frappe.get_app_path("erpnext", "accounts", "letterhead")
|
||||
|
||||
@@ -318,6 +344,7 @@ def create_letter_head():
|
||||
"letter_head_name": name,
|
||||
"source": "HTML",
|
||||
"content": content,
|
||||
"is_default": 1 if name == "Company Letterhead - Grey" else 0,
|
||||
}
|
||||
)
|
||||
doc.insert(ignore_permissions=True)
|
||||
|
||||
Reference in New Issue
Block a user