From f84c240d1cff6636a795e2743d86f6f70fd526de Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Fri, 18 Jul 2014 16:39:31 +0530 Subject: [PATCH] cleanup for print format --- erpnext/controllers/selling_controller.py | 6 +++ .../doctype/sales_order/sales_order.py | 4 -- .../material_request_item.json | 39 ++++++++++--------- .../print_formats/includes/item_grid.html | 10 ++--- erpnext/utilities/doctype/note/note.py | 4 ++ test_sites/test_site/site_config.json | 3 +- 6 files changed, 37 insertions(+), 29 deletions(-) diff --git a/erpnext/controllers/selling_controller.py b/erpnext/controllers/selling_controller.py index 1049350c26..6bbdfadd3d 100644 --- a/erpnext/controllers/selling_controller.py +++ b/erpnext/controllers/selling_controller.py @@ -10,6 +10,12 @@ from frappe import _, throw from erpnext.controllers.stock_controller import StockController class SellingController(StockController): + def __setup__(self): + self.table_print_templates = { + self.fname: "templates/print_formats/includes/item_grid.html", + "other_charges": "templates/print_formats/includes/taxes.html", + } + def validate(self): super(SellingController, self).validate() self.validate_max_discount() diff --git a/erpnext/selling/doctype/sales_order/sales_order.py b/erpnext/selling/doctype/sales_order/sales_order.py index 9a26404962..e0a7a1d62d 100644 --- a/erpnext/selling/doctype/sales_order/sales_order.py +++ b/erpnext/selling/doctype/sales_order/sales_order.py @@ -18,10 +18,6 @@ class SalesOrder(SellingController): person_tname = 'Target Detail' partner_tname = 'Partner Target Detail' territory_tname = 'Territory Target Detail' - table_print_templates = { - "sales_order_details": "templates/print_formats/includes/item_grid.html", - "other_charges": "templates/print_formats/includes/taxes.html", - } def validate_mandatory(self): # validate transaction date v/s delivery date diff --git a/erpnext/stock/doctype/material_request_item/material_request_item.json b/erpnext/stock/doctype/material_request_item/material_request_item.json index bff669f5f7..61b03f8719 100644 --- a/erpnext/stock/doctype/material_request_item/material_request_item.json +++ b/erpnext/stock/doctype/material_request_item/material_request_item.json @@ -1,6 +1,6 @@ { "autoname": "MREQD-.#####", - "creation": "2013-02-22 01:28:02.000000", + "creation": "2013-02-22 01:28:02", "docstatus": 0, "doctype": "DocType", "fields": [ @@ -28,6 +28,7 @@ "oldfieldname": "item_name", "oldfieldtype": "Data", "permlevel": 0, + "print_hide": 1, "print_width": "100px", "reqd": 0, "search_index": 1, @@ -70,6 +71,21 @@ "reqd": 1, "width": "80px" }, + { + "fieldname": "uom", + "fieldtype": "Link", + "in_list_view": 1, + "label": "Stock UOM", + "no_copy": 0, + "oldfieldname": "uom", + "oldfieldtype": "Link", + "options": "UOM", + "permlevel": 0, + "print_width": "70px", + "read_only": 1, + "reqd": 1, + "width": "70px" + }, { "fieldname": "warehouse", "fieldtype": "Link", @@ -89,21 +105,6 @@ "fieldtype": "Column Break", "permlevel": 0 }, - { - "fieldname": "uom", - "fieldtype": "Link", - "in_list_view": 1, - "label": "Stock UOM", - "no_copy": 0, - "oldfieldname": "uom", - "oldfieldtype": "Link", - "options": "UOM", - "permlevel": 0, - "print_width": "70px", - "read_only": 1, - "reqd": 1, - "width": "70px" - }, { "allow_on_submit": 0, "fieldname": "schedule_date", @@ -216,6 +217,7 @@ "oldfieldname": "ordered_qty", "oldfieldtype": "Currency", "permlevel": 0, + "print_hide": 1, "read_only": 1 }, { @@ -232,9 +234,10 @@ ], "idx": 1, "istable": 1, - "modified": "2014-02-03 11:35:26.000000", + "modified": "2014-07-18 01:04:18.470761", "modified_by": "Administrator", "module": "Stock", "name": "Material Request Item", - "owner": "Administrator" + "owner": "Administrator", + "permissions": [] } \ No newline at end of file diff --git a/erpnext/templates/print_formats/includes/item_grid.html b/erpnext/templates/print_formats/includes/item_grid.html index 2ca4289b55..a166ced57a 100644 --- a/erpnext/templates/print_formats/includes/item_grid.html +++ b/erpnext/templates/print_formats/includes/item_grid.html @@ -4,10 +4,9 @@ Sr Item Name Description - Qty - UoM - Basic Rate - Amount + Qty + Rate + Amount {%- for row in data -%} @@ -20,8 +19,7 @@
{{ row.description }}
- {{ row.qty }} - {{ row.stock_uom }} + {{ row.qty }} {{ row.stock_uom }} {{ format(row.rate, table_meta.get_field("rate"), doc) }} {{ format(row.amount, table_meta.get_field("amount"), doc) }} diff --git a/erpnext/utilities/doctype/note/note.py b/erpnext/utilities/doctype/note/note.py index b54681587d..2db4137ddd 100644 --- a/erpnext/utilities/doctype/note/note.py +++ b/erpnext/utilities/doctype/note/note.py @@ -14,6 +14,10 @@ class Note(Document): import re self.name = re.sub("[%'\"#*?`]", "", self.title.strip()) + def before_print(self): + self.print_heading = self.name + self.sub_heading = "" + def get_permission_query_conditions(user): if not user: user = frappe.session.user diff --git a/test_sites/test_site/site_config.json b/test_sites/test_site/site_config.json index 05bf562766..c77200c331 100644 --- a/test_sites/test_site/site_config.json +++ b/test_sites/test_site/site_config.json @@ -1,5 +1,6 @@ { "db_name": "test_frappe", "db_password": "test_frappe", - "mute_emails": 1 + "mute_emails": 1, + "developer_mode": 1 }