[minor] add close button in opportunity and project links in customer
diff --git a/erpnext/crm/doctype/opportunity/opportunity.js b/erpnext/crm/doctype/opportunity/opportunity.js
index 6156dcf..edaa151 100644
--- a/erpnext/crm/doctype/opportunity/opportunity.js
+++ b/erpnext/crm/doctype/opportunity/opportunity.js
@@ -80,9 +80,23 @@
if(doc.status!=="Quotation")
cur_frm.add_custom_button(__('Opportunity Lost'),
cur_frm.cscript['Declare Opportunity Lost'], "icon-remove", "btn-default");
-
-
}
+
+ var frm = cur_frm;
+ if(frm.perm[0].write && doc.docstatus==0) {
+ if(frm.doc.status==="Open") {
+ frm.add_custom_button("Close", function() {
+ frm.set_value("status", "Closed");
+ frm.save();
+ });
+ } else {
+ frm.add_custom_button("Reopen", function() {
+ frm.set_value("status", "Open");
+ frm.save();
+ });
+ }
+ }
+
}
cur_frm.cscript.onload_post_render = function(doc, cdt, cdn) {
diff --git a/erpnext/selling/doctype/customer/customer.js b/erpnext/selling/doctype/customer/customer.js
index 1f9a12b..ac0f636 100644
--- a/erpnext/selling/doctype/customer/customer.js
+++ b/erpnext/selling/doctype/customer/customer.js
@@ -46,6 +46,7 @@
cur_frm.dashboard.add_doctype_badge("Sales Order", "customer");
cur_frm.dashboard.add_doctype_badge("Delivery Note", "customer");
cur_frm.dashboard.add_doctype_badge("Sales Invoice", "customer");
+ cur_frm.dashboard.add_doctype_badge("Project", "customer");
return frappe.call({
type: "GET",
@@ -62,6 +63,8 @@
+ '</b> / <span class="text-muted">' + __("Unpaid") + ": <b>"
+ format_currency(r.message.total_unpaid, r.message["company_currency"][0])
+ '</b></span>');
+ } else {
+ cur_frm.dashboard.set_headline("");
}
}
cur_frm.dashboard.set_badge_count(r.message);
diff --git a/erpnext/selling/doctype/customer/customer.py b/erpnext/selling/doctype/customer/customer.py
index f82e2fb..fe68966 100644
--- a/erpnext/selling/doctype/customer/customer.py
+++ b/erpnext/selling/doctype/customer/customer.py
@@ -119,7 +119,8 @@
frappe.msgprint(_("Not permitted"), raise_exception=True)
out = {}
- for doctype in ["Opportunity", "Quotation", "Sales Order", "Delivery Note", "Sales Invoice"]:
+ for doctype in ["Opportunity", "Quotation", "Sales Order", "Delivery Note",
+ "Sales Invoice", "Project"]:
out[doctype] = frappe.db.get_value(doctype,
{"customer": customer, "docstatus": ["!=", 2] }, "count(*)")