From 97b3f750c99caa7f2714ff952cba47ecae089553 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Tue, 14 Jul 2015 10:13:12 +0530 Subject: [PATCH 1/2] [fixes] hours in time-log #3644, project buttons on condition, removed Guest permission in notification_control --- erpnext/projects/doctype/project/project.js | 41 +++++++++++-------- erpnext/projects/doctype/time_log/time_log.js | 4 +- .../notification_control.json | 9 +--- 3 files changed, 27 insertions(+), 27 deletions(-) diff --git a/erpnext/projects/doctype/project/project.js b/erpnext/projects/doctype/project/project.js index aa55876654..8999f85cdb 100644 --- a/erpnext/projects/doctype/project/project.js +++ b/erpnext/projects/doctype/project/project.js @@ -26,22 +26,29 @@ frappe.ui.form.on("Project Task", "edit_task", function(frm, doctype, name) { // show tasks cur_frm.cscript.refresh = function(doc) { if(!doc.__islocal) { - cur_frm.add_custom_button(__("Gantt Chart"), function() { - frappe.route_options = {"project": doc.name, "start": doc.expected_start_date, "end": doc.expected_end_date}; - frappe.set_route("Gantt", "Task"); - }, "icon-tasks", true); - cur_frm.add_custom_button(__("Tasks"), function() { - frappe.route_options = {"project": doc.name} - frappe.set_route("List", "Task"); - }, "icon-list", true); - cur_frm.add_custom_button(__("Time Logs"), function() { - frappe.route_options = {"project": doc.name} - frappe.set_route("List", "Time Log"); - }, "icon-list", true); - cur_frm.add_custom_button(__("Expense Claims"), function() { - frappe.route_options = {"project": doc.name} - frappe.set_route("List", "Expense Claim"); - }, "icon-list", true); + if(frappe.model.can_read("Task")) { + cur_frm.add_custom_button(__("Gantt Chart"), function() { + frappe.route_options = {"project": doc.name, "start": doc.expected_start_date, "end": doc.expected_end_date}; + frappe.set_route("Gantt", "Task"); + }, "icon-tasks", true); + cur_frm.add_custom_button(__("Tasks"), function() { + frappe.route_options = {"project": doc.name} + frappe.set_route("List", "Task"); + }, "icon-list", true); + } + if(frappe.model.can_read("Time Log")) { + cur_frm.add_custom_button(__("Time Logs"), function() { + frappe.route_options = {"project": doc.name} + frappe.set_route("List", "Time Log"); + }, "icon-list", true); + } + + if(frappe.model.can_read("Expense Claim")) { + cur_frm.add_custom_button(__("Expense Claims"), function() { + frappe.route_options = {"project": doc.name} + frappe.set_route("List", "Expense Claim"); + }, "icon-list", true); + } } } @@ -56,5 +63,5 @@ cur_frm.fields_dict['sales_order'].get_query = function(doc) { filters:{ 'project_name': doc.name } - } + } } diff --git a/erpnext/projects/doctype/time_log/time_log.js b/erpnext/projects/doctype/time_log/time_log.js index 536ddf8c9c..776a75b3cc 100644 --- a/erpnext/projects/doctype/time_log/time_log.js +++ b/erpnext/projects/doctype/time_log/time_log.js @@ -42,7 +42,7 @@ frappe.ui.form.on("Time Log", "before_save", function(frm) { frappe.ui.form.on("Time Log", "to_time", function(frm) { if(frm._setting_hours) return; frm.set_value("hours", moment(cur_frm.doc.to_time).diff(moment(cur_frm.doc.from_time), - "hours")); + "minutes") / 60); }); @@ -98,5 +98,5 @@ cur_frm.fields_dict['task'].get_query = function(doc) { filters:{ 'project': doc.project } - } + } } diff --git a/erpnext/setup/doctype/notification_control/notification_control.json b/erpnext/setup/doctype/notification_control/notification_control.json index f81801d95b..a77fe679e3 100644 --- a/erpnext/setup/doctype/notification_control/notification_control.json +++ b/erpnext/setup/doctype/notification_control/notification_control.json @@ -176,19 +176,12 @@ "icon": "icon-envelope", "idx": 1, "issingle": 1, - "modified": "2015-03-04 01:13:46.715113", + "modified": "2015-07-13 06:24:05.436127", "modified_by": "Administrator", "module": "Setup", "name": "Notification Control", "owner": "Administrator", "permissions": [ - { - "create": 0, - "permlevel": 0, - "read": 1, - "role": "Guest", - "write": 0 - }, { "create": 1, "permlevel": 0, From a87dc3b4e69d63a3e96d9c8f1b2693748b798fd1 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Tue, 14 Jul 2015 10:22:07 +0530 Subject: [PATCH 2/2] [minor] move position in accounts settings --- .../accounts_settings/accounts_settings.json | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/erpnext/accounts/doctype/accounts_settings/accounts_settings.json b/erpnext/accounts/doctype/accounts_settings/accounts_settings.json index 231c8ab874..cdb32dc1d0 100644 --- a/erpnext/accounts/doctype/accounts_settings/accounts_settings.json +++ b/erpnext/accounts/doctype/accounts_settings/accounts_settings.json @@ -4,13 +4,6 @@ "docstatus": 0, "doctype": "DocType", "fields": [ - { - "fieldname": "check_supplier_invoice_uniqueness", - "fieldtype": "Check", - "label": "Check Supplier Invoice Number Uniqueness", - "permlevel": 0, - "precision": "" - }, { "default": "1", "description": "If enabled, the system will post accounting entries for inventory automatically.", @@ -45,12 +38,19 @@ "label": "Credit Controller", "options": "Role", "permlevel": 0 + }, + { + "fieldname": "check_supplier_invoice_uniqueness", + "fieldtype": "Check", + "label": "Check Supplier Invoice Number Uniqueness", + "permlevel": 0, + "precision": "" } ], "icon": "icon-cog", "idx": 1, "issingle": 1, - "modified": "2015-06-11 06:06:34.047890", + "modified": "2015-07-14 00:51:48.095525", "modified_by": "Administrator", "module": "Accounts", "name": "Accounts Settings",