From d8204d0891257f24186b00a5db054b03cbfe3bcb Mon Sep 17 00:00:00 2001 From: rohitwaghchaure Date: Thu, 10 Nov 2016 14:55:24 +0530 Subject: [PATCH] [Fix] Disabled print settings for the custom print format (#2291) --- frappe/patches.txt | 1 + ...led_print_settings_for_custom_print_format.py | 16 ++++++++++++++++ .../print/doctype/print_format/print_format.js | 9 +++++++++ 3 files changed, 26 insertions(+) create mode 100644 frappe/patches/v7_1/disabled_print_settings_for_custom_print_format.py diff --git a/frappe/patches.txt b/frappe/patches.txt index 5b46911f0b..35703c62f3 100644 --- a/frappe/patches.txt +++ b/frappe/patches.txt @@ -145,3 +145,4 @@ frappe.patches.v7_0.cleanup_list_settings execute:frappe.db.set_default('language', '') frappe.patches.v7_1.refactor_integration_broker frappe.patches.v7_1.set_backup_limit +frappe.patches.v7_1.disabled_print_settings_for_custom_print_format diff --git a/frappe/patches/v7_1/disabled_print_settings_for_custom_print_format.py b/frappe/patches/v7_1/disabled_print_settings_for_custom_print_format.py new file mode 100644 index 0000000000..f42209a33a --- /dev/null +++ b/frappe/patches/v7_1/disabled_print_settings_for_custom_print_format.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors +# License: GNU General Public License v3. See license.txt + +from __future__ import unicode_literals +import frappe + +def execute(): + frappe.db.sql(""" + update + `tabPrint Format` + set + align_labels_left = 0, line_breaks = 0, show_section_headings = 0 + where + custom_format = 1 + """) \ No newline at end of file diff --git a/frappe/print/doctype/print_format/print_format.js b/frappe/print/doctype/print_format/print_format.js index aba08102c7..93dd3c1569 100644 --- a/frappe/print/doctype/print_format/print_format.js +++ b/frappe/print/doctype/print_format/print_format.js @@ -33,3 +33,12 @@ frappe.ui.form.on("Print Format", "refresh", function(frm) { }); } }); + +frappe.ui.form.on("Print Format", { + 'custom_format': function(frm) { + value = frm.doc.custom_format ? 0:1; + frm.set_value('align_labels_left', value); + frm.set_value('show_section_headings', value); + frm.set_value('line_breaks', value); + } +})