Просмотр исходного кода

Merge pull request #2041 from rmehta/allow-draft-print

[fix] make "draft" heading for print format configurable
version-14
Nabin Hait 8 лет назад
committed by GitHub
Родитель
Сommit
fc064b8f05
4 измененных файлов: 51 добавлений и 7 удалений
  1. +2
    -1
      frappe/patches.txt
  2. +46
    -3
      frappe/print/doctype/print_settings/print_settings.json
  3. +1
    -1
      frappe/templates/print_formats/standard.html
  4. +2
    -2
      frappe/templates/print_formats/standard_macros.html

+ 2
- 1
frappe/patches.txt Просмотреть файл

@@ -135,4 +135,5 @@ execute:frappe.db.sql('''delete from `tabSingles` where doctype="Email Settings"
execute:frappe.db.sql("delete from `tabWeb Page` where ifnull(template_path, '')!=''") execute:frappe.db.sql("delete from `tabWeb Page` where ifnull(template_path, '')!=''")
frappe.patches.v7_0.rename_newsletter_list_to_email_group frappe.patches.v7_0.rename_newsletter_list_to_email_group
frappe.patches.v7_0.replace_upgrade_link_limit frappe.patches.v7_0.replace_upgrade_link_limit
frappe.patches.v7_0.set_email_group
frappe.patches.v7_0.set_email_group
execute:frappe.db.set_value("Print Settings", "Print Settings", "add_draft_heading", 1)

+ 46
- 3
frappe/print/doctype/print_settings/print_settings.json Просмотреть файл

@@ -8,11 +8,13 @@
"docstatus": 0, "docstatus": 0,
"doctype": "DocType", "doctype": "DocType",
"document_type": "System", "document_type": "System",
"editable_grid": 0,
"fields": [ "fields": [
{ {
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "pdf_settings", "fieldname": "pdf_settings",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@@ -37,6 +39,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"default": "1", "default": "1",
"description": "Send Email Print Attachments as PDF (Recommended)", "description": "Send Email Print Attachments as PDF (Recommended)",
"fieldname": "send_print_as_pdf", "fieldname": "send_print_as_pdf",
@@ -63,6 +66,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"default": "1", "default": "1",
"fieldname": "repeat_header_footer", "fieldname": "repeat_header_footer",
"fieldtype": "Check", "fieldtype": "Check",
@@ -89,6 +93,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "column_break_4", "fieldname": "column_break_4",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
@@ -113,6 +118,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"default": "A4", "default": "A4",
"fieldname": "pdf_page_size", "fieldname": "pdf_page_size",
"fieldtype": "Select", "fieldtype": "Select",
@@ -139,6 +145,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "view_link_in_email", "fieldname": "view_link_in_email",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@@ -163,6 +170,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"default": "1", "default": "1",
"description": "", "description": "",
"fieldname": "attach_view_link", "fieldname": "attach_view_link",
@@ -190,6 +198,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "print_style_section", "fieldname": "print_style_section",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@@ -214,6 +223,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"default": "Modern", "default": "Modern",
"fieldname": "print_style", "fieldname": "print_style",
"fieldtype": "Select", "fieldtype": "Select",
@@ -240,6 +250,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"default": "Default", "default": "Default",
"fieldname": "font", "fieldname": "font",
"fieldtype": "Select", "fieldtype": "Select",
@@ -267,6 +278,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"description": "In points. Default is 9.", "description": "In points. Default is 9.",
"fieldname": "font_size", "fieldname": "font_size",
"fieldtype": "Float", "fieldtype": "Float",
@@ -292,6 +304,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "column_break_6", "fieldname": "column_break_6",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
@@ -315,6 +328,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"default": "1", "default": "1",
"description": "", "description": "",
"fieldname": "with_letterhead", "fieldname": "with_letterhead",
@@ -341,6 +355,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"default": "1", "default": "1",
"description": "", "description": "",
"fieldname": "allow_print_for_draft", "fieldname": "allow_print_for_draft",
@@ -368,6 +383,34 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"default": "1",
"fieldname": "add_draft_heading",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Always add \"Draft\" Heading for printing draft documents",
"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,
"columns": 0,
"description": "", "description": "",
"fieldname": "allow_print_for_cancelled", "fieldname": "allow_print_for_cancelled",
"fieldtype": "Check", "fieldtype": "Check",
@@ -394,6 +437,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "section_break_8", "fieldname": "section_break_8",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@@ -417,6 +461,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0,
"fieldname": "print_style_preview", "fieldname": "print_style_preview",
"fieldtype": "HTML", "fieldtype": "HTML",
"hidden": 0, "hidden": 0,
@@ -449,7 +494,7 @@
"issingle": 1, "issingle": 1,
"istable": 0, "istable": 0,
"max_attachments": 0, "max_attachments": 0,
"modified": "2016-06-22 11:44:01.940693",
"modified": "2016-09-12 03:19:17.867459",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Print", "module": "Print",
"name": "Print Settings", "name": "Print Settings",
@@ -470,8 +515,6 @@
"print": 0, "print": 0,
"read": 1, "read": 1,
"report": 0, "report": 0,
"restrict": 0,
"restricted": 0,
"role": "System Manager", "role": "System Manager",
"set_user_permissions": 0, "set_user_permissions": 0,
"share": 1, "share": 1,


+ 1
- 1
frappe/templates/print_formats/standard.html Просмотреть файл

@@ -4,7 +4,7 @@
{% for page in layout %} {% for page in layout %}
<div class="page-break"> <div class="page-break">
<div {% if print_settings.repeat_header_footer %} id="header-html" class="hidden-pdf" {% endif %}> <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) }}
{{ add_header(loop.index, layout|len, doc, letter_head, no_letterhead, footer, print_settings) }}
</div> </div>


{% if print_settings.repeat_header_footer %} {% if print_settings.repeat_header_footer %}


+ 2
- 2
frappe/templates/print_formats/standard_macros.html Просмотреть файл

@@ -110,7 +110,7 @@ data-fieldname="{{ df.fieldname }}" data-fieldtype="{{ df.fieldtype }}"
{%- endif -%} {%- endif -%}
{% endmacro %} {% endmacro %}


{%- macro add_header(page_num, max_pages, doc, letter_head, no_letterhead, footer) -%}
{%- macro add_header(page_num, max_pages, doc, letter_head, no_letterhead, footer, print_settings=None) -%}
{% if letter_head and not no_letterhead %} {% if letter_head and not no_letterhead %}
<div class="letter-head">{{ letter_head }}</div> <div class="letter-head">{{ letter_head }}</div>
{% endif %} {% endif %}
@@ -125,7 +125,7 @@ data-fieldname="{{ df.fieldname }}" data-fieldtype="{{ df.fieldtype }}"
</h2> </h2>
</div> </div>
{% endif %} {% endif %}
{%- if doc.meta.is_submittable and doc.docstatus==0-%}
{%- if doc.meta.is_submittable and doc.docstatus==0 and (print_settings==None or print_settings.add_draft_heading) -%}
<div class="text-center" document-status="draft"> <div class="text-center" document-status="draft">
<h4 style="margin: 0px;">{{ _("DRAFT") }}</h4> <h4 style="margin: 0px;">{{ _("DRAFT") }}</h4>
</div> </div>


Загрузка…
Отмена
Сохранить