-
Notifications
You must be signed in to change notification settings - Fork 9.9k
feat: print format for sales invoice #49508
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
khushi8112
merged 45 commits into
frappe:develop
from
khushi8112:print-format-for-sales-invoice
Oct 12, 2025
+579
−0
Merged
Changes from all commits
Commits
Show all changes
45 commits
Select commit
Hold shift + click to select a range
e852383
feat: default print format for sales invoice
khushi8112 af974fb
feat: add css
khushi8112 156dda8
style: change padding
khushi8112 7386270
feat: add letterhead fixture
khushi8112 1adbf90
fix: css changes in letterhead
khushi8112 2bc1978
fix: letterhead styling
khushi8112 b5c739d
fix: broken img tag in letterhead
khushi8112 ddf4a83
fix: condition based address display
khushi8112 c780796
fix: remove border if company logo not available
khushi8112 4cc2afb
feat: print format design two
khushi8112 e08f829
fix: radius of the items/tax table thead
khushi8112 6b83309
test: just debugging
khushi8112 17397ae
test: add in_install condition for debugging
khushi8112 f1a2e1b
refactor: remove img tag for testing
khushi8112 5f97bec
refactor: revert debugging changes
khushi8112 5c4f778
style: center-align logo within its container div
khushi8112 f4f2d11
style: always show border even when logo is missing
khushi8112 6703610
fix: do not make letterhead default
khushi8112 39b6aab
fix: update styles to work with wkhtmltopdf rendering
khushi8112 e223731
refactor: remove flex usage for better wkhtmltopdf support
khushi8112 ce19514
refactor: update letterhead styles for wkhtmltopdf compatibility
khushi8112 a6d92e5
refactor: small changes for better readability
khushi8112 842a364
refactor: remove tax breakup table from the print format
khushi8112 f6ebf2d
feat: letterhead for print format
khushi8112 0d58dfd
feat: add default letterhead with HTML template via after_install
khushi8112 3abdfcb
fix: app path correctly
khushi8112 6494fc4
refactor: create_letter_head for readability
khushi8112 dbf9faa
feat: prompt user to input company logo and address if missing in pri…
khushi8112 780d3f5
fix: better sub total section with tax breakup
khushi8112 bf6c331
fix: show tax breakup in print format
khushi8112 301b294
style: fix layout issues with extended data
khushi8112 8a19dc4
style: format and display the address for improved visual clarity
khushi8112 abc7bf2
style: add company and customer name on bill_to and bill_from section
khushi8112 98838b1
feat: input website, email, phone_no if not already set in company
khushi8112 e3ca318
fix: small ui changes
khushi8112 610dcbb
chore: remove frappe.db.commit
khushi8112 92f69ae
fix: validate email address
khushi8112 5902074
style: slight spacing and alignment fix
khushi8112 50eb678
feat: condition based item code column
khushi8112 12ebab1
refactor: change print format type html to custom
khushi8112 3311095
refactor: replace get_doc with get_value
khushi8112 533257c
refactor: use get_value to improve performance
khushi8112 a4fe0fb
refactor: use query builder to set company address
khushi8112 6e07aac
fix: add filter query for address field
khushi8112 f14b3ed
refactor: add permission check and minor fixes
khushi8112 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,108 @@ | ||
| <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; | ||
| 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> | ||
| {% 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) %} | ||
|
|
||
| {{ company_address.get("address_line1") or "" }}<br> | ||
| {% if company_address.get("address_line2") %}{{ company_address.get("address_line2") }}<br>{% endif %} | ||
| {{ company_address.get("city") or "" }}, {{ company_address.get("state") or "" }} {{ company_address.get("pincode") or "" }}, {{ company_address.get("country") or "" }}<br> | ||
| {% endif %} | ||
| </td> | ||
|
|
||
| <td class="invoice-info-cell"> | ||
| {% set company_details = frappe.db.get_value("Company", doc.company, ["website", "email", "phone_no"], as_dict=True) %} | ||
|
|
||
| <div class="invoice-info"> | ||
| <span class="invoice-label">{{ _("Invoice:") }}</span> | ||
| <span>{{ doc.name }}</span> | ||
| </div> | ||
| {% if company_details.website %} | ||
| <div class="invoice-info"> | ||
| <span class="invoice-label">{{ _("Website:") }}</span> | ||
| <span>{{ company_details.website }}</span> | ||
| </div> | ||
| {% endif %} | ||
| {% if company_details.email %} | ||
| <div class="invoice-info"> | ||
| <span class="invoice-label">{{ _("Email:") }}</span> | ||
| <span>{{ company_details.email }}</span> | ||
| </div> | ||
| {% endif %} | ||
| {% if company_details.phone_no %} | ||
| <div class="invoice-info"> | ||
| <span class="invoice-label">{{ _("Contact:") }}</span> | ||
| <span>{{ company_details.phone_no }}</span> | ||
| </div> | ||
| {% endif %} | ||
| </td> | ||
| </tr> | ||
| </tbody> | ||
| </table> |
125 changes: 125 additions & 0 deletions
125
erpnext/accounts/letterhead/company_letterhead_grey.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,125 @@ | ||
| <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) %} | ||
| {{ 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">{{ _("Sales Invoice") }}</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) %} | ||
| {% if company_details.website %} | ||
| <div> | ||
| <span class="contact-title">{{ _("Website:") }}</span | ||
| ><span class="contact-value">{{ company_details.website }}</span> | ||
| </div> | ||
| {% endif %} | ||
| {% if company_details.email %} | ||
| <div> | ||
| <span class="contact-title">{{ _("Email:") }}</span | ||
| ><span class="contact-value">{{ company_details.email }}</span> | ||
| </div> | ||
| {% endif %} | ||
| {% if company_details.phone_no %} | ||
| <div> | ||
| <span class="contact-title">{{ _("Contact:") }}</span | ||
| ><span class="contact-value">{{ company_details.phone_no }}</span> | ||
| </div> | ||
| {% endif %} | ||
| </div> | ||
| </td> | ||
| </tr> | ||
| </tbody> | ||
| </table> |
Empty file.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.