fixes in test cases and buying amount function
Merge branch 'master' of github.com:webnotes/erpnext