diff --git a/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.py b/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.py index 580d989158d..924364f73b9 100644 --- a/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.py +++ b/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.py @@ -6,5 +6,8 @@ import frappe from frappe.model.document import Document +from erpnext.controllers.print_settings import print_settings_for_item_table + class PurchaseInvoiceItem(Document): - pass \ No newline at end of file + def __setup__(self): + print_settings_for_item_table(self) diff --git a/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.py b/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.py index 3fa0f2e0e5a..0400010eec8 100644 --- a/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.py +++ b/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.py @@ -5,6 +5,8 @@ from __future__ import unicode_literals import frappe from frappe.model.document import Document +from erpnext.controllers.print_settings import print_settings_for_item_table class SalesInvoiceItem(Document): - pass \ No newline at end of file + def __setup__(self): + print_settings_for_item_table(self) diff --git a/erpnext/buying/doctype/purchase_order_item/purchase_order_item.py b/erpnext/buying/doctype/purchase_order_item/purchase_order_item.py index 8c7c0a8a473..9129254f3ce 100644 --- a/erpnext/buying/doctype/purchase_order_item/purchase_order_item.py +++ b/erpnext/buying/doctype/purchase_order_item/purchase_order_item.py @@ -6,5 +6,8 @@ import frappe from frappe.model.document import Document +from erpnext.controllers.print_settings import print_settings_for_item_table + class PurchaseOrderItem(Document): - pass \ No newline at end of file + def __setup__(self): + print_settings_for_item_table(self) diff --git a/erpnext/buying/doctype/supplier_quotation_item/supplier_quotation_item.py b/erpnext/buying/doctype/supplier_quotation_item/supplier_quotation_item.py index 16e6e126eb2..b8e690eb932 100644 --- a/erpnext/buying/doctype/supplier_quotation_item/supplier_quotation_item.py +++ b/erpnext/buying/doctype/supplier_quotation_item/supplier_quotation_item.py @@ -6,5 +6,8 @@ import frappe from frappe.model.document import Document +from erpnext.controllers.print_settings import print_settings_for_item_table + class SupplierQuotationItem(Document): - pass \ No newline at end of file + def __setup__(self): + print_settings_for_item_table(self) diff --git a/erpnext/controllers/print_settings.py b/erpnext/controllers/print_settings.py new file mode 100644 index 00000000000..e760f247eb4 --- /dev/null +++ b/erpnext/controllers/print_settings.py @@ -0,0 +1,9 @@ +# Copyright (c) 2015, Web Notes Technologies Pvt. Ltd. and Contributors +# License: GNU General Public License v3. See license.txt + +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"] diff --git a/erpnext/selling/doctype/quotation_item/quotation_item.py b/erpnext/selling/doctype/quotation_item/quotation_item.py index 426b199a360..a204531950b 100644 --- a/erpnext/selling/doctype/quotation_item/quotation_item.py +++ b/erpnext/selling/doctype/quotation_item/quotation_item.py @@ -5,6 +5,8 @@ from __future__ import unicode_literals import frappe from frappe.model.document import Document +from erpnext.controllers.print_settings import print_settings_for_item_table class QuotationItem(Document): - pass \ No newline at end of file + def __setup__(self): + print_settings_for_item_table(self) diff --git a/erpnext/selling/doctype/sales_order_item/sales_order_item.py b/erpnext/selling/doctype/sales_order_item/sales_order_item.py index ef2ad098eca..34eb32f2c79 100644 --- a/erpnext/selling/doctype/sales_order_item/sales_order_item.py +++ b/erpnext/selling/doctype/sales_order_item/sales_order_item.py @@ -5,6 +5,8 @@ from __future__ import unicode_literals import frappe from frappe.model.document import Document +from erpnext.controllers.print_settings import print_settings_for_item_table class SalesOrderItem(Document): - pass \ No newline at end of file + def __setup__(self): + print_settings_for_item_table(self) diff --git a/erpnext/stock/doctype/delivery_note_item/delivery_note_item.py b/erpnext/stock/doctype/delivery_note_item/delivery_note_item.py index 3789cdaffa6..82844acaf64 100644 --- a/erpnext/stock/doctype/delivery_note_item/delivery_note_item.py +++ b/erpnext/stock/doctype/delivery_note_item/delivery_note_item.py @@ -5,6 +5,8 @@ from __future__ import unicode_literals import frappe from frappe.model.document import Document +from erpnext.controllers.print_settings import print_settings_for_item_table class DeliveryNoteItem(Document): - pass \ No newline at end of file + def __setup__(self): + print_settings_for_item_table(self) diff --git a/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.py b/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.py index 35fca0d6c53..21acbed1b53 100644 --- a/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.py +++ b/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.py @@ -5,6 +5,8 @@ from __future__ import unicode_literals import frappe from frappe.model.document import Document +from erpnext.controllers.print_settings import print_settings_for_item_table class PurchaseReceiptItem(Document): - pass \ No newline at end of file + def __setup__(self): + print_settings_for_item_table(self) diff --git a/erpnext/templates/print_formats/includes/item_grid.html b/erpnext/templates/print_formats/includes/item_grid.html deleted file mode 100644 index 1d09f73feca..00000000000 --- a/erpnext/templates/print_formats/includes/item_grid.html +++ /dev/null @@ -1,47 +0,0 @@ -{%- from "templates/print_formats/standard_macros.html" import print_value -%} -{%- set std_fields = ("item_code", "item_name", "description", "qty", "rate", "amount", "stock_uom", "uom") -%} -{%- set visible_columns = get_visible_columns(doc.get(df.fieldname), table_meta) -%} -{%- set hide_rate = data[0].meta.is_print_hide("rate") if data|length else False-%} -{%- set hide_amount = data[0].meta.is_print_hide("amount") if data|length else False-%} - -
| {{ _("Sr") }} | -{{ _("Item") }} | -{{ _("Qty") }} | - {% if not hide_rate -%}{{ _("Rate") }} | {%- endif %} - {% if not hide_amount -%}{{ _("Amount") }} | {%- endif %} -
|---|---|---|---|---|
| {{ row.idx }} | -
- {% if not row.meta.is_print_hide("item_code") -%}
- {{ row.item_code }}
- {%- endif %}
- {% if (not row.meta.is_print_hide("item_name") and
- (row.meta.is_print_hide("item_code") or row.item_code != row.item_name)) -%}
- {{ row.get_formatted("item_name") }}
- {%- endif %}
- {% if (not row.meta.is_print_hide("description") and row.description and
- ((row.meta.is_print_hide("item_code") and row.meta.is_print_hide("item_name"))
- or not (row.item_code == row.item_name == row.description))) -%}
- {{ row.get_formatted("description") }} - {%- endif %} - {%- for field in visible_columns -%} - {%- if (field.fieldname not in std_fields) and - (row[field.fieldname] not in (None, "", 0)) -%} -{{ _(field.label) }}:
- {{ row.get_formatted(field.fieldname, doc) }}
- {%- endif -%}
- {%- endfor -%}
- |
- {{ row.get_formatted("qty", doc) }} - {{ row.uom or row.stock_uom }} |
- {% if not hide_rate -%}{{ row.get_formatted("rate", doc) }} | {%- endif %} - {% if not hide_amount -%}{{ row.get_formatted("amount", doc) }} | {%- endif %} -
{{ doc.get_formatted("description") }}
+ {%- endif %} +