Fixes frappe/erpnext#1849
Merge pull request #1852 from anandpdoshi/anand-wip-4.1

Fixes frappe/erpnext#1849