[enhancement] close opportunities from list view

This commit is contained in:
Rushabh Mehta 2015-04-30 17:17:13 +05:30
parent aa03a8e3a2
commit ec3ad7d865
2 changed files with 20 additions and 1 deletions

View File

@ -2,7 +2,7 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
import frappe, json
from frappe.utils import cstr, cint
from frappe import msgprint, _
from frappe.model.mapper import get_mapped_doc
@ -200,3 +200,11 @@ def make_quotation(source_name, target_doc=None):
}, target_doc, set_missing_values)
return doclist
@frappe.whitelist()
def set_multiple_status(names, status):
names = json.loads(names)
for name in names:
opp = frappe.get_doc("Opportunity", name)
opp.status = status
opp.save()

View File

@ -6,5 +6,16 @@ frappe.listview_settings['Opportunity'] = {
indicator[1] = "green";
}
return indicator;
},
onload: function(listview) {
var method = "erpnext.crm.doctype.opportunity.opportunity.set_multiple_status";
listview.page.add_menu_item(__("Set as Open"), function() {
listview.call_for_selected_items(method, {"status": "Open"});
});
listview.page.add_menu_item(__("Set as Closed"), function() {
listview.call_for_selected_items(method, {"status": "Closed"});
});
}
};