[enhancement] option to enable/disable repeating header and footer in PDFs
This commit is contained in:
parent
18d595c875
commit
d8069dbce4
6 changed files with 86 additions and 3 deletions
|
|
@ -115,3 +115,4 @@ frappe.patches.v6_15.set_username
|
|||
execute:frappe.permissions.reset_perms("Error Snapshot")
|
||||
frappe.patches.v6_19.comment_feed_communication
|
||||
frappe.patches.v6_16.feed_doc_owner
|
||||
frappe.patches.v6_21.print_settings_repeat_header_footer
|
||||
|
|
|
|||
0
frappe/patches/v6_21/__init__.py
Normal file
0
frappe/patches/v6_21/__init__.py
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
frappe.reload_doctype('Print Settings')
|
||||
frappe.db.set_value('Print Settings', 'Print Settings', 'repeat_header_footer', 1)
|
||||
|
|
@ -19,9 +19,11 @@
|
|||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "PDF Settings",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
|
|
@ -42,9 +44,59 @@
|
|||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Send Print as PDF",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"default": "1",
|
||||
"fieldname": "repeat_header_footer",
|
||||
"fieldtype": "Check",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Repeat Header and Footer in PDF",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"fieldname": "column_break_4",
|
||||
"fieldtype": "Column Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
|
|
@ -64,10 +116,12 @@
|
|||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "PDF Page Size",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "A4\nLetter",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
|
|
@ -86,9 +140,11 @@
|
|||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Print Style",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
|
|
@ -108,10 +164,12 @@
|
|||
"in_filter": 0,
|
||||
"in_list_view": 1,
|
||||
"label": "Print Style",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Modern\nClassic\nStandard\nMonochrome",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
|
|
@ -131,11 +189,13 @@
|
|||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Font",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Default\nArial\nHelvetica\nVerdana\nMonospace",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
|
|
@ -155,9 +215,11 @@
|
|||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Font Size",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
|
|
@ -175,9 +237,11 @@
|
|||
"ignore_user_permissions": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
|
|
@ -198,9 +262,11 @@
|
|||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "With Letterhead",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
|
|
@ -218,9 +284,11 @@
|
|||
"ignore_user_permissions": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
|
|
@ -239,9 +307,11 @@
|
|||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Print Style Preview",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
|
|
@ -253,12 +323,14 @@
|
|||
"hide_heading": 0,
|
||||
"hide_toolbar": 0,
|
||||
"icon": "icon-cog",
|
||||
"idx": 0,
|
||||
"in_create": 0,
|
||||
"in_dialog": 0,
|
||||
"is_submittable": 0,
|
||||
"issingle": 1,
|
||||
"istable": 0,
|
||||
"modified": "2015-07-15 08:03:23.743143",
|
||||
"max_attachments": 0,
|
||||
"modified": "2016-02-08 04:17:03.754492",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Print",
|
||||
"name": "Print Settings",
|
||||
|
|
|
|||
|
|
@ -114,7 +114,8 @@ def get_html(doc, name=None, print_format=None, meta=None,
|
|||
"no_letterhead": no_letterhead,
|
||||
"trigger_print": cint(trigger_print),
|
||||
"letter_head": letter_head.content,
|
||||
"footer": letter_head.footer
|
||||
"footer": letter_head.footer,
|
||||
"print_settings": frappe.get_doc("Print Settings")
|
||||
}
|
||||
|
||||
html = template.render(args, filters={"len": len})
|
||||
|
|
|
|||
|
|
@ -3,9 +3,11 @@
|
|||
|
||||
{% for page in layout %}
|
||||
<div class="page-break">
|
||||
<div id="header-html" class="hidden-pdf">
|
||||
<div {% if print_settings.repeat_header_footer %} id="header-html" class="hidden-pdf" {% endif %}>
|
||||
{{ add_header(loop.index, layout|len, doc, letter_head, no_letterhead, footer) }}
|
||||
</div>
|
||||
|
||||
{% if print_settings.repeat_header_footer %}
|
||||
<div id="footer-html" class="visible-pdf">
|
||||
{% if not no_letterhead and footer %}
|
||||
<div class="letter-head-footer">
|
||||
|
|
@ -16,6 +18,7 @@
|
|||
{{ _("Page {0} of {1}").format('<span class="page"></span>', '<span class="topage"></span>') }}
|
||||
</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% for section in page %}
|
||||
<div class="row section-break">
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue