Merge branch 'master' of https://github.com/webnotes/erpnext

Conflicts:
	controllers/buying_controller.py
diff --git a/controllers/accounts_controller.py b/controllers/accounts_controller.py
index df78212..ac6481c 100644
--- a/controllers/accounts_controller.py
+++ b/controllers/accounts_controller.py
@@ -22,6 +22,10 @@
 from utilities.transaction_base import TransactionBase
 
 class AccountsController(TransactionBase):
+	def validate(self):
+		if self.meta.get_field("grand_total"):
+			self.validate_value("grand_total", ">=", 0)
+
 	def get_gl_dict(self, args, cancel=None):
 		"""this method populates the common properties of a gl entry record"""
 		if cancel is None:
@@ -101,4 +105,4 @@
 
 @webnotes.whitelist()
 def get_default_account(account_for, company):
-	return webnotes.conn.get_value("Company", company, account_for)
\ No newline at end of file
+	return webnotes.conn.get_value("Company", company, account_for)
diff --git a/controllers/buying_controller.py b/controllers/buying_controller.py
index 03d2a92..2c2bb44 100644
--- a/controllers/buying_controller.py
+++ b/controllers/buying_controller.py
@@ -27,7 +27,8 @@
 from controllers.stock_controller import StockController
 
 class BuyingController(StockController):
-	def validate(self):		
+	def validate(self):
+		super(BuyingController, self).validate()
 		if self.meta.get_field("currency"):
 			self.company_currency = get_company_currency(self.doc.company)
 			self.validate_conversion_rate("currency", "conversion_rate")
@@ -37,7 +38,7 @@
 			
 			# IMPORTANT: enable this only when client side code is similar to this one
 			# self.calculate_taxes_and_totals()
-			
+						
 			# set total in words
 			self.set_total_in_words()
 		
diff --git a/controllers/selling_controller.py b/controllers/selling_controller.py
index f9498cb..cd81e18 100644
--- a/controllers/selling_controller.py
+++ b/controllers/selling_controller.py
@@ -23,6 +23,7 @@
 
 class SellingController(StockController):
 	def validate(self):
+		super(SellingController, self).validate()
 		self.set_total_in_words()
 		
 	def set_total_in_words(self):
@@ -37,4 +38,4 @@
 				self.doc.grand_total or self.doc.rounded_total, company_currency)
 		if self.meta.get_field("in_words_export"):
 			self.doc.in_words_export = money_in_words(disable_rounded_total and 
-				self.doc.grand_total_export or self.doc.rounded_total_export, self.doc.currency)
\ No newline at end of file
+				self.doc.grand_total_export or self.doc.rounded_total_export, self.doc.currency)
diff --git a/setup/doctype/backup_manager/backup_dropbox.py b/setup/doctype/backup_manager/backup_dropbox.py
index 2c7fda6..b668803 100644
--- a/setup/doctype/backup_manager/backup_dropbox.py
+++ b/setup/doctype/backup_manager/backup_dropbox.py
@@ -86,6 +86,8 @@
 	filename = os.path.join(get_base_path(), "public", "files")
 	for filename in os.listdir(filename):
 		found = False
+		pth=path1+'/'+filename
+		size=os.stat(pth).st_size
 		for file_metadata in response["contents"]:
  			if filename==os.path.basename(file_metadata["path"]):
 				if os.stat(filename).st_size==file_metadata["bytes"]:
@@ -119,4 +121,4 @@
 		response = dropbox_client.put_file(folder + "/" + os.path.basename(filename), f, overwrite=True)
 
 if __name__=="__main__":
-	backup_to_dropbox()
\ No newline at end of file
+	backup_to_dropbox() 
diff --git a/setup/doctype/backup_manager/backup_manager.py b/setup/doctype/backup_manager/backup_manager.py
index 213aa85..69de823 100644
--- a/setup/doctype/backup_manager/backup_manager.py
+++ b/setup/doctype/backup_manager/backup_manager.py
@@ -30,6 +30,7 @@
 		backup_to_dropbox()
 		send_email(True, "Dropbox")
 	except Exception, e:
+		webnotes.errprint(e)
 		send_email(False, "Dropbox", e)
 
 #backup to gdrive 
@@ -55,9 +56,10 @@
 		failed.</p>
 		<p>Error message: %s</p>
 		<p>Please contact your system manager for more information.</p>
-		""" % (service_name, error_status)
+		<p>Detailed Error Trace: %s</p>""" % \
+		(service_name, error_status, getTraceback().replace("\n", "<br>"))
 	
 	# email system managers
 	from webnotes.utils.email_lib import sendmail
 	sendmail(webnotes.conn.get_value("Backup Manager", None, "send_notifications_to").split(","),
-	subject=subject, msg=message)
\ No newline at end of file
+	subject=subject, msg=message)