From 0e2dd859b09782065bf39405a056a12108a1811a Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Wed, 13 Apr 2016 17:21:57 +0530 Subject: [PATCH] [cleanup] link dashboard for customer, supplier, item, employee and hide form by default --- erpnext/buying/doctype/supplier/supplier.js | 3 +- erpnext/buying/doctype/supplier/supplier.json | 6 +- .../buying/doctype/supplier/supplier_links.py | 2 +- erpnext/config/desktop.py | 99 ++++++++++++++++--- erpnext/hr/doctype/appraisal/appraisal.json | 11 ++- .../appraisal_template/appraisal_template.js | 8 ++ .../appraisal_template.json | 14 ++- erpnext/hr/doctype/employee/employee.js | 8 +- erpnext/hr/doctype/employee/employee.py | 5 +- erpnext/hr/doctype/employee/employee_links.py | 23 +++++ erpnext/selling/doctype/customer/customer.js | 3 +- .../selling/doctype/customer/customer.json | 6 +- .../doctype/customer/customer_links.py | 2 +- .../selling/doctype/quotation/quotation.js | 14 ++- erpnext/stock/doctype/item/item.js | 3 +- erpnext/stock/doctype/item/item_links.py | 8 +- 16 files changed, 166 insertions(+), 49 deletions(-) create mode 100644 erpnext/hr/doctype/appraisal_template/appraisal_template.js create mode 100644 erpnext/hr/doctype/employee/employee_links.py diff --git a/erpnext/buying/doctype/supplier/supplier.js b/erpnext/buying/doctype/supplier/supplier.js index a4896f1f0e..0b8b8efbe5 100644 --- a/erpnext/buying/doctype/supplier/supplier.js +++ b/erpnext/buying/doctype/supplier/supplier.js @@ -3,10 +3,11 @@ frappe.ui.form.on("Supplier", { before_load: function(frm) { + frm.hide_first = true; frappe.setup_language_field(frm); }, refresh: function(frm) { - frm.dashboard.show_documents(); + frm.dashboard.show_links(); if(frappe.defaults.get_default("supp_master_name")!="Naming Series") { frm.toggle_display("naming_series", false); diff --git a/erpnext/buying/doctype/supplier/supplier.json b/erpnext/buying/doctype/supplier/supplier.json index f505061cbb..26a2c98959 100644 --- a/erpnext/buying/doctype/supplier/supplier.json +++ b/erpnext/buying/doctype/supplier/supplier.json @@ -13,7 +13,7 @@ { "allow_on_submit": 0, "bold": 0, - "collapsible": 1, + "collapsible": 0, "fieldname": "basic_info", "fieldtype": "Section Break", "hidden": 0, @@ -421,7 +421,7 @@ { "allow_on_submit": 0, "bold": 0, - "collapsible": 1, + "collapsible": 0, "depends_on": "eval:!doc.__islocal", "fieldname": "address_contacts", "fieldtype": "Section Break", @@ -685,7 +685,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2016-04-11 08:01:21.188319", + "modified": "2016-04-13 05:47:43.797061", "modified_by": "Administrator", "module": "Buying", "name": "Supplier", diff --git a/erpnext/buying/doctype/supplier/supplier_links.py b/erpnext/buying/doctype/supplier/supplier_links.py index 8986eca2b9..10cf3fa8aa 100644 --- a/erpnext/buying/doctype/supplier/supplier_links.py +++ b/erpnext/buying/doctype/supplier/supplier_links.py @@ -5,7 +5,7 @@ links = { 'transactions': [ { 'label': _('Procurement'), - 'items': ['Material Request', 'Request for Quotation', 'Supplier Quotation'] + 'items': ['Request for Quotation', 'Supplier Quotation'] }, { 'label': _('Orders'), diff --git a/erpnext/config/desktop.py b/erpnext/config/desktop.py index e15f2b6a5f..a3cb5d4961 100644 --- a/erpnext/config/desktop.py +++ b/erpnext/config/desktop.py @@ -3,38 +3,109 @@ from frappe import _ def get_data(): return [ + { + "module_name": "Item", + "_doctype": "Item", + "color": "#f39c12", + "icon": "octicon octicon-package", + "type": "link", + "link": "List/Item" + }, + { + "module_name": "Customer", + "_doctype": "Customer", + "color": "#1abc9c", + "icon": "octicon octicon-tag", + "type": "link", + "link": "List/Customer" + }, + { + "module_name": "Supplier", + "_doctype": "Supplier", + "color": "#c0392b", + "icon": "octicon octicon-briefcase", + "type": "link", + "link": "List/Supplier" + }, + { + "module_name": "Income Statement", + "_doctype": "Account", + "color": "#3498db", + "icon": "octicon octicon-repo", + "type": "link", + "link": "query-report/Profit and Loss Statement" + }, + { + "_doctype": "Employee", + "module_name": "Employee", + "color": "#2ecc71", + "icon": "octicon octicon-organization", + "type": "link", + "link": "List/Employee" + }, + { + "module_name": "Project", + "_doctype": "Project", + "color": "#8e44ad", + "icon": "octicon octicon-rocket", + "type": "link", + "link": "List/Project" + }, + { + "module_name": "Issue", + "color": "#2c3e50", + "icon": "octicon octicon-issue-opened", + "_doctype": "Issue", + "type": "link", + "link": "List/Issue" + }, + { + "module_name": "Lead", + "icon": "octicon octicon-broadcast", + "type": "module", + "_doctype": "Lead", + "type": "link", + "link": "List/Lead" + }, + + # old { "module_name": "Accounts", "color": "#3498db", "icon": "octicon octicon-repo", - "type": "module" + "type": "module", + "hidden": 1 }, { "module_name": "Stock", "color": "#f39c12", "icon": "icon-truck", "icon": "octicon octicon-package", - "type": "module" + "type": "module", + "hidden": 1 }, { "module_name": "CRM", "color": "#EF4DB6", "icon": "octicon octicon-broadcast", - "type": "module" + "type": "module", + "hidden": 1 }, { "module_name": "Selling", "color": "#1abc9c", "icon": "icon-tag", "icon": "octicon octicon-tag", - "type": "module" + "type": "module", + "hidden": 1 }, { "module_name": "Buying", "color": "#c0392b", "icon": "icon-shopping-cart", "icon": "octicon octicon-briefcase", - "type": "module" + "type": "module", + "hidden": 1 }, { "module_name": "HR", @@ -42,14 +113,16 @@ def get_data(): "icon": "icon-group", "icon": "octicon octicon-organization", "label": _("Human Resources"), - "type": "module" + "type": "module", + "hidden": 1 }, { "module_name": "Manufacturing", "color": "#7f8c8d", "icon": "icon-cogs", "icon": "octicon octicon-tools", - "type": "module" + "type": "module", + "hidden": 1 }, { "module_name": "POS", @@ -58,21 +131,24 @@ def get_data(): "icon": "octicon octicon-credit-card", "type": "page", "link": "pos", - "label": _("POS") + "label": _("POS"), + "hidden": 1 }, { "module_name": "Projects", "color": "#8e44ad", "icon": "icon-puzzle-piece", "icon": "octicon octicon-rocket", - "type": "module" + "type": "module", + "hidden": 1 }, { "module_name": "Support", "color": "#2c3e50", "icon": "icon-phone", "icon": "octicon octicon-issue-opened", - "type": "module" + "type": "module", + "hidden": 1 }, { "module_name": "Learn", @@ -80,6 +156,7 @@ def get_data(): "icon": "octicon octicon-device-camera-video", "type": "module", "is_help": True, - "label": _("Learn") + "label": _("Learn"), + "hidden": 1 } ] diff --git a/erpnext/hr/doctype/appraisal/appraisal.json b/erpnext/hr/doctype/appraisal/appraisal.json index e353e34fb0..3ca987bf13 100644 --- a/erpnext/hr/doctype/appraisal/appraisal.json +++ b/erpnext/hr/doctype/appraisal/appraisal.json @@ -38,7 +38,7 @@ "allow_on_submit": 0, "bold": 0, "collapsible": 0, - "description": "Select template from which you want to get the Goals", + "description": "", "fieldname": "kra_template", "fieldtype": "Link", "hidden": 0, @@ -67,7 +67,7 @@ "bold": 0, "collapsible": 0, "depends_on": "kra_template", - "description": "Select the Employee for whom you are creating the Appraisal.", + "description": "", "fieldname": "employee", "fieldtype": "Link", "hidden": 0, @@ -276,7 +276,7 @@ "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, - "reqd": 0, + "reqd": 1, "search_index": 0, "set_only_once": 0, "unique": 0 @@ -497,7 +497,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2016-03-04 02:08:11.258389", + "modified": "2016-04-13 01:49:09.748819", "modified_by": "Administrator", "module": "HR", "name": "Appraisal", @@ -570,5 +570,6 @@ "sort_field": "modified", "sort_order": "DESC", "timeline_field": "employee", - "title_field": "employee_name" + "title_field": "employee_name", + "track_seen": 0 } \ No newline at end of file diff --git a/erpnext/hr/doctype/appraisal_template/appraisal_template.js b/erpnext/hr/doctype/appraisal_template/appraisal_template.js new file mode 100644 index 0000000000..cc772927f8 --- /dev/null +++ b/erpnext/hr/doctype/appraisal_template/appraisal_template.js @@ -0,0 +1,8 @@ +// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Appraisal Template', { + refresh: function(frm) { + + } +}); diff --git a/erpnext/hr/doctype/appraisal_template/appraisal_template.json b/erpnext/hr/doctype/appraisal_template/appraisal_template.json index 4903c585ab..4ecd838d45 100644 --- a/erpnext/hr/doctype/appraisal_template/appraisal_template.json +++ b/erpnext/hr/doctype/appraisal_template/appraisal_template.json @@ -17,6 +17,7 @@ "fieldtype": "Data", "hidden": 0, "ignore_user_permissions": 0, + "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 1, "label": "Appraisal Template Title", @@ -26,6 +27,7 @@ "oldfieldtype": "Data", "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 1, @@ -41,6 +43,7 @@ "fieldtype": "Small Text", "hidden": 0, "ignore_user_permissions": 0, + "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 1, "label": "Description", @@ -50,6 +53,7 @@ "oldfieldtype": "Small Text", "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "print_width": "300px", "read_only": 0, "report_hide": 0, @@ -67,6 +71,7 @@ "fieldtype": "Table", "hidden": 0, "ignore_user_permissions": 0, + "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, "label": "Goals", @@ -77,9 +82,10 @@ "options": "Appraisal Template Goal", "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, - "reqd": 0, + "reqd": 1, "search_index": 0, "set_only_once": 0, "unique": 0 @@ -95,7 +101,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2015-11-16 06:29:41.974626", + "modified": "2016-04-13 01:49:21.815151", "modified_by": "Administrator", "module": "HR", "name": "Appraisal Template", @@ -123,5 +129,7 @@ } ], "read_only": 0, - "read_only_onload": 0 + "read_only_onload": 0, + "sort_order": "DESC", + "track_seen": 0 } \ No newline at end of file diff --git a/erpnext/hr/doctype/employee/employee.js b/erpnext/hr/doctype/employee/employee.js index 0fedfd6e61..5c241fb6c6 100755 --- a/erpnext/hr/doctype/employee/employee.js +++ b/erpnext/hr/doctype/employee/employee.js @@ -4,6 +4,7 @@ frappe.provide("erpnext.hr"); erpnext.hr.EmployeeController = frappe.ui.form.Controller.extend({ setup: function() { + this.frm.hide_first = true; this.frm.fields_dict.user_id.get_query = function(doc, cdt, cdn) { return { query:"frappe.core.doctype.user.user.user_query"} } this.frm.fields_dict.reports_to.get_query = function(doc, cdt, cdn) { @@ -24,12 +25,7 @@ erpnext.hr.EmployeeController = frappe.ui.form.Controller.extend({ refresh: function() { var me = this; erpnext.toggle_naming_series(); - if(!this.frm.doc.__islocal && this.frm.doc.__onload && - !this.frm.doc.__onload.salary_structure_exists) { - cur_frm.add_custom_button(__('Salary Structure'), function() { - me.make_salary_structure(this); }, __("Make")); - cur_frm.page.set_inner_btn_group_as_primary(__("Make")); - } + this.frm.dashboard.show_links(); }, date_of_birth: function() { diff --git a/erpnext/hr/doctype/employee/employee.py b/erpnext/hr/doctype/employee/employee.py index 446b5857f9..e769e3e818 100755 --- a/erpnext/hr/doctype/employee/employee.py +++ b/erpnext/hr/doctype/employee/employee.py @@ -4,7 +4,7 @@ from __future__ import unicode_literals import frappe -from frappe.utils import getdate, validate_email_add, today, get_gravatar +from frappe.utils import getdate, validate_email_add, today from frappe.model.naming import make_autoname from frappe import throw, _ import frappe.permissions @@ -19,8 +19,7 @@ class EmployeeUserDisabledError(frappe.ValidationError): class Employee(Document): def onload(self): - self.get("__onload").salary_structure_exists = frappe.db.get_value("Salary Structure", - {"employee": self.name, "is_active": "Yes", "docstatus": ["!=", 2]}) + self.set_onload('links', self.meta.get_links_setup()) def autoname(self): naming_method = frappe.db.get_value("HR Settings", None, "emp_created_by") diff --git a/erpnext/hr/doctype/employee/employee_links.py b/erpnext/hr/doctype/employee/employee_links.py new file mode 100644 index 0000000000..0e13c31ccc --- /dev/null +++ b/erpnext/hr/doctype/employee/employee_links.py @@ -0,0 +1,23 @@ +from frappe import _ + +links = { + 'fieldname': 'employee', + 'transactions': [ + { + 'label': _('Leave and Attendance'), + 'items': ['Attendance', 'Leave Application', 'Leave Allocation'] + }, + { + 'label': _('Payroll'), + 'items': ['Salary Structure', 'Salary Slip'] + }, + { + 'label': _('Expense'), + 'items': ['Expense Claim'] + }, + { + 'label': _('Evaluation'), + 'items': ['Appraisal'] + } + ] +} \ No newline at end of file diff --git a/erpnext/selling/doctype/customer/customer.js b/erpnext/selling/doctype/customer/customer.js index 3f6ab24844..95bed474a7 100644 --- a/erpnext/selling/doctype/customer/customer.js +++ b/erpnext/selling/doctype/customer/customer.js @@ -3,10 +3,11 @@ frappe.ui.form.on("Customer", { before_load: function(frm) { + frm.hide_first = true; frappe.setup_language_field(frm); }, refresh: function(frm) { - frm.dashboard.show_documents(); + frm.dashboard.show_links(); if(frappe.defaults.get_default("cust_master_name")!="Naming Series") { frm.toggle_display("naming_series", false); diff --git a/erpnext/selling/doctype/customer/customer.json b/erpnext/selling/doctype/customer/customer.json index ddbcf5bb18..ff47a79ca4 100644 --- a/erpnext/selling/doctype/customer/customer.json +++ b/erpnext/selling/doctype/customer/customer.json @@ -13,7 +13,7 @@ { "allow_on_submit": 0, "bold": 0, - "collapsible": 1, + "collapsible": 0, "fieldname": "basic_info", "fieldtype": "Section Break", "hidden": 0, @@ -452,7 +452,7 @@ { "allow_on_submit": 0, "bold": 0, - "collapsible": 1, + "collapsible": 0, "depends_on": "eval:!doc.__islocal", "fieldname": "address_contacts", "fieldtype": "Section Break", @@ -954,7 +954,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2016-04-11 08:00:08.829976", + "modified": "2016-04-13 05:46:36.473341", "modified_by": "Administrator", "module": "Selling", "name": "Customer", diff --git a/erpnext/selling/doctype/customer/customer_links.py b/erpnext/selling/doctype/customer/customer_links.py index 9410dbe720..3ae139b439 100644 --- a/erpnext/selling/doctype/customer/customer_links.py +++ b/erpnext/selling/doctype/customer/customer_links.py @@ -5,7 +5,7 @@ links = { 'transactions': [ { 'label': _('Pre Sales'), - 'items': ['Lead', 'Opportunity', 'Quotation'] + 'items': ['Opportunity', 'Quotation'] }, { 'label': _('Orders'), diff --git a/erpnext/selling/doctype/quotation/quotation.js b/erpnext/selling/doctype/quotation/quotation.js index 3e90b97dd3..06f94fea0f 100644 --- a/erpnext/selling/doctype/quotation/quotation.js +++ b/erpnext/selling/doctype/quotation/quotation.js @@ -18,15 +18,13 @@ erpnext.selling.QuotationController = erpnext.selling.SellingController.extend({ this._super(doc, dt, dn); if(doc.docstatus == 1 && doc.status!=='Lost') { - cur_frm.add_custom_button(__('Sales Order'), - cur_frm.cscript['Make Sales Order'], __("Make")); + cur_frm.add_custom_button(__('Make Sales Order'), + cur_frm.cscript['Make Sales Order']); if(doc.status!=="Ordered") { - cur_frm.add_custom_button(__('Lost'), - cur_frm.cscript['Declare Order Lost'], __("Status")); + cur_frm.add_custom_button(__('Set as Lost'), + cur_frm.cscript['Declare Order Lost']); } - - cur_frm.page.set_inner_btn_group_as_primary(__("Make")); } if (this.frm.doc.docstatus===0) { @@ -47,7 +45,7 @@ erpnext.selling.QuotationController = erpnext.selling.SellingController.extend({ } this.toggle_reqd_lead_customer(); - + }, quotation_to: function() { @@ -166,6 +164,6 @@ frappe.ui.form.on("Quotation Item", "items_on_form_rendered", function(frm, cdt, frappe.ui.form.on("Quotation Item", "stock_balance", function(frm, cdt, cdn) { var d = frappe.model.get_doc(cdt, cdn); - frappe.route_options = {"item_code": d.item_code}; + frappe.route_options = {"item_code": d.item_code}; frappe.set_route("query-report", "Stock Balance"); }) \ No newline at end of file diff --git a/erpnext/stock/doctype/item/item.js b/erpnext/stock/doctype/item/item.js index 4df7128a6f..8a9d83c996 100644 --- a/erpnext/stock/doctype/item/item.js +++ b/erpnext/stock/doctype/item/item.js @@ -5,6 +5,7 @@ frappe.provide("erpnext.item"); frappe.ui.form.on("Item", { onload: function(frm) { + frm.hide_first = true; erpnext.item.setup_queries(frm); if (frm.doc.variant_of){ frm.fields_dict["attributes"].grid.set_column_disp("attribute_value", true); @@ -75,7 +76,7 @@ frappe.ui.form.on("Item", { erpnext.item.toggle_attributes(frm); - frm.dashboard.show_documents(); + frm.dashboard.show_links(); }, validate: function(frm){ diff --git a/erpnext/stock/doctype/item/item_links.py b/erpnext/stock/doctype/item/item_links.py index 5f76a4cf97..c1fff8c34e 100644 --- a/erpnext/stock/doctype/item/item_links.py +++ b/erpnext/stock/doctype/item/item_links.py @@ -8,8 +8,8 @@ links = { }, 'transactions': [ { - 'label': _('Related'), - 'items': ['BOM', 'Product Bundle', 'Serial No', 'Batch'] + 'label': _('Groups'), + 'items': ['BOM', 'Product Bundle'] }, { 'label': _('Pricing'), @@ -24,6 +24,10 @@ links = { 'items': ['Material Request', 'Supplier Quotation', 'Request for Quotation', 'Purchase Order', 'Purchase Invoice'] }, + { + 'label': _('Traceability'), + 'items': ['Serial No', 'Batch'] + }, { 'label': _('Move'), 'items': ['Stock Entry']