Skip to content

Commit e695654

Browse files
committed
refactor: remove flex usage for better wkhtmltopdf support
1 parent cebca29 commit e695654

File tree

1 file changed

+45
-32
lines changed

1 file changed

+45
-32
lines changed

erpnext/accounts/print_format/print_format_sales_invoice/print_format_sales_invoice.html

Lines changed: 45 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
{%- macro add_header(page_num, max_pages, doc, letter_head, no_letterhead, footer, print_settings=None,
2-
print_heading_template=None) -%} {% if letter_head and not no_letterhead %}
3-
<div class="letter-head">{{ letter_head }}</div>
4-
{% endif %} {% if print_heading_template %} {{ frappe.render_template(print_heading_template, {"doc":doc}) }}
5-
{% endif %} {%- endmacro -%} {% for page in layout %}
2+
print_heading_template=None) -%}
3+
{% if letter_head and not no_letterhead %}
4+
<div class="letter-head">{{ letter_head }}</div>
5+
{% endif %}
6+
{% if print_heading_template %}
7+
{{ frappe.render_template(print_heading_template, {"doc":doc}) }}
8+
{% endif %}
9+
{%- endmacro -%}
10+
{% for page in layout %}
611
<div class="page-break invoice-page">
712
<div {% if print_settings.repeat_header_footer %} id="header-html" class="hidden-pdf" {% endif %}>
813
{{ add_header(loop.index, layout|len, doc, letter_head, no_letterhead, footer, print_settings) }}
@@ -11,7 +16,7 @@
1116
<style>
1217
.letter-head {
1318
padding-top: 12px !important;
14-
/* margin-top: 0px !important; */
19+
padding-bottom: 12px !important;
1520
}
1621
.invoice-page {
1722
font-family: Inter, sans-serif;
@@ -86,13 +91,13 @@
8691
border-bottom: none;
8792
}
8893

89-
.items-table tr:first-child td:first-child,
90-
.tax-table tr:first-child td:first-child {
94+
.items-table thead tr:first-child td:first-child,
95+
.tax-table thead tr:first-child td:first-child {
9196
border-top-left-radius: 10px;
9297
border-bottom-left-radius: 10px;
9398
}
94-
.items-table tr:first-child td:last-child,
95-
.tax-table tr:first-child td:last-child {
99+
.items-table thead tr:first-child td:last-child,
100+
.tax-table thead tr:first-child td:last-child {
96101
border-top-right-radius: 10px;
97102
border-bottom-right-radius: 10px;
98103
}
@@ -113,19 +118,6 @@
113118
background: #f8f8f8;
114119
}
115120

116-
.img-thumb {
117-
min-width: 24px;
118-
min-height: 24px;
119-
max-width: 24px;
120-
max-height: 24px;
121-
border-radius: 6px;
122-
overflow: hidden;
123-
display: flex;
124-
align-items: center;
125-
justify-content: center;
126-
background: #f0f0f0;
127-
}
128-
129121
.info-card {
130122
margin-top: 40px;
131123
color: #7c7c7c;
@@ -156,17 +148,22 @@
156148

157149
.tax-table td,
158150
.items-table td {
159-
height: 40px;
151+
height: auto !important;
160152
}
161153

162154
.tax-table thead td,
163155
.items-table thead td {
164156
height: 32px;
165157
}
158+
159+
.item-img td {
160+
border: none !important;
161+
padding: 0px !important;
162+
}
166163
</style>
167164

168165
<div class="print-format-body">
169-
<table class="info-table col-xs-12" style="width: 100%">
166+
<table class="info-table col-xs-12" style="width: 100%; margin-left: 12px">
170167
<tr>
171168
<td class="col-xs-7" style="padding: 0 !important">
172169
<div class="title col-xs-5 p-0">
@@ -219,16 +216,32 @@
219216
<tr>
220217
<td class="text-center">{{ loop.index }}</td>
221218
<td class="text-left">
222-
<div style="display: flex; align-items: center; gap: 8px">
223-
<div class="img-thumb">
219+
<table class="item-img" style="border-collapse: collapse">
220+
<tr>
224221
{% if item.image %}
225-
<div>
226-
<img src="{{ item.image }}" alt="{{ item.item_name }}" />
227-
</div>
222+
<td class="no-style" style="border-radius: 6px; vertical-align: middle">
223+
<img
224+
src="{{ item.image }}"
225+
alt="{{ item.item_name }}"
226+
style="
227+
border-radius: 6px;
228+
max-height: 24px;
229+
min-height: 24px;
230+
max-width: 24px;
231+
min-width: 24px;
232+
margin-right: 8px;
233+
"
234+
/>
235+
</td>
228236
{% endif %}
229-
</div>
230-
<div>{{ item.item_name }}</div>
231-
</div>
237+
<td
238+
class="no-style"
239+
style="vertical-align: middle !important; padding: 0 !important"
240+
>
241+
{{ item.item_name }}
242+
</td>
243+
</tr>
244+
</table>
232245
</td>
233246

234247
<td class="text-center">{{ item.gst_hsn_code }}</td>

0 commit comments

Comments
 (0)