From a55fb6426c6942d1ce2b3d9fbeaf25744dbe8889 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Tue, 14 Jun 2016 15:54:17 +0530 Subject: [PATCH] [patch] mins_to_first_response in opporutnity and issue --- .../crm/doctype/opportunity/opportunity.json | 30 +++++++++++++++- erpnext/patches.txt | 3 +- .../v7_0/update_mins_to_first_response.py | 21 ++++++++++++ erpnext/public/css/erpnext.css | 4 +-- erpnext/support/doctype/issue/issue.json | 34 ++++++++++++++++--- 5 files changed, 83 insertions(+), 9 deletions(-) create mode 100644 erpnext/patches/v7_0/update_mins_to_first_response.py diff --git a/erpnext/crm/doctype/opportunity/opportunity.json b/erpnext/crm/doctype/opportunity/opportunity.json index 0f45c60095..2a0820bf3c 100644 --- a/erpnext/crm/doctype/opportunity/opportunity.json +++ b/erpnext/crm/doctype/opportunity/opportunity.json @@ -3,6 +3,7 @@ "allow_import": 1, "allow_rename": 0, "autoname": "naming_series:", + "beta": 0, "creation": "2013-03-07 18:50:30", "custom": 0, "description": "Potential Sales Deal", @@ -301,6 +302,31 @@ "set_only_once": 0, "unique": 0 }, + { + "allow_on_submit": 0, + "bold": 1, + "collapsible": 0, + "fieldname": "mins_to_first_response", + "fieldtype": "Float", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Mins to first response", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, { "allow_on_submit": 0, "bold": 0, @@ -968,13 +994,14 @@ "hide_toolbar": 0, "icon": "icon-info-sign", "idx": 195, + "image_view": 0, "in_create": 0, "in_dialog": 0, "is_submittable": 0, "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2016-04-06 03:15:24.676978", + "modified": "2016-06-14 15:50:55.080217", "modified_by": "Administrator", "module": "CRM", "name": "Opportunity", @@ -1021,6 +1048,7 @@ "write": 1 } ], + "quick_entry": 0, "read_only": 0, "read_only_onload": 0, "search_fields": "status,transaction_date,customer,lead,enquiry_type,territory,company", diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 363a5a6977..e3aa04b2d6 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -269,4 +269,5 @@ erpnext.patches.v7_0.create_budget_record execute:frappe.delete_doc_if_exists("Page", "financial-analytics") erpnext.patches.v7_0.update_project_in_gl_entry execute:frappe.db.sql('update tabQuotation set status="Cancelled" where docstatus=2') -execute:frappe.rename_doc("DocType", "Payments", "Sales Invoice Payment", force=True) \ No newline at end of file +execute:frappe.rename_doc("DocType", "Payments", "Sales Invoice Payment", force=True) +erpnext.patches.v7_0.update_mins_to_first_response diff --git a/erpnext/patches/v7_0/update_mins_to_first_response.py b/erpnext/patches/v7_0/update_mins_to_first_response.py new file mode 100644 index 0000000000..566627e510 --- /dev/null +++ b/erpnext/patches/v7_0/update_mins_to_first_response.py @@ -0,0 +1,21 @@ +import frappe + +from frappe.core.doctype.communication.email import update_mins_to_first_communication + +def execute(): + frappe.reload_doctype('Issue') + frappe.reload_doctype('Opportunity') + + for doctype in ('Issue', 'Opportunity'): + for parent in frappe.get_all(doctype, order_by='creation desc', limit=1000): + for communication in frappe.get_all('Communication', + filters={'reference_doctype': doctype, 'reference_name': parent.name}, + order_by = 'creation desc', limit=2): + + parent_doc = frappe.get_doc(doctype, parent.name) + communication_doc = frappe.get_doc('Communication', communication.name) + + update_mins_to_first_communication(parent_doc, communication_doc) + + if parent_doc.mins_to_first_response: + continue \ No newline at end of file diff --git a/erpnext/public/css/erpnext.css b/erpnext/public/css/erpnext.css index 719f259828..9a015c2fc2 100644 --- a/erpnext/public/css/erpnext.css +++ b/erpnext/public/css/erpnext.css @@ -141,6 +141,7 @@ .pos-payment-row { border-bottom: 1px solid #d1d8dd; margin: 2px 0px 5px 0px; + height: 60px; } .pos-payment-row:hover, .pos-keyboard-key:hover { @@ -158,9 +159,6 @@ background-color: #FDFDFD; border-color: #e8e8e8; } -.amount { - margin-top: 5px; -} .amount-label { font-size: 16px; } diff --git a/erpnext/support/doctype/issue/issue.json b/erpnext/support/doctype/issue/issue.json index be9603bb16..6da9b1c344 100644 --- a/erpnext/support/doctype/issue/issue.json +++ b/erpnext/support/doctype/issue/issue.json @@ -62,7 +62,7 @@ }, { "allow_on_submit": 0, - "bold": 0, + "bold": 1, "collapsible": 0, "fieldname": "subject", "fieldtype": "Data", @@ -84,6 +84,31 @@ "set_only_once": 0, "unique": 0 }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "mins_to_first_response", + "fieldtype": "Float", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Mins to First Response", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, { "allow_on_submit": 0, "bold": 0, @@ -137,7 +162,7 @@ }, { "allow_on_submit": 0, - "bold": 0, + "bold": 1, "collapsible": 0, "depends_on": "eval:doc.__islocal", "fieldname": "raised_by", @@ -217,7 +242,7 @@ }, { "allow_on_submit": 0, - "bold": 0, + "bold": 1, "collapsible": 0, "depends_on": "", "fieldname": "description", @@ -677,13 +702,14 @@ "hide_toolbar": 0, "icon": "icon-ticket", "idx": 7, + "image_view": 0, "in_create": 0, "in_dialog": 0, "is_submittable": 0, "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2016-06-04 16:01:15.860333", + "modified": "2016-06-14 15:38:50.458873", "modified_by": "Administrator", "module": "Support", "name": "Issue",