Merge branch 'master' of github.com:webnotes/erpnext
diff --git a/erpnext/accounts/doctype/receivable_voucher/receivable_voucher.js b/erpnext/accounts/doctype/receivable_voucher/receivable_voucher.js
index 391bbcd..7b3c6ef 100644
--- a/erpnext/accounts/doctype/receivable_voucher/receivable_voucher.js
+++ b/erpnext/accounts/doctype/receivable_voucher/receivable_voucher.js
@@ -162,14 +162,24 @@
 cur_frm.cscript.customer = function(doc,dt,dn,onload) {
 
 	var callback = function(r,rt) {
+			var callback2 = function(doc, dt, dn) {
+				doc = locals[dt][dn];
+				if(doc.debit_to && doc.posting_date){
+					get_server_fields('get_cust_and_due_date','','',doc,dt,dn,1,
+					function(doc, dt, dn) {
+						cur_frm.refresh();
+					});
+					
+				}
+			}
 			var doc = locals[cur_frm.doctype][cur_frm.docname];
-			get_server_fields('get_debit_to','','',doc, dt, dn, 0);
-			cur_frm.refresh();
+			get_server_fields('get_debit_to','','',doc, dt, dn, 0, callback2);
 	}
 	var args = onload ? 'onload':''
 	if(doc.customer) $c_obj(make_doclist(doc.doctype, doc.name), 'get_default_customer_address', args, callback);
 
 	if(doc.customer) unhide_field(['customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group']);
+	
 }
 
 
diff --git a/erpnext/accounts/search_criteria/lease_receipts_client_wise/lease_receipts_client_wise.sql b/erpnext/accounts/search_criteria/lease_receipts_client_wise/lease_receipts_client_wise.sql
index f951388..af49c81 100644
--- a/erpnext/accounts/search_criteria/lease_receipts_client_wise/lease_receipts_client_wise.sql
+++ b/erpnext/accounts/search_criteria/lease_receipts_client_wise/lease_receipts_client_wise.sql
@@ -1,5 +1,5 @@
 SELECT gl.account,sum(gl.credit) as amount
 FROM `tabGL Entry` gl, `tabAccount` a
-WHERE gl.account=a.name and a.master_type='Customer' and gl.posting_date between '%(date)s' and '%(date1)s'
+WHERE gl.account=a.name and a.master_type='Customer' and gl.posting_date between '%(date)s' and '%(date1)s' and ifnull(gl.is_cancelled, 'No') = 'No'
 GROUP BY gl.account
 ORDER BY posting_date
diff --git a/erpnext/home/page/desktop/desktop.css b/erpnext/home/page/desktop/desktop.css
index e460c11..cc6126e 100644
--- a/erpnext/home/page/desktop/desktop.css
+++ b/erpnext/home/page/desktop/desktop.css
@@ -69,14 +69,14 @@
 }
 
 /* Hover and click effects */
