Merge pull request #4935 from shreyasp/sales-inv-WN-SUP17465
[Minor] Fix print settings for custom print format
diff --git a/erpnext/controllers/print_settings.py b/erpnext/controllers/print_settings.py
index bc34f7c..5d27b03 100644
--- a/erpnext/controllers/print_settings.py
+++ b/erpnext/controllers/print_settings.py
@@ -8,22 +8,22 @@
def print_settings_for_item_table(doc):
doc.print_templates = {
- "description": "templates/print_formats/includes/item_table_description.html",
"qty": "templates/print_formats/includes/item_table_qty.html"
}
-
- doc.hide_in_print_layout = ["item_code", "item_name", "image", "uom", "stock_uom"]
+ doc.hide_in_print_layout = ["uom", "stock_uom"]
doc.flags.compact_item_print = cint(frappe.db.get_value("Features Setup", None, "compact_item_print"))
- doc.flags.compact_item_fields = doc.hide_in_print_layout + ["description", "qty", "rate", "amount"]
- doc.flags.show_in_description = []
if doc.flags.compact_item_print:
+ doc.print_templates["description"] = "templates/print_formats/includes/item_table_description.html"
+ doc.hide_in_print_layout += ["item_code", "item_name", "image"]
+
+ doc.flags.compact_item_fields = ["description", "qty", "rate", "amount"]
+ doc.flags.show_in_description = []
+
for df in doc.meta.fields:
if df.fieldtype not in ("Section Break", "Column Break", "Button"):
if not doc.is_print_hide(df.fieldname):
if df.fieldname not in doc.hide_in_print_layout and df.fieldname not in doc.flags.compact_item_fields:
doc.hide_in_print_layout.append(df.fieldname)
doc.flags.show_in_description.append(df.fieldname)
-
-
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index 41bce00..9c5b44d 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -252,3 +252,4 @@
erpnext.patches.v6_23.update_stopped_status_to_closed
erpnext.patches.v6_24.repost_valuation_rate_for_serialized_items
erpnext.patches.v6_24.set_recurring_id
+erpnext.patches.v6_20x.set_compact_print
diff --git a/erpnext/patches/v6_20x/__init__.py b/erpnext/patches/v6_20x/__init__.py
new file mode 100644
index 0000000..baffc48
--- /dev/null
+++ b/erpnext/patches/v6_20x/__init__.py
@@ -0,0 +1 @@
+from __future__ import unicode_literals
diff --git a/erpnext/patches/v6_20x/set_compact_print.py b/erpnext/patches/v6_20x/set_compact_print.py
new file mode 100644
index 0000000..4ba1aea
--- /dev/null
+++ b/erpnext/patches/v6_20x/set_compact_print.py
@@ -0,0 +1,5 @@
+from __future__ import unicode_literals
+import frappe
+
+def execute():
+ frappe.db.set_value("Features Setup", None, "compact_item_print", 1)
diff --git a/erpnext/setup/install.py b/erpnext/setup/install.py
index d218793..9a44da1 100644
--- a/erpnext/setup/install.py
+++ b/erpnext/setup/install.py
@@ -36,7 +36,7 @@
'fs_exports', 'fs_imports', 'fs_discounts', 'fs_purchase_discounts',
'fs_after_sales_installations', 'fs_projects', 'fs_sales_extras',
'fs_recurring_invoice', 'fs_pos', 'fs_manufacturing', 'fs_quality',
- 'fs_page_break', 'fs_more_info', 'fs_pos_view'
+ 'fs_page_break', 'fs_more_info', 'fs_pos_view', 'compact_item_print'
]
for f in flds:
doc.set(f, 1)