From 62299260dcdc909287a11149a08949cf838fe3dd Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Fri, 4 Jan 2013 13:16:34 +0530 Subject: [PATCH 1/6] shifted UOM field to after qty field in purchase cycle --- .../purchase_invoice_item.txt | 41 +++++---- .../purchase_order_item.txt | 44 +++++---- .../supplier_quotation_item.txt | 41 +++++---- .../purchase_receipt_item.txt | 90 +++++++++---------- 4 files changed, 113 insertions(+), 103 deletions(-) diff --git a/accounts/doctype/purchase_invoice_item/purchase_invoice_item.txt b/accounts/doctype/purchase_invoice_item/purchase_invoice_item.txt index db1ebb6878..93668b6186 100755 --- a/accounts/doctype/purchase_invoice_item/purchase_invoice_item.txt +++ b/accounts/doctype/purchase_invoice_item/purchase_invoice_item.txt @@ -2,9 +2,9 @@ { "owner": "Administrator", "docstatus": 0, - "creation": "2012-07-03 13:29:48", + "creation": "2012-12-19 22:38:53", "modified_by": "Administrator", - "modified": "2012-12-19 11:57:47" + "modified": "2013-01-04 13:15:09" }, { "istable": 1, @@ -40,17 +40,18 @@ }, { "oldfieldtype": "Data", - "search_index": 0, "doctype": "DocField", "label": "Item Name", "oldfieldname": "item_name", "fieldname": "item_name", "fieldtype": "Data", + "search_index": 0, "reqd": 1, "permlevel": 0, "in_filter": 0 }, { + "print_width": "300px", "oldfieldtype": "Text", "doctype": "DocField", "label": "Description", @@ -71,6 +72,15 @@ "reqd": 1, "permlevel": 0 }, + { + "print_hide": 1, + "doctype": "DocField", + "label": "UOM", + "options": "UOM", + "fieldname": "uom", + "fieldtype": "Link", + "permlevel": 0 + }, { "print_hide": 1, "doctype": "DocField", @@ -140,19 +150,21 @@ }, { "print_hide": 1, + "print_width": "120px", "permlevel": 0, "oldfieldtype": "Link", "doctype": "DocField", "label": "Expense Head", "oldfieldname": "expense_head", "width": "120px", - "options": "Account", "fieldname": "expense_head", "fieldtype": "Link", - "reqd": 1 + "reqd": 1, + "options": "Account" }, { "print_hide": 1, + "print_width": "120px", "oldfieldtype": "Link", "doctype": "DocField", "label": "Cost Center", @@ -173,15 +185,6 @@ "permlevel": 0, "in_filter": 1 }, - { - "print_hide": 1, - "doctype": "DocField", - "label": "UOM", - "options": "UOM", - "fieldname": "uom", - "fieldtype": "Link", - "permlevel": 0 - }, { "print_hide": 1, "oldfieldtype": "Data", @@ -200,35 +203,35 @@ "label": "Item Group", "oldfieldname": "item_group", "permlevel": 1, - "options": "Item Group", "fieldname": "item_group", "fieldtype": "Link", "search_index": 1, "hidden": 1, + "options": "Item Group", "in_filter": 1 }, { "print_hide": 1, "oldfieldtype": "Link", - "search_index": 1, "doctype": "DocField", "label": "Pur Order", "oldfieldname": "purchase_order", "options": "Purchase Order", "fieldname": "purchase_order", "fieldtype": "Link", + "search_index": 1, "permlevel": 1, "in_filter": 1 }, { "print_hide": 1, "oldfieldtype": "Data", - "search_index": 1, "doctype": "DocField", "label": "Purchase Order Item", "oldfieldname": "po_detail", "fieldname": "po_detail", "fieldtype": "Data", + "search_index": 1, "hidden": 1, "permlevel": 1, "in_filter": 1 @@ -236,25 +239,25 @@ { "print_hide": 1, "oldfieldtype": "Link", - "search_index": 1, "doctype": "DocField", "label": "Pur Receipt", "oldfieldname": "purchase_receipt", "options": "Purchase Receipt", "fieldname": "purchase_receipt", "fieldtype": "Link", + "search_index": 1, "permlevel": 1, "in_filter": 1 }, { "print_hide": 1, "oldfieldtype": "Data", - "search_index": 1, "doctype": "DocField", "label": "PR Detail", "oldfieldname": "pr_detail", "fieldname": "pr_detail", "fieldtype": "Data", + "search_index": 1, "hidden": 1, "permlevel": 1, "in_filter": 1 diff --git a/buying/doctype/purchase_order_item/purchase_order_item.txt b/buying/doctype/purchase_order_item/purchase_order_item.txt index 9f8151df0d..cbe2cde724 100755 --- a/buying/doctype/purchase_order_item/purchase_order_item.txt +++ b/buying/doctype/purchase_order_item/purchase_order_item.txt @@ -2,9 +2,9 @@ { "owner": "Administrator", "docstatus": 0, - "creation": "2012-08-06 20:00:38", + "creation": "2012-12-19 22:38:55", "modified_by": "Administrator", - "modified": "2012-12-19 11:57:28" + "modified": "2013-01-04 13:13:47" }, { "istable": 1, @@ -78,6 +78,7 @@ "in_filter": 1 }, { + "print_width": "300px", "oldfieldtype": "Small Text", "doctype": "DocField", "label": "Description", @@ -89,6 +90,7 @@ "permlevel": 0 }, { + "print_width": "60px", "default": "0.00", "oldfieldtype": "Currency", "doctype": "DocField", @@ -100,6 +102,20 @@ "reqd": 1, "permlevel": 0 }, + { + "print_hide": 0, + "print_width": "100px", + "permlevel": 0, + "oldfieldtype": "Link", + "doctype": "DocField", + "label": "UOM", + "oldfieldname": "uom", + "width": "100px", + "fieldname": "uom", + "fieldtype": "Link", + "reqd": 1, + "options": "UOM" + }, { "print_hide": 1, "doctype": "DocField", @@ -146,6 +162,7 @@ }, { "print_hide": 1, + "print_width": "100px", "default": "0.00", "oldfieldtype": "Currency", "doctype": "DocField", @@ -193,21 +210,9 @@ "report_hide": 0, "in_filter": 1 }, - { - "print_hide": 0, - "oldfieldtype": "Link", - "doctype": "DocField", - "label": "UOM", - "oldfieldname": "uom", - "width": "100px", - "options": "UOM", - "fieldname": "uom", - "fieldtype": "Link", - "reqd": 1, - "permlevel": 0 - }, { "print_hide": 1, + "print_width": "100px", "oldfieldtype": "Currency", "doctype": "DocField", "label": "UOM Conversion Factor", @@ -221,6 +226,7 @@ }, { "print_hide": 1, + "print_width": "100px", "oldfieldtype": "Data", "doctype": "DocField", "label": "Stock UOM", @@ -247,6 +253,7 @@ { "print_hide": 1, "permlevel": 1, + "print_width": "120px", "no_copy": 0, "oldfieldtype": "Link", "doctype": "DocField", @@ -263,12 +270,12 @@ { "print_hide": 1, "oldfieldtype": "Date", - "search_index": 0, "doctype": "DocField", "label": "Purchase Request Date", "oldfieldname": "prevdoc_date", "fieldname": "prevdoc_date", "fieldtype": "Date", + "search_index": 0, "hidden": 1, "permlevel": 1, "in_filter": 1 @@ -326,15 +333,16 @@ "label": "Item Group", "oldfieldname": "item_group", "permlevel": 1, - "options": "Item Group", "fieldname": "item_group", "fieldtype": "Link", "search_index": 0, "hidden": 1, + "options": "Item Group", "in_filter": 1 }, { "print_hide": 1, + "print_width": "100px", "no_copy": 1, "oldfieldtype": "Currency", "doctype": "DocField", @@ -361,11 +369,11 @@ { "print_hide": 1, "default": "0.00", - "no_copy": 1, "oldfieldtype": "Currency", "doctype": "DocField", "label": "Billed Quantity", "oldfieldname": "billed_qty", + "no_copy": 1, "fieldname": "billed_qty", "fieldtype": "Currency", "hidden": 0, diff --git a/buying/doctype/supplier_quotation_item/supplier_quotation_item.txt b/buying/doctype/supplier_quotation_item/supplier_quotation_item.txt index 97cddf7a4a..40d5607a9b 100644 --- a/buying/doctype/supplier_quotation_item/supplier_quotation_item.txt +++ b/buying/doctype/supplier_quotation_item/supplier_quotation_item.txt @@ -2,9 +2,9 @@ { "owner": "Administrator", "docstatus": 0, - "creation": "2012-08-06 20:00:36", + "creation": "2012-12-19 22:38:54", "modified_by": "Administrator", - "modified": "2012-12-19 11:56:59" + "modified": "2013-01-04 13:14:13" }, { "istable": 1, @@ -63,6 +63,7 @@ "in_filter": 1 }, { + "print_width": "300px", "oldfieldtype": "Small Text", "doctype": "DocField", "label": "Description", @@ -74,6 +75,7 @@ "permlevel": 0 }, { + "print_width": "60px", "default": "0.00", "oldfieldtype": "Currency", "doctype": "DocField", @@ -85,6 +87,20 @@ "reqd": 1, "permlevel": 0 }, + { + "print_hide": 0, + "print_width": "100px", + "permlevel": 0, + "oldfieldtype": "Link", + "doctype": "DocField", + "label": "UOM", + "oldfieldname": "uom", + "width": "100px", + "fieldname": "uom", + "fieldtype": "Link", + "reqd": 1, + "options": "UOM" + }, { "print_hide": 1, "doctype": "DocField", @@ -131,6 +147,7 @@ }, { "print_hide": 1, + "print_width": "100px", "default": "0.00", "oldfieldtype": "Currency", "doctype": "DocField", @@ -160,11 +177,11 @@ "doctype": "DocField", "label": "Warehouse", "oldfieldname": "warehouse", + "options": "Warehouse", "fieldname": "warehouse", "fieldtype": "Link", "reqd": 0, "hidden": 0, - "options": "Warehouse", "permlevel": 0 }, { @@ -178,19 +195,6 @@ "report_hide": 0, "in_filter": 1 }, - { - "print_hide": 0, - "oldfieldtype": "Link", - "doctype": "DocField", - "label": "UOM", - "oldfieldname": "uom", - "width": "100px", - "options": "UOM", - "fieldname": "uom", - "fieldtype": "Link", - "reqd": 1, - "permlevel": 0 - }, { "print_hide": 1, "no_copy": 0, @@ -206,6 +210,7 @@ { "print_hide": 1, "permlevel": 1, + "print_width": "120px", "no_copy": 0, "oldfieldtype": "Link", "doctype": "DocField", @@ -222,12 +227,12 @@ { "print_hide": 1, "oldfieldtype": "Date", - "search_index": 0, "doctype": "DocField", "label": "Purchase Request Date", "oldfieldname": "prevdoc_date", "fieldname": "prevdoc_date", "fieldtype": "Date", + "search_index": 0, "hidden": 1, "permlevel": 1, "in_filter": 1 @@ -265,11 +270,11 @@ "label": "Item Group", "oldfieldname": "item_group", "permlevel": 1, - "options": "Item Group", "fieldname": "item_group", "fieldtype": "Link", "search_index": 0, "hidden": 1, + "options": "Item Group", "in_filter": 1 }, { diff --git a/stock/doctype/purchase_receipt_item/purchase_receipt_item.txt b/stock/doctype/purchase_receipt_item/purchase_receipt_item.txt index d49dfa9644..6d085f1896 100755 --- a/stock/doctype/purchase_receipt_item/purchase_receipt_item.txt +++ b/stock/doctype/purchase_receipt_item/purchase_receipt_item.txt @@ -2,9 +2,9 @@ { "owner": "Administrator", "docstatus": 0, - "creation": "2012-07-03 13:30:42", + "creation": "2012-12-03 10:25:00", "modified_by": "Administrator", - "modified": "2012-12-03 10:20:11" + "modified": "2013-01-04 13:14:40" }, { "istable": 1, @@ -25,13 +25,13 @@ "doctype": "DocType" }, { + "print_width": "100px", "permlevel": 0, "oldfieldtype": "Link", "doctype": "DocField", "label": "Item Code", "oldfieldname": "item_code", "width": "100px", - "trigger": "Client", "fieldname": "item_code", "fieldtype": "Link", "search_index": 1, @@ -53,6 +53,7 @@ "in_filter": 0 }, { + "print_width": "300px", "oldfieldtype": "Text", "doctype": "DocField", "label": "Description", @@ -65,45 +66,59 @@ }, { "print_hide": 1, + "print_width": "100px", "default": "0.00", "oldfieldtype": "Currency", "doctype": "DocField", "label": "Recd Quantity", "oldfieldname": "received_qty", "width": "100px", - "trigger": "Client", "fieldname": "received_qty", "fieldtype": "Currency", "reqd": 1, "permlevel": 0 }, { + "print_width": "100px", "default": "0.00", "oldfieldtype": "Currency", "doctype": "DocField", "label": "Accepted Quantity", "oldfieldname": "qty", "width": "100px", - "trigger": "Client", "fieldname": "qty", "fieldtype": "Currency", "permlevel": 0 }, { "print_hide": 1, + "print_width": "100px", "default": "0.00", "oldfieldtype": "Currency", "doctype": "DocField", "label": "Rejected Quantity", "oldfieldname": "rejected_qty", "width": "100px", - "trigger": "Client", "fieldname": "rejected_qty", "fieldtype": "Currency", "search_index": 0, "permlevel": 0, "in_filter": 0 }, + { + "print_hide": 1, + "print_width": "100px", + "permlevel": 0, + "oldfieldtype": "Link", + "doctype": "DocField", + "label": "UOM", + "oldfieldname": "uom", + "width": "100px", + "fieldname": "uom", + "fieldtype": "Link", + "reqd": 1, + "options": "UOM" + }, { "print_hide": 1, "doctype": "DocField", @@ -122,14 +137,13 @@ }, { "print_hide": 0, + "print_width": "100px", "default": "0.00", "oldfieldtype": "Currency", - "colour": "White:FFF", "doctype": "DocField", "label": "Rate", "oldfieldname": "import_rate", "width": "100px", - "trigger": "Client", "fieldname": "import_rate", "fieldtype": "Currency", "permlevel": 0 @@ -153,14 +167,13 @@ }, { "print_hide": 1, + "print_width": "100px", "default": "0.00", "oldfieldtype": "Currency", - "colour": "White:FFF", "doctype": "DocField", "label": "Rate *(Default Curr.)", "oldfieldname": "purchase_rate", "width": "100px", - "trigger": "Client", "fieldname": "purchase_rate", "fieldtype": "Currency", "reqd": 1, @@ -168,13 +181,13 @@ }, { "print_hide": 1, + "print_width": "100px", "default": "0.00", "oldfieldtype": "Currency", "doctype": "DocField", "label": "Amount (Default Curr.)", "oldfieldname": "amount", "width": "100px", - "trigger": "Client", "fieldname": "amount", "fieldtype": "Currency", "reqd": 0, @@ -182,40 +195,26 @@ }, { "print_hide": 1, + "print_width": "100px", + "permlevel": 0, "oldfieldtype": "Link", "doctype": "DocField", "label": "Accepted Warehouse", "oldfieldname": "warehouse", "width": "100px", - "options": "Warehouse", "fieldname": "warehouse", "fieldtype": "Link", "hidden": 0, - "permlevel": 0 - }, - { - "print_hide": 1, - "permlevel": 0, - "oldfieldtype": "Link", - "colour": "White:FFF", - "doctype": "DocField", - "label": "UOM", - "oldfieldname": "uom", - "width": "100px", - "trigger": "Client", - "fieldname": "uom", - "fieldtype": "Link", - "reqd": 1, - "options": "UOM" + "options": "Warehouse" }, { "print_hide": 1, + "print_width": "100px", "oldfieldtype": "Currency", "doctype": "DocField", "label": "Conversion Factor", "oldfieldname": "conversion_factor", "width": "100px", - "trigger": "Client", "fieldname": "conversion_factor", "fieldtype": "Currency", "reqd": 1, @@ -223,6 +222,7 @@ }, { "print_hide": 1, + "print_width": "100px", "oldfieldtype": "Data", "doctype": "DocField", "label": "Stock UOM", @@ -237,7 +237,6 @@ "print_hide": 0, "no_copy": 1, "oldfieldtype": "Text", - "colour": "White:FFF", "doctype": "DocField", "label": "Serial No", "oldfieldname": "serial_no", @@ -258,22 +257,20 @@ { "print_hide": 1, "oldfieldtype": "Link", - "colour": "White:FFF", "doctype": "DocField", "label": "Batch No", "oldfieldname": "batch_no", - "trigger": "Client", + "options": "Batch", "fieldname": "batch_no", "fieldtype": "Link", - "options": "Batch", "permlevel": 0 }, { "print_hide": 1, "permlevel": 1, + "print_width": "100px", "no_copy": 1, "oldfieldtype": "Link", - "colour": "White:FFF", "doctype": "DocField", "label": "Rejected Warehouse", "oldfieldname": "rejected_warehouse", @@ -287,7 +284,6 @@ "print_hide": 1, "no_copy": 1, "oldfieldtype": "Date", - "colour": "White:FFF", "doctype": "DocField", "label": "Required By", "oldfieldname": "schedule_date", @@ -299,7 +295,6 @@ }, { "print_hide": 1, - "colour": "White:FFF", "doctype": "DocField", "label": "Project Name", "options": "Project", @@ -312,7 +307,6 @@ "print_hide": 1, "no_copy": 1, "oldfieldtype": "Link", - "colour": "White:FFF", "doctype": "DocField", "label": "QA No", "oldfieldname": "qa_no", @@ -349,12 +343,12 @@ }, { "print_hide": 1, + "print_width": "100px", "oldfieldtype": "Currency", "doctype": "DocField", "label": "Stock Qty", "oldfieldname": "stock_qty", "width": "100px", - "trigger": "Client", "fieldname": "stock_qty", "fieldtype": "Currency", "permlevel": 0 @@ -362,7 +356,6 @@ { "print_hide": 1, "oldfieldtype": "Data", - "colour": "White:FFF", "doctype": "DocField", "label": "Prevdoc Doctype", "oldfieldname": "prevdoc_doctype", @@ -374,9 +367,9 @@ { "print_hide": 1, "permlevel": 1, + "print_width": "150px", "no_copy": 0, "oldfieldtype": "Link", - "colour": "White:FFF", "doctype": "DocField", "label": "PO No", "oldfieldname": "prevdoc_docname", @@ -403,6 +396,7 @@ }, { "print_hide": 1, + "print_width": "150px", "oldfieldtype": "Currency", "doctype": "DocField", "label": "Raw Materials Supplied Cost", @@ -416,9 +410,9 @@ }, { "print_hide": 1, + "print_width": "150px", "no_copy": 1, "oldfieldtype": "Currency", - "colour": "White:FFF", "doctype": "DocField", "label": "Item Tax Amount", "oldfieldname": "item_tax_amount", @@ -432,9 +426,9 @@ }, { "print_hide": 1, + "print_width": "150px", "no_copy": 0, "oldfieldtype": "Data", - "colour": "White:FFF", "doctype": "DocField", "label": "Purchase Order Item No", "oldfieldname": "prevdoc_detail_docname", @@ -448,22 +442,23 @@ }, { "print_hide": 1, + "permlevel": 1, + "print_width": "100px", "default": "0.00", "oldfieldtype": "Currency", "doctype": "DocField", - "no_copy": 1, "label": "Billed Quantity", "oldfieldname": "billed_qty", - "width": "100px", + "no_copy": 1, "fieldname": "billed_qty", "fieldtype": "Currency", - "permlevel": 1 + "width": "100px" }, { "print_hide": 1, + "print_width": "80px", "no_copy": 1, "oldfieldtype": "Currency", - "colour": "White:FFF", "doctype": "DocField", "label": "Valuation Rate", "oldfieldname": "valuation_rate", @@ -478,7 +473,6 @@ "print_hide": 1, "description": "Tax detail table fetched from item master as a string and stored in this field.\nUsed for Taxes and Charges", "oldfieldtype": "Small Text", - "colour": "White:FFF", "doctype": "DocField", "label": "Item Tax Rate", "oldfieldname": "item_tax_rate", @@ -491,8 +485,8 @@ }, { "print_hide": 1, - "oldfieldtype": "Check", "allow_on_submit": 1, + "oldfieldtype": "Check", "doctype": "DocField", "label": "Page Break", "oldfieldname": "page_break", From cd7a02c489c861aab40991b937e9bde27cfb30c4 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Fri, 4 Jan 2013 14:03:36 +0530 Subject: [PATCH 2/6] added workflow help, fixed button primary action in form and refactored permissions --- hr/doctype/expense_claim/expense_claim.py | 4 ---- hr/doctype/leave_application/leave_application.py | 6 +----- website/doctype/product_settings/product_settings.py | 6 +++++- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/hr/doctype/expense_claim/expense_claim.py b/hr/doctype/expense_claim/expense_claim.py index 3906550224..9e476e5595 100644 --- a/hr/doctype/expense_claim/expense_claim.py +++ b/hr/doctype/expense_claim/expense_claim.py @@ -32,10 +32,6 @@ class DocType: def validate(self): # if self.doc.exp_approver == self.doc.owner: # webnotes.msgprint("""Self Approval is not allowed.""", raise_exception=1) - - import utilities - utilities.validate_status(self.doc.approval_status, ["Draft", "Approved", "Rejected"]) - self.validate_fiscal_year() self.validate_exp_details() diff --git a/hr/doctype/leave_application/leave_application.py b/hr/doctype/leave_application/leave_application.py index ebefc0eb15..ad3f864150 100755 --- a/hr/doctype/leave_application/leave_application.py +++ b/hr/doctype/leave_application/leave_application.py @@ -32,10 +32,6 @@ class DocType: def validate(self): # if self.doc.leave_approver == self.doc.owner: - # webnotes.msgprint("""Self Approval is not allowed.""", raise_exception=1) - import utilities - utilities.validate_status(self.doc.status, ["Open", "Approved", "Rejected"]) - self.validate_to_date() self.validate_balance_leaves() self.validate_leave_overlap() @@ -43,7 +39,7 @@ class DocType: def on_submit(self): if self.doc.status != "Approved": - webnotes.msgprint("""Only Approved Leave Applications can be Submitted.""", + webnotes.msgprint("""Only Leave Applications with status 'Approved' can be Submitted.""", raise_exception=True) def get_holidays(self): diff --git a/website/doctype/product_settings/product_settings.py b/website/doctype/product_settings/product_settings.py index 0137ff1610..4e72be6be3 100644 --- a/website/doctype/product_settings/product_settings.py +++ b/website/doctype/product_settings/product_settings.py @@ -10,4 +10,8 @@ class DocType: def on_update(self): """clear web cache""" from website.utils import clear_cache - clear_cache() \ No newline at end of file + clear_cache() + + if self.doc.default_product_category: + webnotes.model_wrapper("Item Group", + self.doc.default_product_category).save() \ No newline at end of file From 607a221f4129eaf41d9aa489d04f57aa61cb74d4 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Fri, 4 Jan 2013 16:42:33 +0530 Subject: [PATCH 3/6] added support analytics and some other minor updates --- home/page/latest_updates/latest_updates.js | 4 + startup/report_data_map.py | 7 ++ support/page/support_analytics/__init__.py | 0 .../support_analytics/support_analytics.js | 91 +++++++++++++++++++ .../support_analytics/support_analytics.txt | 32 +++++++ support/page/support_home/support_home.html | 11 +++ 6 files changed, 145 insertions(+) create mode 100644 support/page/support_analytics/__init__.py create mode 100644 support/page/support_analytics/support_analytics.js create mode 100644 support/page/support_analytics/support_analytics.txt diff --git a/home/page/latest_updates/latest_updates.js b/home/page/latest_updates/latest_updates.js index 926d607e8f..80d3d5ff7e 100644 --- a/home/page/latest_updates/latest_updates.js +++ b/home/page/latest_updates/latest_updates.js @@ -1,4 +1,8 @@ erpnext.updates = [ + ["4th January 2013", [ + "Support Analytics: Simple Tool to Plot Number Tickets and time to Closing", + "Workflow: Added Workflow Help", + ]], ["2nd January 2013", [ "Permission Manager: New Design with better help and better advanced permission selection.", "User Properties: Better way to set User Properties (defaults).", diff --git a/startup/report_data_map.py b/startup/report_data_map.py index c7a8ab7e7e..41d6cb868a 100644 --- a/startup/report_data_map.py +++ b/startup/report_data_map.py @@ -215,6 +215,13 @@ data_map = { "parent": ["Purchase Invoice", "name"], "item_code": ["Item", "name"] } + }, + + # Support + "Support Ticket": { + "columns": ["name","status","creation","modified"], + "conditions": ["docstatus < 2"], + "order_by": "creation" } } diff --git a/support/page/support_analytics/__init__.py b/support/page/support_analytics/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/support/page/support_analytics/support_analytics.js b/support/page/support_analytics/support_analytics.js new file mode 100644 index 0000000000..e310df30a3 --- /dev/null +++ b/support/page/support_analytics/support_analytics.js @@ -0,0 +1,91 @@ +wn.pages['support-analytics'].onload = function(wrapper) { + wn.ui.make_app_page({ + parent: wrapper, + title: 'Support Analytics', + single_column: true + }); + + new erpnext.SupportAnalytics(wrapper); + + wrapper.appframe.add_home_breadcrumb() + wrapper.appframe.add_module_breadcrumb("Support") + wrapper.appframe.add_breadcrumb("icon-bar-chart") +} + +erpnext.SupportAnalytics = wn.views.GridReportWithPlot.extend({ + init: function(wrapper) { + this._super({ + title: "Support Analtyics", + page: wrapper, + parent: $(wrapper).find('.layout-main'), + appframe: wrapper.appframe, + doctypes: ["Support Ticket", "Fiscal Year"], + }); + }, + + filters: [ + {fieldtype:"Select", label: "Fiscal Year", link:"Fiscal Year", + default_value: "Select Fiscal Year..."}, + {fieldtype:"Date", label: "From Date"}, + {fieldtype:"Label", label: "To"}, + {fieldtype:"Date", label: "To Date"}, + {fieldtype:"Select", label: "Range", + options:["Daily", "Weekly", "Monthly", "Quarterly", "Yearly"]}, + {fieldtype:"Button", label: "Refresh", icon:"icon-refresh icon-white", cssClass:"btn-info"}, + {fieldtype:"Button", label: "Reset Filters"} + ], + + setup_columns: function() { + var std_columns = [ + {id: "check", name: "Plot", field: "check", width: 30, + formatter: this.check_formatter}, + {id: "status", name: "Status", field: "status", width: 100}, + ]; + this.make_date_range_columns(); + this.columns = std_columns.concat(this.columns); + }, + + prepare_data: function() { + // add Opening, Closing, Totals rows + // if filtered by account and / or voucher + var me = this; + var total_tickets = {status:"All Tickets", "id": "all-tickets", + checked:true}; + var days_to_close = {status:"Days to Close", "id":"days-to-close", + checked:false}; + var hours_to_close = {status:"Hours to Close", "id":"hours-to-close", + checked:false}; + + + $.each(wn.report_dump.data["Support Ticket"], function(i, d) { + var dateobj = dateutil.str_to_obj(d.creation); + var date = d.creation.split(" ")[0]; + var col = me.column_map[date]; + if(col) { + // just count + var day_diff = dateutil.get_diff(d.modified, d.creation); + var hour_diff = dateutil.get_hour_diff(d.modified, d.creation); + + total_tickets[col.field] = flt(total_tickets[col.field]) + 1; + days_to_close[col.field] = flt(days_to_close[col.field]) + day_diff; + hours_to_close[col.field] = flt(hours_to_close[col.field]) + hour_diff; + } + }); + + // make averages + $.each(this.columns, function(i, col) { + if(col.formatter==me.currency_formatter && total_tickets[col.field]) { + days_to_close[col.field] = flt(days_to_close[col.field]) / flt(total_tickets[col.field]); + hours_to_close[col.field] = flt(hours_to_close[col.field]) / flt(total_tickets[col.field]); + } + }) + + this.data = [total_tickets, days_to_close, hours_to_close]; + }, + + get_plot_points: function(item, col, idx) { + return [[dateutil.str_to_obj(col.id).getTime(), item[col.field]], + [dateutil.user_to_obj(col.name).getTime(), item[col.field]]]; + } + +}); \ No newline at end of file diff --git a/support/page/support_analytics/support_analytics.txt b/support/page/support_analytics/support_analytics.txt new file mode 100644 index 0000000000..587bd93547 --- /dev/null +++ b/support/page/support_analytics/support_analytics.txt @@ -0,0 +1,32 @@ +[ + { + "owner": "Administrator", + "docstatus": 0, + "creation": "2013-01-04 15:31:45", + "modified_by": "Administrator", + "modified": "2013-01-04 15:38:44" + }, + { + "name": "__common__", + "title": "Support Analytics", + "doctype": "Page", + "module": "Support", + "standard": "Yes", + "page_name": "support-analytics" + }, + { + "name": "__common__", + "parent": "support-analytics", + "doctype": "Page Role", + "parenttype": "Page", + "role": "Support Team", + "parentfield": "roles" + }, + { + "name": "support-analytics", + "doctype": "Page" + }, + { + "doctype": "Page Role" + } +] \ No newline at end of file diff --git a/support/page/support_home/support_home.html b/support/page/support_home/support_home.html index ed01fa094e..d444d73dce 100644 --- a/support/page/support_home/support_home.html +++ b/support/page/support_home/support_home.html @@ -27,6 +27,17 @@

Reports

+
+
+ Support Analytics +
+

Support Ticket trends and response.

+
+
+
+
+
+

Reports

From 947a025bde10b16017d2a2a48d5b11558b3359c7 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Mon, 7 Jan 2013 10:32:57 +0530 Subject: [PATCH 4/6] added 'getdoc' in webnotes.utils.client --- support/page/support_home/support_home.html | 1 - 1 file changed, 1 deletion(-) diff --git a/support/page/support_home/support_home.html b/support/page/support_home/support_home.html index d444d73dce..59eff10aad 100644 --- a/support/page/support_home/support_home.html +++ b/support/page/support_home/support_home.html @@ -26,7 +26,6 @@

-

Reports

Support Analytics From 1d55c72d8b75021624dd334eb2780c9c385b050d Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Mon, 7 Jan 2013 12:54:10 +0530 Subject: [PATCH 5/6] added .py~ to gitignore --- .gitignore | 1 + .../valuation_control/valuation_control.py~ | 87 ------------------- 2 files changed, 1 insertion(+), 87 deletions(-) delete mode 100644 stock/doctype/valuation_control/valuation_control.py~ diff --git a/.gitignore b/.gitignore index 99a0c8a95a..dc2ad3df1e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ *.pyc +*.py~ *.comp.js .DS_Store patch.log diff --git a/stock/doctype/valuation_control/valuation_control.py~ b/stock/doctype/valuation_control/valuation_control.py~ deleted file mode 100644 index 88ce63e29e..0000000000 --- a/stock/doctype/valuation_control/valuation_control.py~ +++ /dev/null @@ -1,87 +0,0 @@ -# Please edit this list and import only required elements -import webnotes - -from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add -from webnotes.model import db_exists -from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType -from webnotes.model.doclist import getlist, copy_doclist -from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax -from webnotes import session, form, is_testing, msgprint, errprint - -set = webnotes.conn.set -sql = webnotes.conn.sql -get_value = webnotes.conn.get_value -in_transaction = webnotes.conn.in_transaction -convert_to_lists = webnotes.conn.convert_to_lists - -# ----------------------------------------------------------------------------------------- - - -class DocType: - def __init__(self, d, dl): - self.doc, self.doclist = d, dl - - # Get FIFO Rate from Stack - # ------------------------- - def get_fifo_rate(self, fcfs_stack, qty): - fcfs_val = 0 - withdraw = flt(qty) - while withdraw: - batch = fcfs_stack[0] - if batch[0] <= withdraw: - # not enough or exactly same qty in current batch, clear batch - withdraw -= batch[0] - fcfs_val += (flt(batch[0]) * flt(batch[1])) - fcfs_stack.pop(0) - else: - # all from current batch - fcfs_val += (flt(withdraw) * flt(batch[1])) - batch[0] -= withdraw - withdraw = 0 - fcfs_rate = flt(fcfs_val) / flt(qty) - return fcfs_rate - - # -------------------------------- - # get serializable inventory rate - # -------------------------------- - def get_serializable_inventory_rate(self, serial_no): - sr_nos = get_obj("Stock Ledger").get_sr_no_list(serial_no) - tot = 0 - for s in sr_nos: - serial_no = s.strip() - tot += flt(webnotes.conn.get_value('Serial No', serial_no, 'purchase_rate')) - return tot / len(sr_nos) - - - # --------------------- - # get valuation method - # --------------------- - def get_valuation_method(self, item_code): - val_method = webnotes.conn.get_value('Item', item_code, 'valuation_method') - if not val_method: - val_method = get_defaults().get('valuation_method', 'FIFO') - return val_method - - - # Get Incoming Rate based on valuation method - # -------------------------------------------- - def get_incoming_rate(self, posting_date, posting_time, item, warehouse, qty = 0, serial_no = ''): - msgprint(1) - in_rate = 0 - val_method = self.get_valuation_method(item) - bin_obj = get_obj('Warehouse',warehouse).get_bin(item) - if serial_no: - in_rate = self.get_serializable_inventory_rate(serial_no) - elif val_method == 'FIFO': - in_rate = 0 - if qty: - prev_sle = bin_obj.get_prev_sle(posting_date, posting_time) - msgprint(prev_sle) - fcfs_stack = eval(prev_sle.get('fcfs_stack', '[]') or '[]') - msgprint(fcfs_stack) - in_rate = fcfs_stack and self.get_fifo_rate(fcfs_stack, qty) or 0 - msgprint(in_rate) - elif val_method == 'Moving Average': - prev_sle = bin_obj.get_prev_sle(posting_date, posting_time) - in_rate = prev_sle and prev_sle.get('valuation_rate', 0) or 0 - return in_rate From e80b9c6ee9011dd2cfc77fbb5e78711951748f76 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Mon, 7 Jan 2013 13:28:40 +0530 Subject: [PATCH 6/6] closing = opening + diff for stock balance report --- stock/page/stock_balance/stock_balance.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/stock/page/stock_balance/stock_balance.js b/stock/page/stock_balance/stock_balance.js index da6b831d93..90c7943e29 100644 --- a/stock/page/stock_balance/stock_balance.js +++ b/stock/page/stock_balance/stock_balance.js @@ -130,6 +130,12 @@ erpnext.StockBalance = erpnext.StockAnalytics.extend({ } } } + + // opening + diff = closing + // adding opening, since diff already added to closing + $.each(me.item_by_name, function(key, item) { + item.closing += item.opening; + }); }, update_groups: function() {