-.case-border:hover, .circle:hover {
-	box-shadow: 0 0 2px 0px black, 0 0 10px 1px white;
-	-moz-box-shadow: 0 0 2px 0px black, 0 0 10px 1px white;
-	-webkit-box-shadow: 0 0 2px 0px black, 0 0 10px 1px white;
-	-o-box-shadow: 0 0 2px 0px black, 0 0 10px 1px white;
+.case-border:hover, .circle:hover, .hover-effect {
+	box-shadow: 0 0 2px 0px black, 0 0 10px 1px white !important;
+	-moz-box-shadow: 0 0 2px 0px black, 0 0 10px 1px white !important;
+	-webkit-box-shadow: 0 0 2px 0px black, 0 0 10px 1px white !important;
+	-o-box-shadow: 0 0 2px 0px black, 0 0 10px 1px white !important;
 }
 
-.case-border:active, .case-border:focus, .circle:active, .circle:focus {
+.case-border:active, .case-border:focus, .case-border-click {
 	transform: scale(0.98, 0.98);
 	-ms-transform: scale(0.98, 0.98); /* IE 9 */
 	-webkit-transform: scale(0.98, 0.98); /* Safari and Chrome */
@@ -84,6 +84,14 @@
 	-moz-transform: scale(0.98, 0.98); /* Firefox */
 }
 
+.circle:active, .circle:focus, .circle-click {
+	transform: scale(1, 1);
+	-ms-transform: scale(1, 1); /* IE 9 */
+	-webkit-transform: scale(1, 1); /* Safari and Chrome */
+	-o-transform: scale(1, 1); /* Opera */
+	-moz-transform: scale(1, 1); /* Firefox */
+}
+
 .circle {
 	border-radius: 30px;
 	-moz-border-radius: 30px;
@@ -93,9 +101,8 @@
 	min-width: 15px;
 	background: #B00D07;
 	padding: 3px;
-	z-index: 2;
 	float: right;
-	margin-top: -10px;
+	margin-top: -74px;
 	margin-right: 10px;
 	border: 2px solid white;
 	box-shadow: 0 0 10px 1px black;
@@ -106,10 +113,8 @@
 
 .circle-text {
 	color: white;
-	vertical-align: middle;
 	text-align: center;
 	display: inline-block;
-	margin-top: -3px;
-	text-shadow: 1px 1px 5px #000;
+	margin-top: 1px;
 }
 
diff --git a/erpnext/home/page/desktop/desktop.js b/erpnext/home/page/desktop/desktop.js
index dab1e76..7852ab2 100644
--- a/erpnext/home/page/desktop/desktop.js
+++ b/erpnext/home/page/desktop/desktop.js
@@ -95,9 +95,37 @@
 }
 
 erpnext.desktop.show_pending_notifications = function() {
-	$('#messages a:first').prepend('<div id="msg_count" class="circle" title="Unread Messages">\
-		<span class="circle-text"></span></div>');
-	$('#msg_count').toggle(false);
+	var add_circle = function(str_module, id, title) {
+		var module = $('#'+str_module);
+		module.find('a:first').append(
+			repl('<div id="%(id)s" class="circle" title="%(title)s" style="display: None">\
+					<span class="circle-text"></span>\
+				 </div>', {id: id, title: title}));
+		
+		var case_border = module.find('.case-border');
+		var circle = module.find('.circle');
+
+		var add_hover_and_click = function(primary, secondary, hover_class, click_class) {
+			primary
+			.hover(
+				function() { secondary.addClass(hover_class); },
+				function() { secondary.removeClass(hover_class); })
+			.mousedown(function() { secondary.addClass(click_class); })
+			.mouseup(function() { secondary.removeClass(click_class); })
+			.focusin(function() { $(this).mousedown(); })
+			.focusout(function() { $(this).mouseup(); })
+		}
+		
+		add_hover_and_click(case_border, circle, 'hover-effect', 'circle-click');
+		add_hover_and_click(circle, case_border, 'hover-effect', 'case-border-click');
+
+	}
+
+	add_circle('messages', 'unread_messages', 'Unread Messages');
+	add_circle('support', 'open_support_tickets', 'Open Support Tickets');
+	add_circle('todo', 'things_todo', 'Things To Do');
+	add_circle('calendar', 'todays_events', 'Todays Events');
+
 	update_messages();
 
 }
diff --git a/erpnext/home/page/event_updates/event_updates.js b/erpnext/home/page/event_updates/event_updates.js
index d86a1d8..b2825f3 100644
--- a/erpnext/home/page/event_updates/event_updates.js
+++ b/erpnext/home/page/event_updates/event_updates.js
@@ -600,7 +600,7 @@
 	// get values
 	$c_page('home', 'event_updates', 'get_status_details', user,
 		function(r,rt) { 
-			page_body.wntoolbar.set_new_comments(r.message.unread_messages);
+			//page_body.wntoolbar.set_new_comments(r.message.unread_messages);
 										
 			// render online users
 			pscript.online_users_obj.render(r.message.online_users);
diff --git a/erpnext/home/page/event_updates/event_updates.py b/erpnext/home/page/event_updates/event_updates.py
index 05f1cfc..32d6756 100644
--- a/erpnext/home/page/event_updates/event_updates.py
+++ b/erpnext/home/page/event_updates/event_updates.py
@@ -26,8 +26,7 @@
 		and t1.user not in ('Guest','Administrator')
 		and TIMESTAMPDIFF(HOUR,t1.lastupdate,NOW()) <= 1""", as_list=1) or []
 
-@webnotes.whitelist()
-def get_unread_messages(arg=None):
+def get_unread_messages():
 	"returns unread (docstatus-0 messages for a user)"
 	return webnotes.conn.sql("""\
 		SELECT name, comment
@@ -37,6 +36,49 @@
 		AND ifnull(docstatus,0)=0
 		""", webnotes.user.name, as_list=1)
 
+def get_open_support_tickets():
+	"""
+		Returns a count of open support tickets
+	"""
+	from webnotes.utils import cint
+	open_support_tickets =  webnotes.conn.sql("""\
+		SELECT COUNT(*) FROM `tabSupport Ticket`
+		WHERE status = 'Open'""")
+	return open_support_tickets and cint(open_support_tickets[0][0]) or 0
+
+def get_things_todo():
+	"""
+		Returns a count of incomplete todos
+	"""
+	from webnotes.utils import cint
+	incomplete_todos = webnotes.conn.sql("""\
+		SELECT COUNT(*) FROM `tabToDo Item`
+		WHERE IFNULL(checked, 0) = 0
+		AND owner = %s""", webnotes.session.get('user'))
+	return incomplete_todos and cint(incomplete_todos[0][0]) or 0
+
+def get_todays_events():
+	"""
+		Returns a count of todays events in calendar
+	"""
+	from webnotes.utils import nowdate, cint
+	todays_events = webnotes.conn.sql("""\
+		SELECT COUNT(*) FROM `tabEvent`
+		WHERE owner = %s
+		AND event_type != 'Cancel'
+		AND event_date = %s""", (
+			webnotes.session.get('user'), nowdate()))
+	return todays_events and cint(todays_events[0][0]) or 0
+
+@webnotes.whitelist()
+def get_global_status_messages(arg=None):
+	return {
+		'unread_messages': get_unread_messages(),
+		'open_support_tickets': get_open_support_tickets(),
+		'things_todo': get_things_todo(),
+		'todays_events': get_todays_events(),
+	}
+
 @webnotes.whitelist()
 def get_status_details(arg=None):
 	"""get toolbar items"""
@@ -47,7 +89,8 @@
 	# system messages			
 	ret = {
 		'user_count': len(online) or 0, 
-		'unread_messages': get_unread_messages(),
+		#'unread_messages': get_unread_messages(),
+		#'open_support_tickets': get_open_support_tickets(),
 		'online_users': online or [],
 		'setup_status': get_setup_status(),
 		'registration_complete': cint(get_defaults('registration_complete')) and 'Yes' or 'No',
diff --git a/erpnext/selling/doctype/customer/customer.txt b/erpnext/selling/doctype/customer/customer.txt
index 346b4d1..993dc29 100644
--- a/erpnext/selling/doctype/customer/customer.txt
+++ b/erpnext/selling/doctype/customer/customer.txt
@@ -203,7 +203,7 @@
 	# DocField
 	{
 		'colour': u'White:FFF',
-		'description': u'<a href="javascript:cur_frm.cscript.CGHelp();">To manage Customer Groups, click here</a>',
+		'description': u'<a href="#!Sales Browser/Customer Group">To manage Customer Groups, click here</a>',
 		'doctype': u'DocField',
 		'fieldname': u'customer_group',
 		'fieldtype': u'Link',
@@ -223,7 +223,7 @@
 	# DocField
 	{
 		'colour': u'White:FFF',
-		'description': u'<a href="javascript:cur_frm.cscript.TerritoryHelp();">To manage Territory, click here</a>',
+		'description': u'<a href="#!Sales Browser/Territory">To manage Territory, click here</a>',
 		'doctype': u'DocField',
 		'fieldname': u'territory',
 		'fieldtype': u'Link',
diff --git a/erpnext/selling/doctype/sales_common/sales_common.py b/erpnext/selling/doctype/sales_common/sales_common.py
index 9186bb8..63f53ea 100644
--- a/erpnext/selling/doctype/sales_common/sales_common.py
+++ b/erpnext/selling/doctype/sales_common/sales_common.py
@@ -209,13 +209,14 @@
 			if default: add_cond = 'ifnull(t2.is_default,0) = 1'
 			else: add_cond = 't1.parent = "'+cstr(obj.doc.charge)+'"'
 			idx = 0
-			other_charge = webnotes.conn.sql("select t1.charge_type,t1.row_id,t1.description,t1.account_head,t1.rate,t1.tax_amount,t1.included_in_print_rate from `tabRV Tax Detail` t1, `tabOther Charges` t2 where t1.parent = t2.name and t2.company = '%s' and %s order by t1.idx" % (obj.doc.company, add_cond), as_dict = 1)
+			other_charge = webnotes.conn.sql("select t1.charge_type,t1.row_id,t1.description,t1.account_head,t1.rate,t1.tax_amount,t1.included_in_print_rate, t1.cost_center_other_charges from `tabRV Tax Detail` t1, `tabOther Charges` t2 where t1.parent = t2.name and t2.company = '%s' and %s order by t1.idx" % (obj.doc.company, add_cond), as_dict = 1)
 			for other in other_charge:
 				d =	addchild(obj.doc, 'other_charges', 'RV Tax Detail', 1, obj.doclist)
 				d.charge_type = other['charge_type']
 				d.row_id = other['row_id']
 				d.description = other['description']
 				d.account_head = other['account_head']
+				d.cost_center_other_charges = other['cost_center_other_charges']
 				d.rate = flt(other['rate'])
 				d.tax_amount = flt(other['tax_amount'])
 				d.included_in_print_rate = cint(other['included_in_print_rate'])
diff --git a/erpnext/setup/doctype/manage_account/manage_account.txt b/erpnext/setup/doctype/manage_account/manage_account.txt
index 18a9872..4077afe 100644
--- a/erpnext/setup/doctype/manage_account/manage_account.txt
+++ b/erpnext/setup/doctype/manage_account/manage_account.txt
@@ -231,7 +231,7 @@
 		'doctype': 'DocField',
 		'fieldtype': 'HTML',
 		'label': 'IGHelp',
-		'options': '<a href="javascript:cur_frm.cscript.TreePage(\'Item Group\');">To manage Item Groups, click here</a>'
+		'options': '<a href="#!Sales Browser/Item Group">To manage Item Groups, click here</a>'
 	},
 
 	# DocField
@@ -391,7 +391,7 @@
 		'doctype': 'DocField',
 		'fieldtype': 'HTML',
 		'label': 'CGHelp',
-		'options': '<a href="javascript:cur_frm.cscript.TreePage(\'Customer Group\');">To manage Customer Groups, click here</a>'
+		'options': '<a href="#!Sales Browser/Customer Group">To manage Customer Groups, click here</a>'
 	},
 
 	# DocField
@@ -408,7 +408,7 @@
 		'doctype': 'DocField',
 		'fieldtype': 'HTML',
 		'label': 'TerritoryHelp',
-		'options': '<a href="javascript:cur_frm.cscript.TreePage(\'Territory\');">To manage Territory, click here</a>'
+		'options': '<a href="#!Sales Browser/Territory">To manage Territory, click here</a>'
 	},
 
 	# DocField
diff --git a/erpnext/setup/doctype/sales_person/sales_person.txt b/erpnext/setup/doctype/sales_person/sales_person.txt
index 0680c38..9ae96bf 100644
--- a/erpnext/setup/doctype/sales_person/sales_person.txt
+++ b/erpnext/setup/doctype/sales_person/sales_person.txt
@@ -183,7 +183,7 @@
 		'idx': 5,
 		'label': 'SPHelp',
 		'oldfieldtype': 'HTML',
-		'options': '<a href="javascript:cur_frm.cscript.TreePage(\'Sales Person\');">To manage Sales Person, click here</a>',
+		'options': '<a href="#!Sales Browser/Sales Person">To manage Sales Person, click here</a>',
 		'permlevel': 0
 	},
 
diff --git a/erpnext/startup/event_handlers.py b/erpnext/startup/event_handlers.py
index 7db56bd..703399a 100644
--- a/erpnext/startup/event_handlers.py
+++ b/erpnext/startup/event_handlers.py
@@ -87,6 +87,7 @@
 
 		import webnotes.model.doctype
 		bootinfo['docs'] += webnotes.model.doctype.get('Event')
+		bootinfo['docs'] += webnotes.model.doctype.get('Search Criteria')
 		
 		bootinfo['modules_list'] = webnotes.conn.get_global('modules_list')
 		
diff --git a/erpnext/startup/startup.js b/erpnext/startup/startup.js
index 0a2ac23..c00770c 100644
--- a/erpnext/startup/startup.js
+++ b/erpnext/startup/startup.js
@@ -110,20 +110,29 @@
 	if(inList(['Guest'], user)) { return; }
 
 	if(!reset) {
-		$c_page('home', 'event_updates', 'get_unread_messages', null,
+		$c_page('home', 'event_updates', 'get_global_status_messages', null,
 			function(r,rt) {
 				if(!r.exc) {
 					// This function is defined in toolbar.js
-					page_body.wntoolbar.set_new_comments(r.message);
-					var circle = $('#msg_count')
-					if(circle) {
-						if(r.message.length) {
-							circle.find('span:first').text(r.message.length);
-							circle.toggle(true);
-						} else {
-							circle.toggle(false);
+					page_body.wntoolbar.set_new_comments(r.message.unread_messages);
+					
+					var show_in_circle = function(parent_id, msg) {
+						var parent = $('#'+parent_id);
+						if(parent) {
+							if(msg) {
+								parent.find('span:first').text(msg);
+								parent.toggle(true);
+							} else {
+								parent.toggle(false);
+							}
 						}
 					}
+
+					show_in_circle('unread_messages', r.message.unread_messages.length);
+					show_in_circle('open_support_tickets', r.message.open_support_tickets);
+					show_in_circle('things_todo', r.message.things_todo);
+					show_in_circle('todays_events', r.message.todays_events);
+
 				} else {
 					clearInterval(wn.updates.id);
 				}
@@ -131,7 +140,7 @@
 		);
 	} else {
 		page_body.wntoolbar.set_new_comments(0);
-		$('#msg_count').toggle(false);
+		$('#unread_messages').toggle(false);
 	}
 }
 
diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.txt b/erpnext/stock/doctype/delivery_note/delivery_note.txt
index 314d0d9..4878c36 100644
--- a/erpnext/stock/doctype/delivery_note/delivery_note.txt
+++ b/erpnext/stock/doctype/delivery_note/delivery_note.txt
@@ -31,11 +31,11 @@
 		'module': u'Stock',
 		'name': '__common__',
 		'read_only_onload': 1,
-		'search_fields': u'status,transaction_date,customer,customer_name, territory,grand_total',
+		'search_fields': u'status,customer,customer_name, territory,grand_total',
 		'section_style': u'Tabbed',
 		'server_code_error': u' ',
 		'show_in_menu': 0,
-		'subject': u'To %(customer_name)s on %(transaction_date)s | %(per_billed)s% billed',
+		'subject': u'To %(customer_name)s on %(posting_date)s | %(per_billed)s% billed',
 		'tag_fields': u'billing_status',
 		'version': 475
 	},
diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.txt b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.txt
index 525bcfc..6724b69 100755
--- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.txt
+++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.txt
@@ -21,11 +21,11 @@
 		'module': u'Stock',
 		'name': '__common__',
 		'read_only_onload': 1,
-		'search_fields': u'status, transaction_date, supplier',
+		'search_fields': u'status, posting_date, supplier',
 		'section_style': u'Tabbed',
 		'server_code_error': u' ',
 		'show_in_menu': 0,
-		'subject': u'From %(supplier_name)s against %(purchase_order)s on %(transaction_date)s',
+		'subject': u'From %(supplier_name)s against %(purchase_order)s on %(posting_date)s',
 		'version': 325
 	},
 
diff --git a/erpnext/stock/page/stock_home/stock_home.html b/erpnext/stock/page/stock_home/stock_home.html
index ae677de..03c5fab 100644
--- a/erpnext/stock/page/stock_home/stock_home.html
+++ b/erpnext/stock/page/stock_home/stock_home.html
@@ -49,7 +49,7 @@
 					<div class="section-item">
 						<a class="section-link" 
 							title = "Readings of incoming quality inspections"
-							href="#!List/List/QA Inspection Report">Incoming Inspection</a>
+							href="#!List/QA Inspection Report">Incoming Inspection</a>
 					</div>
 					<div class="section-item">
 						<a class="section-link" 
@@ -71,7 +71,6 @@
 							title = "Helper for managing return of goods (sales or purchase)"
 							href="#!Form/Sales and Purchase Return Wizard/Sales and Purchase Return Wizard">Sales or Purchase Returns</a>
 					</div>
-
 				</div>
 			</div>
 			<div class="section">
diff --git a/js/all-app.js b/js/all-app.js
index 686b0b8..abb3c08 100644
--- a/js/all-app.js
+++ b/js/all-app.js
Binary files differ
diff --git a/js/all-web.js b/js/all-web.js
index a9f04e6..5133644 100644
--- a/js/all-web.js
+++ b/js/all-web.js
@@ -595,7 +595,7 @@
 var v=this.options_list[0];else
 var v=null;}
 this.input.set_input(v);}
-this.input.set_input=function(v){if(!v){if(!me.input.multiple){if(me.docname){if(me.options_list&&me.options_list.length){me.set(me.options_list[0]);me.input.value=me.options_list[0];}else{me.input.value='';}}}}else{if(me.options_list){if(me.input.multiple){for(var i=0;i<me.input.options.length;i++){me.input.options[i].selected=0;if(me.input.options[i].value&&inList(v.split(","),me.input.options[i].value))
+this.input.set_input=function(v){if(!v){if(!me.input.multiple){if(me.docname){if(me.options_list&&me.options_list.length){me.set(me.options_list[0]);me.input.value=me.options_list[0];}else{me.input.value='';}}}}else{if(me.options_list){if(me.input.multiple){for(var i=0;i<me.input.options.length;i++){me.input.options[i].selected=0;if(me.input.options[i].value&&inList(typeof(v)=='string'?v.split(","):v,me.input.options[i].value))
 me.input.options[i].selected=1;}}else if(in_list(me.options_list,v)){me.input.value=v;}}}}
 this.get_value=function(){if(me.input.multiple){var l=[];for(var i=0;i<me.input.options.length;i++){if(me.input.options[i].selected)l[l.length]=me.input.options[i].value;}
 return l;}else{if(me.input.options){var val=sel_val(me.input);if(!val&&!me.input.selectedIndex)
@@ -1077,8 +1077,8 @@
 pscript.make_chart(chart_type);}
 loadpage(nm,call_back);}
 var update_messages=function(reset){if(inList(['Guest'],user)){return;}
-if(!reset){$c_page('home','event_updates','get_unread_messages',null,function(r,rt){if(!r.exc){page_body.wntoolbar.set_new_comments(r.message);var circle=$('#msg_count')
-if(circle){if(r.message.length){circle.find('span:first').text(r.message.length);circle.toggle(true);}else{circle.toggle(false);}}}else{clearInterval(wn.updates.id);}});}else{page_body.wntoolbar.set_new_comments(0);$('#msg_count').toggle(false);}}
+if(!reset){$c_page('home','event_updates','get_global_status_messages',null,function(r,rt){if(!r.exc){page_body.wntoolbar.set_new_comments(r.message.unread_messages);var show_in_circle=function(parent_id,msg){var parent=$('#'+parent_id);if(parent){if(msg){parent.find('span:first').text(msg);parent.toggle(true);}else{parent.toggle(false);}}}
+show_in_circle('unread_messages',r.message.unread_messages.length);show_in_circle('open_support_tickets',r.message.open_support_tickets);show_in_circle('things_todo',r.message.things_todo);show_in_circle('todays_events',r.message.todays_events);}else{clearInterval(wn.updates.id);}});}else{page_body.wntoolbar.set_new_comments(0);$('#unread_messages').toggle(false);}}
 erpnext.startup.set_periodic_updates=function(){wn.updates={};if(wn.updates.id){clearInterval(wn.updates.id);}
 wn.updates.id=setInterval(update_messages,60000);}
 erpnext.set_user_background=function(src){set_style(repl('body { background: url("files/%(src)s") repeat;}',{src:src}))}
diff --git a/version.num b/version.num
index e458f14..f08bce7 100644
--- a/version.num
+++ b/version.num
@@ -1 +1 @@
-821
\ No newline at end of file
+841
\ No newline at end of file
diff --git a/wnf.py b/wnf.py
index 463ecc4..a80cc27 100755
--- a/wnf.py
+++ b/wnf.py
@@ -117,6 +117,9 @@
 	parser.add_option("--replace", nargs=3, default=False, 
 						metavar = "search replace_by extension",
 						help="file search-replace")
+
+	parser.add_option("--cci", nargs=1, metavar="CacheItem Key",
+		help="Clear Cache Item")
 	
 
 	return parser.parse_args()
@@ -229,6 +232,13 @@
 		import webnotes.utils.scheduler
 		print webnotes.utils.scheduler.trigger('execute_' + options.run_scheduler_event)
 	
+	elif options.cci is not None:
+		if options.cci=='all':
+			webnotes.conn.sql("DELETE FROM __CacheItem")
+		else:
+			from webnotes.utils.cache import CacheItem
+			CacheItem(options.cci).clear()
+
 	# print messages
 	if webnotes.message_log:
 		print '\n'.join(webnotes.message_log)