Merge branch 'vjFaLk-remove-celery' into develop
diff --git a/erpnext/accounts/party_status.py b/erpnext/accounts/party_status.py
index 0c5d4c5..ff095b1 100644
--- a/erpnext/accounts/party_status.py
+++ b/erpnext/accounts/party_status.py
@@ -5,7 +5,6 @@
import frappe
-from frappe import _
from frappe.utils import evaluate_filters
from frappe.desk.notifications import get_filters_for
@@ -56,7 +55,9 @@
# may be open elsewhere, check
# default status
party.status = status
- update_status(party, )
+ update_status(party)
+
+ party.update_modified()
def get_party_status(doc):
'''return party status based on open documents'''
@@ -77,26 +78,3 @@
status = get_party_status(doc)
if doc.status != status:
doc.db_set('status', status)
-
-def get_transaction_count(doc):
- '''Return list of open documents given party doc'''
- out = []
- for doctype in status_depends_on[doc.doctype]:
- filters = get_filters_for(doctype)
- filters[doc.doctype.lower()] = doc.name
- if filters:
- open_count = frappe.get_all(doctype, fields='count(*) as count', filters=filters)[0].count
- out.append({'name': doctype, 'count': open_count})
-
- return out
-
-@frappe.whitelist()
-def get_transaction_info(party_type, party_name):
- doc = frappe.get_doc(party_type, party_name)
- if not doc.has_permission('read'):
- frappe.msgprint(_("Not permitted"), raise_exception=True)
-
- out = {}
- out['transaction_count'] = get_transaction_count(doc)
-
- return out
\ No newline at end of file
diff --git a/erpnext/buying/doctype/supplier/supplier.js b/erpnext/buying/doctype/supplier/supplier.js
index 0ad60b8..0b8b8ef 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) {
- erpnext.party.setup_dashboard(frm);
+ 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 f505061..26a2c98 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.py b/erpnext/buying/doctype/supplier/supplier.py
index dc82b4e..4b384fa 100644
--- a/erpnext/buying/doctype/supplier/supplier.py
+++ b/erpnext/buying/doctype/supplier/supplier.py
@@ -9,7 +9,7 @@
from erpnext.utilities.address_and_contact import load_address_and_contact
from erpnext.utilities.transaction_base import TransactionBase
from erpnext.accounts.party import validate_party_accounts
-from erpnext.accounts.party_status import get_transaction_count, get_party_status, status_depends_on
+from erpnext.accounts.party_status import get_party_status
class Supplier(TransactionBase):
def get_feed(self):
@@ -18,7 +18,7 @@
def onload(self):
"""Load address and contacts in `__onload`"""
load_address_and_contact(self, "supplier")
- self.set_onload('transactions', status_depends_on[self.doctype])
+ self.set_onload('links', self.meta.get_links_setup())
def autoname(self):
supp_master_name = frappe.defaults.get_global_default('supp_master_name')
@@ -84,30 +84,3 @@
frappe.db.sql("""update `tabAddress` set address_title=%(newdn)s
{set_field} where supplier=%(newdn)s"""\
.format(set_field=set_field), ({"newdn": newdn}))
-
-# @frappe.whitelist()
-# def get_dashboard_info(supplier):
-# doc = frappe.get_doc('Supplier', supplier)
-# if not doc.has_permission('read'):
-# frappe.msgprint(_("Not permitted"), raise_exception=True)
-#
-# out = {}
-# out['transaction_count'] = get_transaction_count(doc)
-#
-# billing_this_year = frappe.db.sql("""
-# select sum(credit_in_account_currency) - sum(debit_in_account_currency)
-# from `tabGL Entry`
-# where voucher_type='Purchase Invoice' and party_type = 'Supplier'
-# and party=%s and fiscal_year = %s""",
-# (supplier, frappe.db.get_default("fiscal_year")))
-#
-# total_unpaid = frappe.db.sql("""select sum(outstanding_amount)
-# from `tabPurchase Invoice`
-# where supplier=%s and docstatus = 1""", supplier)
-#
-#
-# out["billing_this_year"] = billing_this_year[0][0] if billing_this_year else 0
-# out["total_unpaid"] = total_unpaid[0][0] if total_unpaid else 0
-# out["company_currency"] = frappe.db.sql_list("select distinct default_currency from tabCompany")
-#
-# return out
diff --git a/erpnext/buying/doctype/supplier/supplier_links.py b/erpnext/buying/doctype/supplier/supplier_links.py
new file mode 100644
index 0000000..10cf3fa
--- /dev/null
+++ b/erpnext/buying/doctype/supplier/supplier_links.py
@@ -0,0 +1,15 @@
+from frappe import _
+
+links = {
+ 'fieldname': 'supplier',
+ 'transactions': [
+ {
+ 'label': _('Procurement'),
+ 'items': ['Request for Quotation', 'Supplier Quotation']
+ },
+ {
+ 'label': _('Orders'),
+ 'items': ['Purchase Order', 'Purchase Receipt', 'Purchase Invoice']
+ }
+ ]
+}
\ No newline at end of file
diff --git a/erpnext/config/desktop.py b/erpnext/config/desktop.py
index e15f2b6..a3cb5d4 100644
--- a/erpnext/config/desktop.py
+++ b/erpnext/config/desktop.py
@@ -4,37 +4,108 @@
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 @@
"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 @@
"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 @@
"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 e353e34..3ca987b 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 0000000..cc77292
--- /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 4903c58..4ecd838 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 0fedfd6..5c241fb 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 @@
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 446b585..e769e3e 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 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 0000000..0e13c31
--- /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/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js
index 9e2bd22..28a3691 100644
--- a/erpnext/public/js/controllers/transaction.js
+++ b/erpnext/public/js/controllers/transaction.js
@@ -8,7 +8,7 @@
erpnext.TransactionController = erpnext.taxes_and_totals.extend({
onload: function() {
var me = this;
- this.frm.show_print_first = true;
+ //this.frm.show_print_first = true;
if(this.frm.doc.__islocal) {
var today = get_today(),
currency = frappe.defaults.get_user_default("currency");
diff --git a/erpnext/public/js/utils/party.js b/erpnext/public/js/utils/party.js
index 2f45a35..5f9a276 100644
--- a/erpnext/public/js/utils/party.js
+++ b/erpnext/public/js/utils/party.js
@@ -2,7 +2,7 @@
// License: GNU General Public License v3. See license.txt
frappe.provide("erpnext.utils");
-frappe.provide('erpnext.party');
+
erpnext.utils.get_party_details = function(frm, method, args, callback) {
if(!method) {
method = "erpnext.accounts.party.get_party_details";
@@ -139,31 +139,4 @@
}
}
});
-}
-
-erpnext.party.setup_dashboard = function(frm) {
- frm.dashboard.reset(frm.doc);
- if(frm.doc.__islocal)
- return;
-
- $.each(frm.doc.__onload.transactions, function(i, doctype) {
- frm.dashboard.add_doctype_badge(doctype, frm.doc.doctype.toLowerCase());
- })
-
- return frappe.call({
- type: "GET",
- method: "erpnext.accounts.party_status.get_transaction_info",
- args: {
- party_type: frm.doc.doctype,
- party_name: frm.doc.name
- },
- callback: function(r) {
- $.each(r.message.transaction_count, function(i, d) {
- if(d.count) {
- frm.dashboard.set_badge_count(d.name, d.count)
- }
- })
- }
- });
-
-}
+}
\ No newline at end of file
diff --git a/erpnext/selling/doctype/customer/customer.js b/erpnext/selling/doctype/customer/customer.js
index 0adb0c5..95bed47 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) {
- erpnext.party.setup_dashboard(frm);
+ 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 ddbcf5b..ff47a79 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.py b/erpnext/selling/doctype/customer/customer.py
index 82003b0..51aedef 100644
--- a/erpnext/selling/doctype/customer/customer.py
+++ b/erpnext/selling/doctype/customer/customer.py
@@ -11,7 +11,7 @@
from erpnext.utilities.transaction_base import TransactionBase
from erpnext.utilities.address_and_contact import load_address_and_contact
from erpnext.accounts.party import validate_party_accounts
-from erpnext.accounts.party_status import get_transaction_count, get_party_status, status_depends_on
+from erpnext.accounts.party_status import get_party_status
class Customer(TransactionBase):
def get_feed(self):
@@ -20,7 +20,7 @@
def onload(self):
"""Load address and contacts in `__onload`"""
load_address_and_contact(self, "customer")
- self.set_onload('transactions', status_depends_on[self.doctype])
+ self.set_onload('links', self.meta.get_links_setup())
def autoname(self):
cust_master_name = frappe.defaults.get_global_default('cust_master_name')
@@ -128,33 +128,6 @@
{set_field} where customer=%(newdn)s"""\
.format(set_field=set_field), ({"newdn": newdn}))
-# @frappe.whitelist()
-# def get_dashboard_info(customer):
-# doc = frappe.get_doc('Customer', customer)
-# if not doc.has_permission('read'):
-# frappe.msgprint(_("Not permitted"), raise_exception=True)
-#
-#
-# out = {}
-# out['transaction_count'] = get_transaction_count(doc)
-#
-# billing_this_year = frappe.db.sql("""
-# select sum(debit_in_account_currency) - sum(credit_in_account_currency)
-# from `tabGL Entry`
-# where voucher_type='Sales Invoice' and party_type = 'Customer'
-# and party=%s and fiscal_year = %s""",
-# (customer, frappe.db.get_default("fiscal_year")))
-#
-# total_unpaid = frappe.db.sql("""select sum(outstanding_amount)
-# from `tabSales Invoice`
-# where customer=%s and docstatus = 1""", customer)
-#
-# out["billing_this_year"] = billing_this_year[0][0] if billing_this_year else 0
-# out["total_unpaid"] = total_unpaid[0][0] if total_unpaid else 0
-#
-# return out
-
-
def get_customer_list(doctype, txt, searchfield, start, page_len, filters):
if frappe.db.get_default("cust_master_name") == "Customer Name":
fields = ["name", "customer_group", "territory"]
diff --git a/erpnext/selling/doctype/customer/customer_links.py b/erpnext/selling/doctype/customer/customer_links.py
new file mode 100644
index 0000000..3ae139b
--- /dev/null
+++ b/erpnext/selling/doctype/customer/customer_links.py
@@ -0,0 +1,19 @@
+from frappe import _
+
+links = {
+ 'fieldname': 'customer',
+ 'transactions': [
+ {
+ 'label': _('Pre Sales'),
+ 'items': ['Opportunity', 'Quotation']
+ },
+ {
+ 'label': _('Orders'),
+ 'items': ['Sales Order', 'Delivery Note', 'Sales Invoice']
+ },
+ {
+ 'label': _('Projects'),
+ 'items': ['Project']
+ }
+ ]
+}
\ No newline at end of file
diff --git a/erpnext/selling/doctype/quotation/quotation.js b/erpnext/selling/doctype/quotation/quotation.js
index 3e90b97..06f94fe 100644
--- a/erpnext/selling/doctype/quotation/quotation.js
+++ b/erpnext/selling/doctype/quotation/quotation.js
@@ -18,15 +18,13 @@
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 @@
}
this.toggle_reqd_lead_customer();
-
+
},
quotation_to: function() {
@@ -166,6 +164,6 @@
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 213050c..8a9d83c 100644
--- a/erpnext/stock/doctype/item/item.js
+++ b/erpnext/stock/doctype/item/item.js
@@ -5,6 +5,7 @@
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);
@@ -16,6 +17,7 @@
},
refresh: function(frm) {
+
if(frm.doc.is_stock_item) {
frm.add_custom_button(__("Balance"), function() {
frappe.route_options = {
@@ -73,6 +75,8 @@
}
erpnext.item.toggle_attributes(frm);
+
+ frm.dashboard.show_links();
},
validate: function(frm){
diff --git a/erpnext/stock/doctype/item/item.json b/erpnext/stock/doctype/item/item.json
index fab43a9..94d2e8d 100644
--- a/erpnext/stock/doctype/item/item.json
+++ b/erpnext/stock/doctype/item/item.json
@@ -2298,7 +2298,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 1,
- "modified": "2016-04-04 06:45:30.554933",
+ "modified": "2016-04-11 09:15:30.911215",
"modified_by": "Administrator",
"module": "Stock",
"name": "Item",
@@ -2468,6 +2468,7 @@
"read_only": 0,
"read_only_onload": 0,
"search_fields": "item_name,description,item_group,customer_code",
+ "sort_field": "idx desc, modified desc",
"sort_order": "DESC",
"title_field": "item_name",
"track_seen": 0
diff --git a/erpnext/stock/doctype/item/item.py b/erpnext/stock/doctype/item/item.py
index cc8886b..8286b5f 100644
--- a/erpnext/stock/doctype/item/item.py
+++ b/erpnext/stock/doctype/item/item.py
@@ -27,7 +27,8 @@
def onload(self):
super(Item, self).onload()
- self.get("__onload").sle_exists = self.check_if_sle_exists()
+ self.set_onload('sle_exists', self.check_if_sle_exists())
+ self.set_onload('links', self.meta.get_links_setup())
def autoname(self):
if frappe.db.get_default("item_naming_by")=="Naming Series":
@@ -84,7 +85,7 @@
if not self.get("__islocal"):
self.old_item_group = frappe.db.get_value(self.doctype, self.name, "item_group")
- self.old_website_item_groups = frappe.db.sql_list("""select item_group
+ self.old_website_item_groups = frappe.db.sql_list("""select item_group
from `tabWebsite Item Group`
where parentfield='website_item_groups' and parenttype='Item' and parent=%s""", self.name)
@@ -399,13 +400,22 @@
vals = frappe.db.get_value("Item", self.name,
["has_serial_no", "is_stock_item", "valuation_method", "has_batch_no"], as_dict=True)
- if vals and ((self.is_stock_item == 0 and vals.is_stock_item == 1) or
+ if vals and ((self.is_stock_item != vals.is_stock_item) or
vals.has_serial_no != self.has_serial_no or
vals.has_batch_no != self.has_batch_no or
cstr(vals.valuation_method) != cstr(self.valuation_method)):
- if self.check_if_sle_exists() == "exists":
- frappe.throw(_("As there are existing stock transactions for this item, \
+ if self.check_if_linked_document_exists():
+ frappe.throw(_("As there are existing transactions for this item, \
you can not change the values of 'Has Serial No', 'Has Batch No', 'Is Stock Item' and 'Valuation Method'"))
+
+ def check_if_linked_document_exists(self):
+ for doctype in ("Sales Order Item", "Delivery Note Item", "Sales Invoice Item",
+ "Material Request Item", "Purchase Order Item", "Purchase Receipt Item",
+ "Purchase Invoice Item", "Stock Entry Detail", "Stock Reconciliation Item"):
+ if frappe.db.get_value(doctype, filters={"item_code": self.name, "docstatus": 1}) or \
+ frappe.db.get_value("Production Order",
+ filters={"production_item": self.name, "docstatus": 1}):
+ return True
def validate_reorder_level(self):
if len(self.get("reorder_levels", {"material_request_type": "Purchase"})):
@@ -568,7 +578,7 @@
if variant:
frappe.throw(_("Item variant {0} exists with same attributes")
.format(variant), ItemVariantExistsError)
-
+
def validate_fixed_asset_item(self):
if self.is_fixed_asset and self.is_stock_item:
frappe.throw(_("Fixed Asset Item must be a non-stock item"))
diff --git a/erpnext/stock/doctype/item/item_links.py b/erpnext/stock/doctype/item/item_links.py
new file mode 100644
index 0000000..c1fff8c
--- /dev/null
+++ b/erpnext/stock/doctype/item/item_links.py
@@ -0,0 +1,40 @@
+from frappe import _
+
+links = {
+ 'fieldname': 'item_code',
+ 'non_standard_fieldnames': {
+ 'Production Order': 'production_item',
+ 'Product Bundle': 'new_item_code'
+ },
+ 'transactions': [
+ {
+ 'label': _('Groups'),
+ 'items': ['BOM', 'Product Bundle']
+ },
+ {
+ 'label': _('Pricing'),
+ 'items': ['Item Price', 'Pricing Rule']
+ },
+ {
+ 'label': _('Sell'),
+ 'items': ['Quotation', 'Sales Order', 'Delivery Note', 'Sales Invoice']
+ },
+ {
+ 'label': _('Buy'),
+ 'items': ['Material Request', 'Supplier Quotation', 'Request for Quotation',
+ 'Purchase Order', 'Purchase Invoice']
+ },
+ {
+ 'label': _('Traceability'),
+ 'items': ['Serial No', 'Batch']
+ },
+ {
+ 'label': _('Move'),
+ 'items': ['Stock Entry']
+ },
+ {
+ 'label': _('Manufacture'),
+ 'items': ['Production Order']
+ }
+ ]
+}
\ No newline at end of file