mirror of
https://github.com/frappe/erpnext.git
synced 2026-02-15 23:54:59 +00:00
feat: letterhead for print format
This commit is contained in:
122
erpnext/accounts/letterhead/letterhead_plain.html
Normal file
122
erpnext/accounts/letterhead/letterhead_plain.html
Normal file
@@ -0,0 +1,122 @@
|
||||
<style>
|
||||
.letter-head {
|
||||
border-radius: 18px;
|
||||
padding-right: 12px;
|
||||
margin-left: 12px;
|
||||
margin-right: 12px;
|
||||
}
|
||||
|
||||
.letter-head td{
|
||||
padding: 0px !important;
|
||||
}
|
||||
.invoice-header {
|
||||
width: 100%;
|
||||
}
|
||||
.logo-cell {
|
||||
width: 100px;
|
||||
text-align: center;
|
||||
position: relative;
|
||||
|
||||
}
|
||||
.logo-container {
|
||||
width: 90px;
|
||||
border: 1px solid #EDEDED;
|
||||
border-radius: 15px;
|
||||
display: block;
|
||||
}
|
||||
.logo-container img {
|
||||
max-width: 90px;
|
||||
max-height: 90px;
|
||||
display: inline-block;
|
||||
}
|
||||
.company-details {
|
||||
width: 40%;
|
||||
}
|
||||
.company-name {
|
||||
font-size: 14px;
|
||||
font-weight: bold;
|
||||
color: #171717;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
.invoice-info-cell {
|
||||
float: right;
|
||||
vertical-align: top;
|
||||
}
|
||||
.invoice-info {
|
||||
margin-bottom: 2px;
|
||||
}
|
||||
.invoice-label {
|
||||
color: #7C7C7C;
|
||||
display: inline-block;
|
||||
width: 60px;
|
||||
margin-right: 5px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<table class="invoice-header">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="logo-cell" style="vertical-align: middle !important;">
|
||||
<div class="logo-container">
|
||||
{% set company_logo = frappe.db.get_value("Company", doc.company, "company_logo") %}
|
||||
{% if company_logo %}
|
||||
<img src="{{ frappe.utils.get_url(company_logo) }}" alt="Company Logo">
|
||||
{% endif %}
|
||||
</div>
|
||||
</td>
|
||||
|
||||
<td class="company-details">
|
||||
<div class="company-name">
|
||||
{{ doc.company }}
|
||||
</div>
|
||||
{% set company_address = frappe.get_all(
|
||||
"Dynamic Link",
|
||||
fields=["parent"],
|
||||
filters={
|
||||
"link_doctype": "Company",
|
||||
"link_name": doc.company,
|
||||
"parenttype": "Address"
|
||||
},
|
||||
limit=1
|
||||
) %}
|
||||
{% if company_address %}
|
||||
{% set address = frappe.get_doc("Address", company_address[0].parent) %}
|
||||
{{ address.address_line1 or "" }}<br>
|
||||
{% if address.address_line2 %}
|
||||
{{ address.address_line2 }}<br>
|
||||
{% endif %}
|
||||
{{ address.city or "" }} {{ address.state or "" }} {{ address.pincode or "" }} {{ address.country or "" }}
|
||||
{% endif %}
|
||||
</td>
|
||||
|
||||
<td class="invoice-info-cell">
|
||||
{% set website = frappe.db.get_value("Company", doc.company, "website") %}
|
||||
{% set email = frappe.db.get_value("Company", doc.company, "email") %}
|
||||
{% set phone_no = frappe.db.get_value("Company", doc.company, "phone_no") %}
|
||||
|
||||
<div class="invoice-info">
|
||||
<span class="invoice-label">{{ _("Invoice:") }}</span>
|
||||
<span>{{ doc.name }}</span>
|
||||
</div>
|
||||
{% if website %}
|
||||
<div class="invoice-info">
|
||||
<span class="invoice-label">{{ _("Website:") }}</span>
|
||||
<span>{{ website }}</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if email %}
|
||||
<div class="invoice-info">
|
||||
<span class="invoice-label">{{ _("Email:") }}</span>
|
||||
<span>{{ email }}</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if phone_no %}
|
||||
<div class="invoice-info">
|
||||
<span class="invoice-label">{{ _("Contact:") }}</span>
|
||||
<span>{{ phone_no }}</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -0,0 +1,124 @@
|
||||
<style>
|
||||
.letter-head {
|
||||
border-radius: 18px;
|
||||
background: #F8F8F8;
|
||||
padding: 12px;
|
||||
margin-left: 12px;
|
||||
margin-right: 12px;
|
||||
}
|
||||
.letterhead-container {
|
||||
width: 100%;
|
||||
}
|
||||
.letterhead-container .other-details {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
}
|
||||
.logo-address{
|
||||
width: 65%;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.logo {
|
||||
width: 90px;
|
||||
display: block;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.logo img {
|
||||
border-radius: 15px;
|
||||
border: 1px solid #EDEDED;
|
||||
}
|
||||
|
||||
.company-name {
|
||||
color: #171717;
|
||||
font-weight: bold;
|
||||
line-height: 23px;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.company-address {
|
||||
color: #171717;
|
||||
width: 300px;
|
||||
}
|
||||
|
||||
.invoice-title {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.invoice-number {
|
||||
color: #7C7C7C;
|
||||
}
|
||||
|
||||
.contact-title {
|
||||
color: #7C7C7C;
|
||||
width: 60px;
|
||||
display: inline-block;
|
||||
vertical-align: top;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.contact-value {
|
||||
color: #171717;
|
||||
display: inline-block;
|
||||
}
|
||||
.letterhead-container td {
|
||||
padding: 0px !important;
|
||||
position: relative;
|
||||
}
|
||||
</style>
|
||||
|
||||
<table class="letterhead-container">
|
||||
<tbody><tr>
|
||||
<td class="logo-address">
|
||||
{% set company_logo = frappe.db.get_value("Company", doc.company, "company_logo") %}
|
||||
{% if company_logo %}
|
||||
<div class="logo">
|
||||
<img src="{{ frappe.utils.get_url(company_logo) }}">
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="company-name">{{ doc.company }}</div>
|
||||
<div class="company-address">
|
||||
{% set company_address = frappe.get_all(
|
||||
"Dynamic Link",
|
||||
fields=["parent"],
|
||||
filters={
|
||||
"link_doctype": "Company",
|
||||
"link_name": doc.company,
|
||||
"parenttype": "Address"
|
||||
},
|
||||
limit=1
|
||||
) %}
|
||||
{% if company_address %}
|
||||
{% set address = frappe.get_doc("Address", company_address[0].parent) %}
|
||||
{{ address.address_line1 or "" }}<br>
|
||||
{% if address.address_line2 %}{{ address.address_line2 }}<br>{% endif %}
|
||||
{{ address.city or "" }} {{ address.state or "" }} {{ address.pincode or "" }} {{ address.country or "" }}<br>
|
||||
{% endif %}
|
||||
</div>
|
||||
</td>
|
||||
|
||||
<td style="vertical-align: top;">
|
||||
<div style="height: 90px; margin-bottom: 10px; text-align: right;">
|
||||
<div class="invoice-title">{{ _("Sales Invoice") }}</div>
|
||||
<div class="invoice-number">{{ doc.name }}</div>
|
||||
<br>
|
||||
</div>
|
||||
<div style="text-align: left; float: right;" class="other-details">
|
||||
{% set website = frappe.db.get_value("Company", doc.company, "website") %}
|
||||
{% set email = frappe.db.get_value("Company", doc.company, "email") %}
|
||||
{% set phone_no = frappe.db.get_value("Company", doc.company, "phone_no") %}
|
||||
|
||||
{% if website %}
|
||||
<div><span class="contact-title">{{ _("Website:") }}</span><span class="contact-value">{{ website }}</span></div>
|
||||
{% endif %}
|
||||
{% if email %}
|
||||
<div><span class="contact-title">{{ _("Email:") }}</span><span class="contact-value">{{ email }}</span></div>
|
||||
{% endif %}
|
||||
{% if phone_no %}
|
||||
<div><span class="contact-title">{{ _("Contact:") }}</span><span class="contact-value">{{ phone_no }}</span></div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody></table>
|
||||
@@ -1,48 +0,0 @@
|
||||
[
|
||||
{
|
||||
"align": "Left",
|
||||
"content": "<style>\n .letter-head {\n border-radius: 18px;\n padding-right: 12px;\n margin-left: 12px;\n margin-right: 12px;\n }\n \n .letter-head td{\n padding: 0px !important;\n }\n .invoice-header {\n width: 100%;\n }\n .logo-cell {\n width: 100px;\n text-align: center;\n position: relative;\n \n }\n .logo-container {\n width: 90px;\n border: 1px solid #EDEDED;\n border-radius: 15px;\n display: block;\n }\n .logo-container img {\n max-width: 90px;\n max-height: 90px;\n display: inline-block;\n }\n .company-details {\n width: 40%;\n }\n .company-name {\n font-size: 14px;\n font-weight: bold;\n color: #171717;\n margin-bottom: 4px;\n }\n .invoice-info-cell {\n float: right;\n vertical-align: top;\n }\n .invoice-info {\n margin-bottom: 2px;\n }\n .invoice-label {\n color: #7C7C7C;\n display: inline-block;\n width: 60px;\n margin-right: 5px;\n }\n</style>\n\n<table class=\"invoice-header\">\n <tbody>\n <tr>\n <td class=\"logo-cell\" style=\"vertical-align: middle !important;\">\n <div class=\"logo-container\">\n {% set company_logo = frappe.db.get_value(\"Company\", doc.company, \"company_logo\") %}\n {% if company_logo %}\n <img src=\"{{ frappe.utils.get_url(company_logo) }}\" alt=\"Company Logo\">\n {% endif %}\n </div>\n </td>\n\n <td class=\"company-details\">\n <div class=\"company-name\">\n {{ doc.company }}\n </div>\n {% set company_address = frappe.get_all(\n \"Dynamic Link\",\n fields=[\"parent\"],\n filters={\n \"link_doctype\": \"Company\",\n \"link_name\": doc.company,\n \"parenttype\": \"Address\"\n },\n limit=1\n ) %}\n {% if company_address %}\n {% set address = frappe.get_doc(\"Address\", company_address[0].parent) %}\n {{ address.address_line1 or \"\" }}<br>\n {% if address.address_line2 %}\n {{ address.address_line2 }}<br>\n {% endif %}\n {{ address.city or \"\" }} {{ address.state or \"\" }} {{ address.pincode or \"\" }} {{ address.country or \"\" }}\n {% endif %}\n </td>\n\n <td class=\"invoice-info-cell\">\n {% set website = frappe.db.get_value(\"Company\", doc.company, \"website\") %}\n {% set email = frappe.db.get_value(\"Company\", doc.company, \"email\") %}\n {% set phone_no = frappe.db.get_value(\"Company\", doc.company, \"phone_no\") %}\n\n <div class=\"invoice-info\">\n <span class=\"invoice-label\">{{ _(\"Invoice:\") }}</span>\n <span>{{ doc.name }}</span>\n </div>\n {% if website %}\n <div class=\"invoice-info\">\n <span class=\"invoice-label\">{{ _(\"Website:\") }}</span>\n <span>{{ website }}</span>\n </div>\n {% endif %}\n {% if email %}\n <div class=\"invoice-info\">\n <span class=\"invoice-label\">{{ _(\"Email:\") }}</span>\n <span>{{ email }}</span>\n </div>\n {% endif %}\n {% if phone_no %}\n <div class=\"invoice-info\">\n <span class=\"invoice-label\">{{ _(\"Contact:\") }}</span>\n <span>{{ phone_no }}</span>\n </div>\n {% endif %}\n </td>\n </tr>\n </tbody>\n</table>\n",
|
||||
"disabled": 0,
|
||||
"docstatus": 0,
|
||||
"doctype": "Letter Head",
|
||||
"footer": null,
|
||||
"footer_align": "Left",
|
||||
"footer_image": null,
|
||||
"footer_image_height": 0.0,
|
||||
"footer_image_width": 0.0,
|
||||
"footer_script": null,
|
||||
"footer_source": "HTML",
|
||||
"header_script": null,
|
||||
"image": null,
|
||||
"image_height": 0.0,
|
||||
"image_width": 0.0,
|
||||
"is_default": 0,
|
||||
"letter_head_name": "Sales Invoice Letter Head",
|
||||
"modified": "2025-09-19 14:10:13.265409",
|
||||
"name": "Sales Invoice Letter Head",
|
||||
"source": "HTML"
|
||||
},
|
||||
{
|
||||
"align": "Left",
|
||||
"content": "<style>\n .letter-head {\n border-radius: 18px;\n background: #F8F8F8;\n padding: 12px;\n margin-left: 12px;\n margin-right: 12px;\n /*margin-top: 12px !important;*/\n }\n .letterhead-container {\n width: 100%;\n }\n .letterhead-container .other-details {\n position: absolute;\n right: 0;\n bottom: 0;\n }\n .logo-address{\n width: 65%;\n vertical-align: top;\n }\n\n .logo {\n width: 90px;\n display: block;\n margin-bottom: 10px;\n }\n \n .logo img {\n border-radius: 15px;\n border: 1px solid #EDEDED;\n }\n\n .company-name {\n color: #171717;\n font-weight: bold;\n line-height: 23px;\n margin-bottom: 5px;\n }\n\n .company-address {\n color: #171717;\n width: 300px;\n }\n\n .invoice-title {\n font-weight: bold;\n }\n\n .invoice-number {\n color: #7C7C7C;\n }\n\n .contact-title {\n color: #7C7C7C;\n width: 60px;\n display: inline-block;\n vertical-align: top;\n margin-right: 10px;\n }\n\n .contact-value {\n color: #171717;\n display: inline-block;\n }\n .letterhead-container td {\n padding: 0px !important;\n position: relative;\n }\n</style>\n\n<table class=\"letterhead-container\">\n <tbody><tr>\n <td class=\"logo-address\">\n {% set company_logo = frappe.db.get_value(\"Company\", doc.company, \"company_logo\") %}\n {% if company_logo %}\n <div class=\"logo\">\n <img src=\"{{ frappe.utils.get_url(company_logo) }}\">\n </div>\n {% endif %}\n <div class=\"company-name\">{{ doc.company }}</div>\n <div class=\"company-address\">\n {% set company_address = frappe.get_all(\n \"Dynamic Link\",\n fields=[\"parent\"],\n filters={\n \"link_doctype\": \"Company\",\n \"link_name\": doc.company,\n \"parenttype\": \"Address\"\n },\n limit=1\n ) %}\n {% if company_address %}\n {% set address = frappe.get_doc(\"Address\", company_address[0].parent) %}\n {{ address.address_line1 or \"\" }}<br>\n {% if address.address_line2 %}{{ address.address_line2 }}<br>{% endif %}\n {{ address.city or \"\" }} {{ address.state or \"\" }} {{ address.pincode or \"\" }} {{ address.country or \"\" }}<br>\n {% endif %}\n </div>\n </td>\n\n <td style=\"vertical-align: top;\">\n <div style=\"height: 90px; margin-bottom: 10px; text-align: right;\">\n <div class=\"invoice-title\">{{ _(\"Sales Invoice\") }}</div>\n <div class=\"invoice-number\">{{ doc.name }}</div>\n <br>\n </div>\n <div style=\"text-align: left; float: right;\" class=\"other-details\">\n {% set website = frappe.db.get_value(\"Company\", doc.company, \"website\") %}\n {% set email = frappe.db.get_value(\"Company\", doc.company, \"email\") %}\n {% set phone_no = frappe.db.get_value(\"Company\", doc.company, \"phone_no\") %}\n \n {% if website %}\n <div><span class=\"contact-title\">{{ _(\"Website:\") }}</span><span class=\"contact-value\">{{ website }}</span></div>\n {% endif %}\n {% if email %}\n <div><span class=\"contact-title\">{{ _(\"Email:\") }}</span><span class=\"contact-value\">{{ email }}</span></div>\n {% endif %}\n {% if phone_no %}\n <div><span class=\"contact-title\">{{ _(\"Contact:\") }}</span><span class=\"contact-value\">{{ phone_no }}</span></div>\n {% endif %}\n </div>\n </td>\n </tr>\n</tbody></table>\n",
|
||||
"disabled": 0,
|
||||
"docstatus": 0,
|
||||
"doctype": "Letter Head",
|
||||
"footer": null,
|
||||
"footer_align": "Left",
|
||||
"footer_image": null,
|
||||
"footer_image_height": 0.0,
|
||||
"footer_image_width": 0.0,
|
||||
"footer_script": null,
|
||||
"footer_source": "HTML",
|
||||
"header_script": null,
|
||||
"image": null,
|
||||
"image_height": 0.0,
|
||||
"image_width": 0.0,
|
||||
"is_default": 0,
|
||||
"letter_head_name": "Print Format Letter Head",
|
||||
"modified": "2025-09-19 13:59:22.029272",
|
||||
"name": "Print Format Letter Head",
|
||||
"source": "HTML"
|
||||
}
|
||||
]
|
||||
@@ -600,13 +600,6 @@ user_privacy_documents = [
|
||||
},
|
||||
]
|
||||
|
||||
fixtures = [
|
||||
{
|
||||
"dt": "Letter Head",
|
||||
"filters": [["name", "in", ["Sales Invoice Letter Head", "Print Format Letter Head"]]],
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
# ERPNext doctypes for Global Search
|
||||
global_search_doctypes = {
|
||||
|
||||
Reference in New Issue
Block a user