[cleanup] link dashboard for customer, supplier, item, employee and hide form by default

This commit is contained in:
Rushabh Mehta
2016-04-13 17:21:57 +05:30
parent 4b09f48d94
commit 0e2dd859b0
16 changed files with 166 additions and 49 deletions

View File

@@ -3,10 +3,11 @@
frappe.ui.form.on("Supplier", { frappe.ui.form.on("Supplier", {
before_load: function(frm) { before_load: function(frm) {
frm.hide_first = true;
frappe.setup_language_field(frm); frappe.setup_language_field(frm);
}, },
refresh: function(frm) { refresh: function(frm) {
frm.dashboard.show_documents(); frm.dashboard.show_links();
if(frappe.defaults.get_default("supp_master_name")!="Naming Series") { if(frappe.defaults.get_default("supp_master_name")!="Naming Series") {
frm.toggle_display("naming_series", false); frm.toggle_display("naming_series", false);

View File

@@ -13,7 +13,7 @@
{ {
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 1, "collapsible": 0,
"fieldname": "basic_info", "fieldname": "basic_info",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@@ -421,7 +421,7 @@
{ {
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 1, "collapsible": 0,
"depends_on": "eval:!doc.__islocal", "depends_on": "eval:!doc.__islocal",
"fieldname": "address_contacts", "fieldname": "address_contacts",
"fieldtype": "Section Break", "fieldtype": "Section Break",
@@ -685,7 +685,7 @@
"issingle": 0, "issingle": 0,
"istable": 0, "istable": 0,
"max_attachments": 0, "max_attachments": 0,
"modified": "2016-04-11 08:01:21.188319", "modified": "2016-04-13 05:47:43.797061",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Buying", "module": "Buying",
"name": "Supplier", "name": "Supplier",

View File

@@ -5,7 +5,7 @@ links = {
'transactions': [ 'transactions': [
{ {
'label': _('Procurement'), 'label': _('Procurement'),
'items': ['Material Request', 'Request for Quotation', 'Supplier Quotation'] 'items': ['Request for Quotation', 'Supplier Quotation']
}, },
{ {
'label': _('Orders'), 'label': _('Orders'),

View File

@@ -3,38 +3,109 @@ from frappe import _
def get_data(): def get_data():
return [ 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", "module_name": "Accounts",
"color": "#3498db", "color": "#3498db",
"icon": "octicon octicon-repo", "icon": "octicon octicon-repo",
"type": "module" "type": "module",
"hidden": 1
}, },
{ {
"module_name": "Stock", "module_name": "Stock",
"color": "#f39c12", "color": "#f39c12",
"icon": "icon-truck", "icon": "icon-truck",
"icon": "octicon octicon-package", "icon": "octicon octicon-package",
"type": "module" "type": "module",
"hidden": 1
}, },
{ {
"module_name": "CRM", "module_name": "CRM",
"color": "#EF4DB6", "color": "#EF4DB6",
"icon": "octicon octicon-broadcast", "icon": "octicon octicon-broadcast",
"type": "module" "type": "module",
"hidden": 1
}, },
{ {
"module_name": "Selling", "module_name": "Selling",
"color": "#1abc9c", "color": "#1abc9c",
"icon": "icon-tag", "icon": "icon-tag",
"icon": "octicon octicon-tag", "icon": "octicon octicon-tag",
"type": "module" "type": "module",
"hidden": 1
}, },
{ {
"module_name": "Buying", "module_name": "Buying",
"color": "#c0392b", "color": "#c0392b",
"icon": "icon-shopping-cart", "icon": "icon-shopping-cart",
"icon": "octicon octicon-briefcase", "icon": "octicon octicon-briefcase",
"type": "module" "type": "module",
"hidden": 1
}, },
{ {
"module_name": "HR", "module_name": "HR",
@@ -42,14 +113,16 @@ def get_data():
"icon": "icon-group", "icon": "icon-group",
"icon": "octicon octicon-organization", "icon": "octicon octicon-organization",
"label": _("Human Resources"), "label": _("Human Resources"),
"type": "module" "type": "module",
"hidden": 1
}, },
{ {
"module_name": "Manufacturing", "module_name": "Manufacturing",
"color": "#7f8c8d", "color": "#7f8c8d",
"icon": "icon-cogs", "icon": "icon-cogs",
"icon": "octicon octicon-tools", "icon": "octicon octicon-tools",
"type": "module" "type": "module",
"hidden": 1
}, },
{ {
"module_name": "POS", "module_name": "POS",
@@ -58,21 +131,24 @@ def get_data():
"icon": "octicon octicon-credit-card", "icon": "octicon octicon-credit-card",
"type": "page", "type": "page",
"link": "pos", "link": "pos",
"label": _("POS") "label": _("POS"),
"hidden": 1
}, },
{ {
"module_name": "Projects", "module_name": "Projects",
"color": "#8e44ad", "color": "#8e44ad",
"icon": "icon-puzzle-piece", "icon": "icon-puzzle-piece",
"icon": "octicon octicon-rocket", "icon": "octicon octicon-rocket",
"type": "module" "type": "module",
"hidden": 1
}, },
{ {
"module_name": "Support", "module_name": "Support",
"color": "#2c3e50", "color": "#2c3e50",
"icon": "icon-phone", "icon": "icon-phone",
"icon": "octicon octicon-issue-opened", "icon": "octicon octicon-issue-opened",
"type": "module" "type": "module",
"hidden": 1
}, },
{ {
"module_name": "Learn", "module_name": "Learn",
@@ -80,6 +156,7 @@ def get_data():
"icon": "octicon octicon-device-camera-video", "icon": "octicon octicon-device-camera-video",
"type": "module", "type": "module",
"is_help": True, "is_help": True,
"label": _("Learn") "label": _("Learn"),
"hidden": 1
} }
] ]

View File

@@ -38,7 +38,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"description": "Select template from which you want to get the Goals", "description": "",
"fieldname": "kra_template", "fieldname": "kra_template",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@@ -67,7 +67,7 @@
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"depends_on": "kra_template", "depends_on": "kra_template",
"description": "Select the Employee for whom you are creating the Appraisal.", "description": "",
"fieldname": "employee", "fieldname": "employee",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@@ -276,7 +276,7 @@
"print_hide_if_no_value": 0, "print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 1,
"search_index": 0, "search_index": 0,
"set_only_once": 0, "set_only_once": 0,
"unique": 0 "unique": 0
@@ -497,7 +497,7 @@
"issingle": 0, "issingle": 0,
"istable": 0, "istable": 0,
"max_attachments": 0, "max_attachments": 0,
"modified": "2016-03-04 02:08:11.258389", "modified": "2016-04-13 01:49:09.748819",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "HR", "module": "HR",
"name": "Appraisal", "name": "Appraisal",
@@ -570,5 +570,6 @@
"sort_field": "modified", "sort_field": "modified",
"sort_order": "DESC", "sort_order": "DESC",
"timeline_field": "employee", "timeline_field": "employee",
"title_field": "employee_name" "title_field": "employee_name",
"track_seen": 0
} }

View File

@@ -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) {
}
});

View File

@@ -17,6 +17,7 @@
"fieldtype": "Data", "fieldtype": "Data",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 1, "in_list_view": 1,
"label": "Appraisal Template Title", "label": "Appraisal Template Title",
@@ -26,6 +27,7 @@
"oldfieldtype": "Data", "oldfieldtype": "Data",
"permlevel": 0, "permlevel": 0,
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 1, "reqd": 1,
@@ -41,6 +43,7 @@
"fieldtype": "Small Text", "fieldtype": "Small Text",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 1, "in_list_view": 1,
"label": "Description", "label": "Description",
@@ -50,6 +53,7 @@
"oldfieldtype": "Small Text", "oldfieldtype": "Small Text",
"permlevel": 0, "permlevel": 0,
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0,
"print_width": "300px", "print_width": "300px",
"read_only": 0, "read_only": 0,
"report_hide": 0, "report_hide": 0,
@@ -67,6 +71,7 @@
"fieldtype": "Table", "fieldtype": "Table",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"label": "Goals", "label": "Goals",
@@ -77,9 +82,10 @@
"options": "Appraisal Template Goal", "options": "Appraisal Template Goal",
"permlevel": 0, "permlevel": 0,
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 1,
"search_index": 0, "search_index": 0,
"set_only_once": 0, "set_only_once": 0,
"unique": 0 "unique": 0
@@ -95,7 +101,7 @@
"issingle": 0, "issingle": 0,
"istable": 0, "istable": 0,
"max_attachments": 0, "max_attachments": 0,
"modified": "2015-11-16 06:29:41.974626", "modified": "2016-04-13 01:49:21.815151",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "HR", "module": "HR",
"name": "Appraisal Template", "name": "Appraisal Template",
@@ -123,5 +129,7 @@
} }
], ],
"read_only": 0, "read_only": 0,
"read_only_onload": 0 "read_only_onload": 0,
"sort_order": "DESC",
"track_seen": 0
} }

View File

@@ -4,6 +4,7 @@
frappe.provide("erpnext.hr"); frappe.provide("erpnext.hr");
erpnext.hr.EmployeeController = frappe.ui.form.Controller.extend({ erpnext.hr.EmployeeController = frappe.ui.form.Controller.extend({
setup: function() { setup: function() {
this.frm.hide_first = true;
this.frm.fields_dict.user_id.get_query = function(doc, cdt, cdn) { this.frm.fields_dict.user_id.get_query = function(doc, cdt, cdn) {
return { query:"frappe.core.doctype.user.user.user_query"} } return { query:"frappe.core.doctype.user.user.user_query"} }
this.frm.fields_dict.reports_to.get_query = function(doc, cdt, cdn) { 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() { refresh: function() {
var me = this; var me = this;
erpnext.toggle_naming_series(); erpnext.toggle_naming_series();
if(!this.frm.doc.__islocal && this.frm.doc.__onload && this.frm.dashboard.show_links();
!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"));
}
}, },
date_of_birth: function() { date_of_birth: function() {

View File

@@ -4,7 +4,7 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe 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.model.naming import make_autoname
from frappe import throw, _ from frappe import throw, _
import frappe.permissions import frappe.permissions
@@ -19,8 +19,7 @@ class EmployeeUserDisabledError(frappe.ValidationError):
class Employee(Document): class Employee(Document):
def onload(self): def onload(self):
self.get("__onload").salary_structure_exists = frappe.db.get_value("Salary Structure", self.set_onload('links', self.meta.get_links_setup())
{"employee": self.name, "is_active": "Yes", "docstatus": ["!=", 2]})
def autoname(self): def autoname(self):
naming_method = frappe.db.get_value("HR Settings", None, "emp_created_by") naming_method = frappe.db.get_value("HR Settings", None, "emp_created_by")

View File

@@ -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']
}
]
}

View File

@@ -3,10 +3,11 @@
frappe.ui.form.on("Customer", { frappe.ui.form.on("Customer", {
before_load: function(frm) { before_load: function(frm) {
frm.hide_first = true;
frappe.setup_language_field(frm); frappe.setup_language_field(frm);
}, },
refresh: function(frm) { refresh: function(frm) {
frm.dashboard.show_documents(); frm.dashboard.show_links();
if(frappe.defaults.get_default("cust_master_name")!="Naming Series") { if(frappe.defaults.get_default("cust_master_name")!="Naming Series") {
frm.toggle_display("naming_series", false); frm.toggle_display("naming_series", false);

View File

@@ -13,7 +13,7 @@
{ {
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 1, "collapsible": 0,
"fieldname": "basic_info", "fieldname": "basic_info",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@@ -452,7 +452,7 @@
{ {
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 1, "collapsible": 0,
"depends_on": "eval:!doc.__islocal", "depends_on": "eval:!doc.__islocal",
"fieldname": "address_contacts", "fieldname": "address_contacts",
"fieldtype": "Section Break", "fieldtype": "Section Break",
@@ -954,7 +954,7 @@
"issingle": 0, "issingle": 0,
"istable": 0, "istable": 0,
"max_attachments": 0, "max_attachments": 0,
"modified": "2016-04-11 08:00:08.829976", "modified": "2016-04-13 05:46:36.473341",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Selling", "module": "Selling",
"name": "Customer", "name": "Customer",

View File

@@ -5,7 +5,7 @@ links = {
'transactions': [ 'transactions': [
{ {
'label': _('Pre Sales'), 'label': _('Pre Sales'),
'items': ['Lead', 'Opportunity', 'Quotation'] 'items': ['Opportunity', 'Quotation']
}, },
{ {
'label': _('Orders'), 'label': _('Orders'),

View File

@@ -18,15 +18,13 @@ erpnext.selling.QuotationController = erpnext.selling.SellingController.extend({
this._super(doc, dt, dn); this._super(doc, dt, dn);
if(doc.docstatus == 1 && doc.status!=='Lost') { if(doc.docstatus == 1 && doc.status!=='Lost') {
cur_frm.add_custom_button(__('Sales Order'), cur_frm.add_custom_button(__('Make Sales Order'),
cur_frm.cscript['Make Sales Order'], __("Make")); cur_frm.cscript['Make Sales Order']);
if(doc.status!=="Ordered") { if(doc.status!=="Ordered") {
cur_frm.add_custom_button(__('Lost'), cur_frm.add_custom_button(__('Set as Lost'),
cur_frm.cscript['Declare Order Lost'], __("Status")); cur_frm.cscript['Declare Order Lost']);
} }
cur_frm.page.set_inner_btn_group_as_primary(__("Make"));
} }
if (this.frm.doc.docstatus===0) { if (this.frm.doc.docstatus===0) {

View File

@@ -5,6 +5,7 @@ frappe.provide("erpnext.item");
frappe.ui.form.on("Item", { frappe.ui.form.on("Item", {
onload: function(frm) { onload: function(frm) {
frm.hide_first = true;
erpnext.item.setup_queries(frm); erpnext.item.setup_queries(frm);
if (frm.doc.variant_of){ if (frm.doc.variant_of){
frm.fields_dict["attributes"].grid.set_column_disp("attribute_value", true); 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); erpnext.item.toggle_attributes(frm);
frm.dashboard.show_documents(); frm.dashboard.show_links();
}, },
validate: function(frm){ validate: function(frm){

View File

@@ -8,8 +8,8 @@ links = {
}, },
'transactions': [ 'transactions': [
{ {
'label': _('Related'), 'label': _('Groups'),
'items': ['BOM', 'Product Bundle', 'Serial No', 'Batch'] 'items': ['BOM', 'Product Bundle']
}, },
{ {
'label': _('Pricing'), 'label': _('Pricing'),
@@ -24,6 +24,10 @@ links = {
'items': ['Material Request', 'Supplier Quotation', 'Request for Quotation', 'items': ['Material Request', 'Supplier Quotation', 'Request for Quotation',
'Purchase Order', 'Purchase Invoice'] 'Purchase Order', 'Purchase Invoice']
}, },
{
'label': _('Traceability'),
'items': ['Serial No', 'Batch']
},
{ {
'label': _('Move'), 'label': _('Move'),
'items': ['Stock Entry'] 'items': ['Stock Entry']