[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", {
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);

View File

@ -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",

View File

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

View File

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

View File

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

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",
"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
}

View File

@ -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() {

View File

@ -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")

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", {
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);

View File

@ -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",

View File

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

View File

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

View File

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

View File

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