mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-05 13:24:47 +00:00
Merge pull request #54983 from Shllokkk/standard-letter-heads
feat: Standard letter heads for DocTypes and Reports
This commit is contained in:
@@ -17,9 +17,13 @@ from erpnext.tests.utils import ERPNextTestSuite
|
|||||||
class TestProcessStatementOfAccounts(ERPNextTestSuite, AccountsTestMixin):
|
class TestProcessStatementOfAccounts(ERPNextTestSuite, AccountsTestMixin):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
frappe.db.set_single_value("Selling Settings", "validate_selling_price", 0)
|
frappe.db.set_single_value("Selling Settings", "validate_selling_price", 0)
|
||||||
letterhead = frappe.get_doc("Letter Head", "Company Letterhead - Grey")
|
frappe.db.set_value(
|
||||||
letterhead.is_default = 0
|
"Letter Head",
|
||||||
letterhead.save()
|
"Company Letterhead - Grey",
|
||||||
|
"is_default",
|
||||||
|
0,
|
||||||
|
update_modified=False,
|
||||||
|
)
|
||||||
|
|
||||||
self.create_company()
|
self.create_company()
|
||||||
self.create_customer()
|
self.create_customer()
|
||||||
|
|||||||
0
erpnext/accounts/letter_head/__init__.py
Normal file
0
erpnext/accounts/letter_head/__init__.py
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
{
|
||||||
|
"align": "Left",
|
||||||
|
"content": "<table class=\"invoice-header\">\n\t<tbody>\n\t\t<tr>\n\t\t\t<td class=\"logo-cell\" style=\"vertical-align:middle ! important\">\n\t\t\t\t<div class=\"logo-container\">\n\t\t\t\t\t{% set company_logo = frappe.db.get_value(\"Company\", doc.company, \"company_logo\") %} {% if\n\t\t\t\t\tcompany_logo %}\n\t\t\t\t\t<img src=\"{{ frappe.utils.get_url(company_logo) }}\" alt=\"Company Logo\">\n\t\t\t\t\t{% endif %}\n\t\t\t\t</div>\n\t\t\t</td>\n\n\t\t\t<td class=\"company-details\">\n\t\t\t\t<div class=\"company-name\">{{ doc.company }}</div>\n\t\t\t\t{% if doc.company_address %} {% set company_address = frappe.db.get_value(\"Address\",\n\t\t\t\tdoc.company_address, [\"address_line1\", \"address_line2\", \"city\", \"state\", \"pincode\",\n\t\t\t\t\"country\"], as_dict=True) %} {% elif doc.billing_address %} {% set company_address =\n\t\t\t\tfrappe.db.get_value(\"Address\", doc.billing_address, [\"address_line1\", \"address_line2\", \"city\",\n\t\t\t\t\"state\", \"pincode\", \"country\"], as_dict=True) %} {% endif %} {% if company_address %} {{\n\t\t\t\tcompany_address.address_line1 or \"\" }}<br>\n\t\t\t\t{% if company_address.address_line2 %} {{ company_address.address_line2 }}<br>\n\t\t\t\t{% endif %} {{ company_address.city or \"\" }}, {{ company_address.state or \"\" }} {{\n\t\t\t\tcompany_address.pincode or \"\" }}, {{ company_address.country or \"\"}}<br>\n\t\t\t\t{% endif %}\n\t\t\t</td>\n\n\t\t\t<td class=\"invoice-info-cell\">\n\t\t\t\t{% set website = frappe.db.get_value(\"Company\", doc.company, \"website\") %} {% set email =\n\t\t\t\tfrappe.db.get_value(\"Company\", doc.company, \"email\") %} {% set phone_no =\n\t\t\t\tfrappe.db.get_value(\"Company\", doc.company, \"phone_no\") %}\n\n\t\t\t\t<div class=\"invoice-info\">\n\t\t\t\t\t<span class=\"invoice-label\">{{ doc.doctype }}</span>\n\t\t\t\t\t<span>{{ doc.name }}</span>\n\t\t\t\t</div>\n\t\t\t\t{% if website %}\n\t\t\t\t<div class=\"invoice-info\">\n\t\t\t\t\t<span class=\"invoice-label\">{{ _(\"Website:\") }}</span>\n\t\t\t\t\t<span>{{ website }}</span>\n\t\t\t\t</div>\n\t\t\t\t{% endif %} {% if email %}\n\t\t\t\t<div class=\"invoice-info\">\n\t\t\t\t\t<span class=\"invoice-label\">{{ _(\"Email:\") }}</span>\n\t\t\t\t\t<span>{{ email }}</span>\n\t\t\t\t</div>\n\t\t\t\t{% endif %} {% if phone_no %}\n\t\t\t\t<div class=\"invoice-info\">\n\t\t\t\t\t<span class=\"invoice-label\">{{ _(\"Contact:\") }}</span>\n\t\t\t\t\t<span>{{ phone_no }}</span>\n\t\t\t\t</div>\n\t\t\t\t{% endif %}\n\t\t\t</td>\n\t\t</tr>\n\t</tbody>\n</table>",
|
||||||
|
"creation": "2026-05-15 15:21:48.255627",
|
||||||
|
"custom_css": "\t.letter-head {\n\t\tborder-radius: 18px;\n\t\tpadding-right: 12px;\n\t\tmargin-left: 12px;\n\t\tmargin-right: 12px;\n\t}\n\n\t.letter-head td {\n\t\tpadding: 0px !important;\n\t}\n\t.invoice-header {\n\t\twidth: 100%;\n\t}\n\t.logo-cell {\n\t\twidth: 100px;\n\t\ttext-align: center;\n\t\tposition: relative;\n\t}\n\t.logo-container {\n\t\twidth: 90px;\n\t\tdisplay: block;\n\t}\n\t.logo-container img {\n\t\tmax-width: 90px;\n\t\tmax-height: 90px;\n\t\tdisplay: inline-block;\n\t\tborder-radius: 15px;\n\t}\n\t.company-details {\n\t\twidth: 40%;\n\t\talign-content: center;\n\t}\n\t.company-name {\n\t\tfont-size: 14px;\n\t\tfont-weight: bold;\n\t\tcolor: #171717;\n\t\tmargin-bottom: 4px;\n\t}\n\t.invoice-info-cell {\n\t\tfloat: right;\n\t\tvertical-align: top;\n\t}\n\t.invoice-info {\n\t\tmargin-bottom: 2px;\n\t}\n\t.invoice-label {\n\t\tcolor: #7c7c7c;\n\t\tdisplay: inline-block;\n\t\tmargin-right: 5px;\n\t}",
|
||||||
|
"disabled": 0,
|
||||||
|
"docstatus": 0,
|
||||||
|
"doctype": "Letter Head",
|
||||||
|
"footer_align": "Left",
|
||||||
|
"footer_image_height": 0.0,
|
||||||
|
"footer_image_width": 0.0,
|
||||||
|
"footer_source": "Image",
|
||||||
|
"idx": 0,
|
||||||
|
"image_height": 0.0,
|
||||||
|
"image_width": 0.0,
|
||||||
|
"is_default": 0,
|
||||||
|
"letter_head_for": "DocType",
|
||||||
|
"letter_head_name": "Company Letterhead",
|
||||||
|
"modified": "2026-05-16 15:15:23.014622",
|
||||||
|
"modified_by": "Administrator",
|
||||||
|
"module": "Accounts",
|
||||||
|
"name": "Company Letterhead",
|
||||||
|
"owner": "Administrator",
|
||||||
|
"source": "HTML",
|
||||||
|
"standard": "Yes"
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
{
|
||||||
|
"align": "Left",
|
||||||
|
"content": "<table class=\"letterhead-container\">\n\t<tbody>\n\t\t<tr>\n\t\t\t<td class=\"logo-address\">\n\t\t\t\t{% set company_logo = frappe.db.get_value(\"Company\", doc.company, \"company_logo\") %} {% if\n\t\t\t\tcompany_logo %}\n\t\t\t\t<div class=\"logo\">\n\t\t\t\t\t<img src=\"{{ frappe.utils.get_url(company_logo) }}\">\n\t\t\t\t</div>\n\t\t\t\t{% endif %}\n\t\t\t\t<div class=\"company-name\">{{ doc.company }}</div>\n\t\t\t\t<div class=\"company-address\">\n\t\t\t\t\t{% if doc.company_address %} {% set company_address = frappe.db.get_value(\"Address\",\n\t\t\t\t\tdoc.company_address, [\"address_line1\", \"address_line2\", \"city\", \"state\", \"pincode\",\n\t\t\t\t\t\"country\"], as_dict=True) %} {% elif doc.billing_address %} {% set company_address =\n\t\t\t\t\tfrappe.db.get_value(\"Address\", doc.billing_address, [\"address_line1\", \"address_line2\",\n\t\t\t\t\t\"city\", \"state\", \"pincode\", \"country\"], as_dict=True) %} {% endif %} {% if company_address\n\t\t\t\t\t%} {{ company_address.address_line1 or \"\" }}<br>\n\t\t\t\t\t{% if company_address.address_line2 %} {{ company_address.address_line2 }}<br>\n\t\t\t\t\t{% endif %} {{ company_address.city or \"\" }}, {{ company_address.state or \"\" }} {{\n\t\t\t\t\tcompany_address.pincode or \"\" }}, {{ company_address.country or \"\"}}<br>\n\t\t\t\t\t{% endif %}\n\t\t\t\t</div>\n\t\t\t</td>\n\n\t\t\t<td style=\"vertical-align:top\">\n\t\t\t\t<div style=\"height:90px;margin-bottom:10px;text-align:right\">\n\t\t\t\t\t<div class=\"invoice-title\">{{ doc.doctype }}</div>\n\t\t\t\t\t<div class=\"invoice-number\">{{ doc.name }}</div>\n\t\t\t\t\t<br>\n\t\t\t\t</div>\n\t\t\t\t<div style=\"text-align:left;float:right\" class=\"other-details\">\n\t\t\t\t\t{% set company_details = frappe.db.get_value(\"Company\", doc.company, [\"website\", \"email\",\n\t\t\t\t\t\"phone_no\"], as_dict=True) %} {% set website = company_details.website %} {% set email =\n\t\t\t\t\tcompany_details.email %} {% set phone_no = company_details.phone_no %} {% if website %}\n\t\t\t\t\t<div>\n\t\t\t\t\t\t<span class=\"contact-title\">{{ _(\"Website:\") }}</span><span class=\"contact-value\">{{ website }}</span>\n\t\t\t\t\t</div>\n\t\t\t\t\t{% endif %} {% if email %}\n\t\t\t\t\t<div>\n\t\t\t\t\t\t<span class=\"contact-title\">{{ _(\"Email:\") }}</span><span class=\"contact-value\">{{ email }}</span>\n\t\t\t\t\t</div>\n\t\t\t\t\t{% endif %} {% if phone_no %}\n\t\t\t\t\t<div>\n\t\t\t\t\t\t<span class=\"contact-title\">{{ _(\"Contact:\") }}</span><span class=\"contact-value\">{{ phone_no }}</span>\n\t\t\t\t\t</div>\n\t\t\t\t\t{% endif %}\n\t\t\t\t</div>\n\t\t\t</td>\n\t\t</tr>\n\t</tbody>\n</table>\n",
|
||||||
|
"creation": "2026-05-15 15:21:48.373815",
|
||||||
|
"custom_css": "\t.print-format-preview {\n\t\tmargin-top: 12px;\n\t}\n\t.letter-head {\n\t\tborder-radius: 18px;\n\t\tbackground: #f8f8f8;\n\t\tpadding: 12px;\n\t\tmargin-left: 12px;\n\t\tmargin-right: 12px;\n\t}\n\t.letterhead-container {\n\t\twidth: 100%;\n\t}\n\t.letterhead-container .other-details {\n\t\tposition: absolute;\n\t\tright: 0;\n\t\tbottom: 0;\n\t}\n\t.logo-address {\n\t\twidth: 65%;\n\t\tvertical-align: top;\n\t}\n\n\t.letter-head .logo {\n\t\twidth: 90px;\n\t\tdisplay: block;\n\t\tmargin-bottom: 10px;\n\t}\n\n\t.letter-head .logo img {\n\t\tborder-radius: 15px;\n\t}\n\n\t.company-name {\n\t\tcolor: #171717;\n\t\tfont-weight: bold;\n\t\tline-height: 23px;\n\t\tmargin-bottom: 5px;\n\t}\n\n\t.company-address {\n\t\tcolor: #171717;\n\t\twidth: 300px;\n\t}\n\n\t.invoice-title {\n\t\tfont-weight: bold;\n\t}\n\n\t.invoice-number {\n\t\tcolor: #7c7c7c;\n\t}\n\n\t.contact-title {\n\t\tcolor: #7c7c7c;\n\t\twidth: 60px;\n\t\tdisplay: inline-block;\n\t\tvertical-align: top;\n\t\tmargin-right: 10px;\n\t}\n\n\t.contact-value {\n\t\tcolor: #171717;\n\t\tdisplay: inline-block;\n\t}\n\t.letterhead-container td {\n\t\tpadding: 0px !important;\n\t\tposition: relative;\n\t}",
|
||||||
|
"disabled": 0,
|
||||||
|
"docstatus": 0,
|
||||||
|
"doctype": "Letter Head",
|
||||||
|
"footer_align": "Left",
|
||||||
|
"footer_image_height": 0.0,
|
||||||
|
"footer_image_width": 0.0,
|
||||||
|
"footer_source": "Image",
|
||||||
|
"idx": 0,
|
||||||
|
"image_height": 0.0,
|
||||||
|
"image_width": 0.0,
|
||||||
|
"is_default": 0,
|
||||||
|
"letter_head_for": "DocType",
|
||||||
|
"letter_head_name": "Company Letterhead - Grey",
|
||||||
|
"modified": "2026-05-16 15:15:19.942207",
|
||||||
|
"modified_by": "Administrator",
|
||||||
|
"module": "Accounts",
|
||||||
|
"name": "Company Letterhead - Grey",
|
||||||
|
"owner": "Administrator",
|
||||||
|
"source": "HTML",
|
||||||
|
"standard": "Yes"
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
{
|
||||||
|
"align": "Left",
|
||||||
|
"content": "<table class=\"invoice-header\">\n\t<tbody>\n\t\t<tr>\n\n\t\t\t<td class=\"logo-cell\" style=\"vertical-align:top\">\n\t\t\t\t{% set company = frappe.get_doc(\"Company\", doc.company) %}\n\n\t\t\t\t<div class=\"logo-container\">\n\t\t\t\t\t{% if company.company_logo %}\n\t\t\t\t\t<img src=\"{{ frappe.utils.get_url(company.company_logo) }}\" alt=\"Company Logo\">\n\t\t\t\t\t{% endif %}\n\t\t\t\t</div>\n\t\t\t</td>\n\n\t\t\t<td class=\"company-details\" style=\"vertical-align:top\">\n\t\t\t\t<div class=\"company-name\">{{ company.name }}</div>\n\n\t\t\t\t{% set company_address_name = frappe.db.get_value(\n\t\t\t\t\t\"Dynamic Link\",\n\t\t\t\t\t{\n\t\t\t\t\t\t\"link_doctype\": \"Company\",\n\t\t\t\t\t\t\"link_name\": company.name,\n\t\t\t\t\t\t\"parenttype\": \"Address\"\n\t\t\t\t\t},\n\t\t\t\t\t\"parent\"\n\t\t\t\t) %}\n\n\t\t\t\t{% if company_address_name %}\n\t\t\t\t\t{% set company_address = frappe.db.get_value(\n\t\t\t\t\t\t\"Address\",\n\t\t\t\t\t\tcompany_address_name,\n\t\t\t\t\t\t[\"address_line1\", \"address_line2\", \"city\", \"state\", \"pincode\", \"country\"],\n\t\t\t\t\t\tas_dict=True\n\t\t\t\t\t) %}\n\t\t\t\t{% endif %}\n\n\t\t\t\t{% if company_address %}\n\t\t\t\t<div class=\"company-address\">\n\t\t\t\t\t{{ company_address.address_line1 or \"\" }}\n\n\t\t\t\t\t{% if company_address.address_line2 %}\n\t\t\t\t\t\t<br>{{ company_address.address_line2 }}\n\t\t\t\t\t{% endif %}\n\n\t\t\t\t\t<br>\n\n\t\t\t\t\t{{ company_address.city or \"\" }}\n\t\t\t\t\t{% if company_address.state %}, {{ company_address.state }}{% endif %}\n\t\t\t\t\t{{ company_address.pincode or \"\" }}\n\n\t\t\t\t\t{% if company_address.country %}\n\t\t\t\t\t\t, {{ company_address.country }}\n\t\t\t\t\t{% endif %}\n\t\t\t\t</div>\n\t\t\t\t{% endif %}\n\t\t\t</td>\n\n\t\t\t<td class=\"invoice-info-cell\" style=\"vertical-align:top;text-align:right\">\n\n\t\t\t\t{% set website = frappe.db.get_value(\"Company\", doc.company, \"website\") %}\n\t\t\t\t{% set email = frappe.db.get_value(\"Company\", doc.company, \"email\") %}\n\t\t\t\t{% set phone_no = frappe.db.get_value(\"Company\", doc.company, \"phone_no\") %}\n\n\t\t\t\t{% if website %}\n\t\t\t\t<div class=\"invoice-info\">\n\t\t\t\t\t<span class=\"invoice-label\">{{ _(\"Website:\") }}</span>\n\t\t\t\t\t<span>{{ website }}</span>\n\t\t\t\t</div>\n\t\t\t\t{% endif %}\n\n\t\t\t\t{% if email %}\n\t\t\t\t<div class=\"invoice-info\">\n\t\t\t\t\t<span class=\"invoice-label\">{{ _(\"Email:\") }}</span>\n\t\t\t\t\t<span>{{ email }}</span>\n\t\t\t\t</div>\n\t\t\t\t{% endif %}\n\n\t\t\t\t{% if phone_no %}\n\t\t\t\t<div class=\"invoice-info\">\n\t\t\t\t\t<span class=\"invoice-label\">{{ _(\"Contact:\") }}</span>\n\t\t\t\t\t<span>{{ phone_no }}</span>\n\t\t\t\t</div>\n\t\t\t\t{% endif %}\n\t\t\t</td>\n\n\t\t</tr>\n\t</tbody>\n</table>",
|
||||||
|
"creation": "2026-05-15 19:49:47.582252",
|
||||||
|
"custom_css": ".letter-head {\n\tborder-radius: 18px;\n\tpadding: 8px 10px;\n\tmargin: 10px 0 14px;\n\tfont-family: Inter, sans-serif;\n\tfont-size: 14px;\n\tcolor: #171717;\n}\n\n.letter-head td {\n\tpadding: 0 !important;\n\tvertical-align: middle;\n}\n\n.invoice-header {\n\twidth: 100%;\n\tborder-collapse: collapse;\n\ttable-layout: fixed;\n\tborder-bottom: 1px solid #ededed;\n\tpadding-bottom: 10px;\n}\n\n.logo-cell {\n\twidth: 100px;\n\ttext-align: center;\n\twhite-space: nowrap;\n}\n\n.logo-container {\n\tdisplay: inline-block;\n\tmargin: auto;\n}\n\n.logo-container img {\n\tmax-width: 95px;\n\tmax-height: 95px;\n\tdisplay: block;\n\tborder-radius: 12px;\n}\n\n.company-details {\n\twidth: 55%;\n\tpadding-left: 10px !important;\n\tline-height: 1.5;\n}\n\n.company-name {\n\tfont-size: 14px;\n\tfont-weight: 600;\n\tcolor: #171717;\n\tmargin-bottom: 4px;\n}\n\n.company-address {\n\tfont-size: 14px;\n\tline-height: 1.5;\n\tcolor: #171717;\n}\n\n.invoice-info-cell {\n\twidth: 240px;\n\ttext-align: right;\n\tvertical-align: top !important;\n\tline-height: 1.5;\n}\n\n.document-name {\n\tfont-size: 14px;\n\tfont-weight: 600;\n\tcolor: #171717;\n\tmargin-bottom: 6px;\n}\n\n.invoice-info {\n\tfont-size: 14px;\n\tcolor: #171717;\n\tmargin-bottom: 2px;\n\tfont-variant-numeric: tabular-nums;\n}\n\n.invoice-label {\n\tcolor: #7c7c7c;\n\tfont-weight: 500;\n\tmargin-right: 4px;\n\tdisplay: inline-block;\n}",
|
||||||
|
"disabled": 0,
|
||||||
|
"docstatus": 0,
|
||||||
|
"doctype": "Letter Head",
|
||||||
|
"footer_align": "Left",
|
||||||
|
"footer_image_height": 0.0,
|
||||||
|
"footer_image_width": 0.0,
|
||||||
|
"footer_source": "Image",
|
||||||
|
"idx": 0,
|
||||||
|
"image_height": 0.0,
|
||||||
|
"image_width": 0.0,
|
||||||
|
"is_default": 0,
|
||||||
|
"letter_head_for": "Report",
|
||||||
|
"letter_head_name": "Company Letterhead Report",
|
||||||
|
"modified": "2026-05-16 15:15:26.155770",
|
||||||
|
"modified_by": "Administrator",
|
||||||
|
"module": "Accounts",
|
||||||
|
"name": "Company Letterhead Report",
|
||||||
|
"owner": "Administrator",
|
||||||
|
"source": "HTML",
|
||||||
|
"standard": "Yes"
|
||||||
|
}
|
||||||
@@ -1,108 +0,0 @@
|
|||||||
<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;
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
.logo-container img {
|
|
||||||
max-width: 90px;
|
|
||||||
max-height: 90px;
|
|
||||||
display: inline-block;
|
|
||||||
border-radius: 15px;
|
|
||||||
}
|
|
||||||
.company-details {
|
|
||||||
width: 40%;
|
|
||||||
align-content: center;
|
|
||||||
}
|
|
||||||
.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;
|
|
||||||
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>
|
|
||||||
{% if doc.company_address %} {% set company_address = frappe.db.get_value("Address",
|
|
||||||
doc.company_address, ["address_line1", "address_line2", "city", "state", "pincode",
|
|
||||||
"country"], as_dict=True) %} {% elif doc.billing_address %} {% set company_address =
|
|
||||||
frappe.db.get_value("Address", doc.billing_address, ["address_line1", "address_line2", "city",
|
|
||||||
"state", "pincode", "country"], as_dict=True) %} {% endif %} {% if company_address %} {{
|
|
||||||
company_address.address_line1 or "" }}<br />
|
|
||||||
{% if company_address.address_line2 %} {{ company_address.address_line2 }}<br />
|
|
||||||
{% endif %} {{ company_address.city or "" }}, {{ company_address.state or "" }} {{
|
|
||||||
company_address.pincode or "" }}, {{ company_address.country or ""}}<br />
|
|
||||||
{% 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">{{ doc.doctype }}</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>
|
|
||||||
@@ -1,127 +0,0 @@
|
|||||||
<style>
|
|
||||||
.print-format-preview {
|
|
||||||
margin-top: 12px;
|
|
||||||
}
|
|
||||||
.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;
|
|
||||||
}
|
|
||||||
|
|
||||||
.letter-head .logo {
|
|
||||||
width: 90px;
|
|
||||||
display: block;
|
|
||||||
margin-bottom: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.letter-head .logo img {
|
|
||||||
border-radius: 15px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.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">
|
|
||||||
{% if doc.company_address %} {% set company_address = frappe.db.get_value("Address",
|
|
||||||
doc.company_address, ["address_line1", "address_line2", "city", "state", "pincode",
|
|
||||||
"country"], as_dict=True) %} {% elif doc.billing_address %} {% set company_address =
|
|
||||||
frappe.db.get_value("Address", doc.billing_address, ["address_line1", "address_line2",
|
|
||||||
"city", "state", "pincode", "country"], as_dict=True) %} {% endif %} {% if company_address
|
|
||||||
%} {{ company_address.address_line1 or "" }}<br />
|
|
||||||
{% if company_address.address_line2 %} {{ company_address.address_line2 }}<br />
|
|
||||||
{% endif %} {{ company_address.city or "" }}, {{ company_address.state or "" }} {{
|
|
||||||
company_address.pincode or "" }}, {{ company_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">{{ doc.doctype }}</div>
|
|
||||||
<div class="invoice-number">{{ doc.name }}</div>
|
|
||||||
<br />
|
|
||||||
</div>
|
|
||||||
<div style="text-align: left; float: right" class="other-details">
|
|
||||||
{% set company_details = frappe.db.get_value("Company", doc.company, ["website", "email",
|
|
||||||
"phone_no"], as_dict=True) %} {% set website = company_details.website %} {% set email =
|
|
||||||
company_details.email %} {% set phone_no = company_details.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>
|
|
||||||
@@ -481,6 +481,7 @@ erpnext.patches.v16_0.set_root_type_in_account_categories
|
|||||||
erpnext.patches.v16_0.scr_inv_dimension
|
erpnext.patches.v16_0.scr_inv_dimension
|
||||||
erpnext.patches.v16_0.packed_item_inv_dimen
|
erpnext.patches.v16_0.packed_item_inv_dimen
|
||||||
erpnext.patches.v16_0.set_not_applicable_on_german_item_tax_templates
|
erpnext.patches.v16_0.set_not_applicable_on_german_item_tax_templates
|
||||||
|
erpnext.patches.v16_0.set_default_letter_head_for_doctype_and_report
|
||||||
erpnext.patches.v16_0.clear_procedures_from_receivable_report
|
erpnext.patches.v16_0.clear_procedures_from_receivable_report
|
||||||
erpnext.patches.v16_0.migrate_address_contact_custom_fields
|
erpnext.patches.v16_0.migrate_address_contact_custom_fields
|
||||||
erpnext.patches.v16_0.rename_secondary_item_type_field
|
erpnext.patches.v16_0.rename_secondary_item_type_field
|
||||||
|
|||||||
@@ -0,0 +1,45 @@
|
|||||||
|
import frappe
|
||||||
|
from frappe.query_builder import DocType
|
||||||
|
|
||||||
|
|
||||||
|
def execute():
|
||||||
|
LH = DocType("Letter Head")
|
||||||
|
update_letter_head_for_query = (
|
||||||
|
frappe.qb.update(LH).set(LH.letter_head_for, "DocType").where(LH.letter_head_for.isnull())
|
||||||
|
)
|
||||||
|
|
||||||
|
update_letter_head_for_query.run()
|
||||||
|
|
||||||
|
for letter_head_for in ("DocType", "Report"):
|
||||||
|
default_exists = frappe.db.exists(
|
||||||
|
"Letter Head",
|
||||||
|
{
|
||||||
|
"is_default": 1,
|
||||||
|
"disabled": 0,
|
||||||
|
"letter_head_for": letter_head_for,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
if default_exists:
|
||||||
|
continue
|
||||||
|
|
||||||
|
standard_letter_head = frappe.db.get_value(
|
||||||
|
"Letter Head",
|
||||||
|
{
|
||||||
|
"standard": "Yes",
|
||||||
|
"disabled": 0,
|
||||||
|
"letter_head_for": letter_head_for,
|
||||||
|
},
|
||||||
|
"name",
|
||||||
|
)
|
||||||
|
|
||||||
|
if not standard_letter_head:
|
||||||
|
continue
|
||||||
|
|
||||||
|
frappe.db.set_value(
|
||||||
|
"Letter Head",
|
||||||
|
standard_letter_head,
|
||||||
|
"is_default",
|
||||||
|
1,
|
||||||
|
update_modified=False,
|
||||||
|
)
|
||||||
@@ -38,7 +38,6 @@ def after_install():
|
|||||||
make_default_operations()
|
make_default_operations()
|
||||||
update_pegged_currencies()
|
update_pegged_currencies()
|
||||||
set_default_print_formats()
|
set_default_print_formats()
|
||||||
create_letter_head()
|
|
||||||
toggle_hidden_fields()
|
toggle_hidden_fields()
|
||||||
frappe.db.commit()
|
frappe.db.commit()
|
||||||
|
|
||||||
@@ -374,30 +373,6 @@ def set_default_print_formats():
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def create_letter_head():
|
|
||||||
base_path = frappe.get_app_path("erpnext", "accounts", "letterhead")
|
|
||||||
|
|
||||||
letterheads = {
|
|
||||||
"Company Letterhead": "company_letterhead.html",
|
|
||||||
"Company Letterhead - Grey": "company_letterhead_grey.html",
|
|
||||||
}
|
|
||||||
|
|
||||||
for name, filename in letterheads.items():
|
|
||||||
if not frappe.db.exists("Letter Head", name):
|
|
||||||
content = frappe.read_file(os.path.join(base_path, filename))
|
|
||||||
doc = frappe.get_doc(
|
|
||||||
{
|
|
||||||
"doctype": "Letter Head",
|
|
||||||
"letter_head_name": name,
|
|
||||||
"source": "HTML",
|
|
||||||
"content": content,
|
|
||||||
"is_default": 1 if name == "Company Letterhead - Grey" else 0,
|
|
||||||
"letter_head_for": "Report",
|
|
||||||
}
|
|
||||||
)
|
|
||||||
doc.insert(ignore_permissions=True)
|
|
||||||
|
|
||||||
|
|
||||||
def toggle_hidden_fields():
|
def toggle_hidden_fields():
|
||||||
from erpnext.accounts.doctype.accounts_settings.accounts_settings import (
|
from erpnext.accounts.doctype.accounts_settings.accounts_settings import (
|
||||||
toggle_accounting_dimension_sections,
|
toggle_accounting_dimension_sections,
|
||||||
|
|||||||
Reference in New Issue
Block a user