mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-03 05:28:27 +00:00
feat: add default letterhead with HTML template via after_install
This commit is contained in:
@@ -28,6 +28,7 @@
|
|||||||
max-width: 90px;
|
max-width: 90px;
|
||||||
max-height: 90px;
|
max-height: 90px;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
|
border-radius: 15px;
|
||||||
}
|
}
|
||||||
.company-details {
|
.company-details {
|
||||||
width: 40%;
|
width: 40%;
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
# License: GNU General Public License v3. See license.txt
|
# License: GNU General Public License v3. See license.txt
|
||||||
|
|
||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
import frappe
|
import frappe
|
||||||
from frappe import _
|
from frappe import _
|
||||||
from frappe.custom.doctype.custom_field.custom_field import create_custom_fields
|
from frappe.custom.doctype.custom_field.custom_field import create_custom_fields
|
||||||
@@ -34,6 +36,7 @@ def after_install():
|
|||||||
update_roles()
|
update_roles()
|
||||||
make_default_operations()
|
make_default_operations()
|
||||||
update_pegged_currencies()
|
update_pegged_currencies()
|
||||||
|
create_letter_head()
|
||||||
frappe.db.commit()
|
frappe.db.commit()
|
||||||
|
|
||||||
|
|
||||||
@@ -279,6 +282,38 @@ def update_pegged_currencies():
|
|||||||
doc.save()
|
doc.save()
|
||||||
|
|
||||||
|
|
||||||
|
def create_letter_head():
|
||||||
|
base_path = frappe.get_app_path("erpnext", "letterhead")
|
||||||
|
letterhead_with_background_colour = frappe.read_file(
|
||||||
|
os.path.join(base_path, "letterhead_with_background_colour.html")
|
||||||
|
)
|
||||||
|
letterhead_plain = frappe.read_file(os.path.join(base_path, "letterhead_plain.html"))
|
||||||
|
|
||||||
|
if not frappe.db.exists("Letter Head", "Letterhead with background colour"):
|
||||||
|
doc = frappe.get_doc(
|
||||||
|
{
|
||||||
|
"doctype": "Letter Head",
|
||||||
|
"letter_head_name": "Letterhead with background colour",
|
||||||
|
"source": "HTML",
|
||||||
|
"content": letterhead_with_background_colour,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
doc.insert(ignore_permissions=True)
|
||||||
|
frappe.db.commit()
|
||||||
|
|
||||||
|
if not frappe.db.exists("Letter Head", "Letterhead Plain"):
|
||||||
|
doc = frappe.get_doc(
|
||||||
|
{
|
||||||
|
"doctype": "Letter Head",
|
||||||
|
"letter_head_name": "Letterhead plain",
|
||||||
|
"source": "HTML",
|
||||||
|
"content": letterhead_plain,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
doc.insert(ignore_permissions=True)
|
||||||
|
frappe.db.commit()
|
||||||
|
|
||||||
|
|
||||||
DEFAULT_ROLE_PROFILES = {
|
DEFAULT_ROLE_PROFILES = {
|
||||||
"Inventory": [
|
"Inventory": [
|
||||||
"Stock User",
|
"Stock User",
|
||||||
|
|||||||
Reference in New Issue
Block a user