Merge pull request #2451 from revant/develop

"From time" cannot be later than "To time" and hours cannot be negative
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json
index 7e37400..266aae4 100755
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json
@@ -800,7 +800,8 @@
    "fieldtype": "Date", 
    "label": "From Date", 
    "no_copy": 1, 
-   "permlevel": 0
+   "permlevel": 0, 
+   "print_hide": 1
   }, 
   {
    "allow_on_submit": 1, 
@@ -810,7 +811,8 @@
    "fieldtype": "Date", 
    "label": "To Date", 
    "no_copy": 1, 
-   "permlevel": 0
+   "permlevel": 0, 
+   "print_hide": 1
   }, 
   {
    "allow_on_submit": 1, 
@@ -878,7 +880,7 @@
  "icon": "icon-file-text", 
  "idx": 1, 
  "is_submittable": 1, 
- "modified": "2014-10-08 14:23:20.234176", 
+ "modified": "2014-11-27 17:28:20.133701", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Purchase Invoice", 
diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.json b/erpnext/buying/doctype/purchase_order/purchase_order.json
index f072b65..a57f544 100644
--- a/erpnext/buying/doctype/purchase_order/purchase_order.json
+++ b/erpnext/buying/doctype/purchase_order/purchase_order.json
@@ -685,7 +685,8 @@
    "label": "Recurring Type", 
    "no_copy": 1, 
    "options": "Monthly\nQuarterly\nHalf-yearly\nYearly", 
-   "permlevel": 0
+   "permlevel": 0, 
+   "print_hide": 1
   }, 
   {
    "allow_on_submit": 1, 
@@ -695,7 +696,8 @@
    "fieldtype": "Date", 
    "label": "From Date", 
    "no_copy": 1, 
-   "permlevel": 0
+   "permlevel": 0, 
+   "print_hide": 1
   }, 
   {
    "allow_on_submit": 1, 
@@ -705,7 +707,8 @@
    "fieldtype": "Date", 
    "label": "To Date", 
    "no_copy": 1, 
-   "permlevel": 0
+   "permlevel": 0, 
+   "print_hide": 1
   }, 
   {
    "allow_on_submit": 1, 
@@ -772,7 +775,7 @@
  "icon": "icon-file-text", 
  "idx": 1, 
  "is_submittable": 1, 
- "modified": "2014-10-08 14:23:29.718779", 
+ "modified": "2014-11-27 17:27:38.839440", 
  "modified_by": "Administrator", 
  "module": "Buying", 
  "name": "Purchase Order", 
diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py
index af0a96e..49845f6 100644
--- a/erpnext/controllers/accounts_controller.py
+++ b/erpnext/controllers/accounts_controller.py
@@ -437,7 +437,7 @@
 				for order, jv_list in order_jv_map.items():
 					for jv in jv_list:
 						if not advance_jv_against_si or jv not in advance_jv_against_si:
-							frappe.throw(_("Journal Voucher {0} is linked against Order {1}, hence it must be fetched as advance in Invoice as well.")
+							frappe.msgprint(_("Journal Voucher {0} is linked against Order {1}, check if it should be pulled as advance in this invoice.")
 								.format(jv, order))
 
 
diff --git a/erpnext/public/js/templates/contact_list.html b/erpnext/public/js/templates/contact_list.html
index c4c058c..94af7ef 100644
--- a/erpnext/public/js/templates/contact_list.html
+++ b/erpnext/public/js/templates/contact_list.html
@@ -14,8 +14,11 @@
             {% if(contact_list[i].phone) { %}
                 {%= __("Phone") %}: {%= contact_list[i].phone %}<br>
             {% } %}
+            {% if(contact_list[i].mobile_no) { %}
+                {%= __("Mobile No.") %}: {%= contact_list[i].mobile_no %}<br>
+            {% } %}
             {% if(contact_list[i].email_id) { %}
-                {%= __("Email Id") %}: {%= contact_list[i].email_id %}
+                {%= __("Email ID") %}: {%= contact_list[i].email_id %}
             {% } %}
         </p>
     </div>
diff --git a/erpnext/selling/doctype/sales_order/sales_order.py b/erpnext/selling/doctype/sales_order/sales_order.py
index 498aec1..8153d8d 100644
--- a/erpnext/selling/doctype/sales_order/sales_order.py
+++ b/erpnext/selling/doctype/sales_order/sales_order.py
@@ -157,7 +157,7 @@
 
 		self.check_credit(self.grand_total)
 
-		frappe.get_doc('Authorization Control').validate_approving_authority(self.doctype, self.grand_total, self)
+		frappe.get_doc('Authorization Control').validate_approving_authority(self.doctype, self.company, self.grand_total, self)
 
 		self.update_prevdoc_status('submit')
 		frappe.db.set(self, 'status', 'Submitted')
@@ -357,17 +357,6 @@
 		}
 	}, target_doc, postprocess)
 
-	def set_advance_vouchers(source, target):
-		advance_voucher_list = []
-
-		advance_voucher = frappe.db.sql("""
-			select
-				t1.name as voucher_no, t1.posting_date, t1.remark, t2.account,
-				t2.name as voucher_detail_no, {amount_query} as payment_amount, t2.is_advance
-			from
-				`tabJournal Voucher` t1, `tabJournal Voucher Detail` t2
-			""")
-
 	return doclist
 
 @frappe.whitelist()
diff --git a/erpnext/setup/doctype/authorization_control/authorization_control.py b/erpnext/setup/doctype/authorization_control/authorization_control.py
index 8e7b0ce..fbf4b1c 100644
--- a/erpnext/setup/doctype/authorization_control/authorization_control.py
+++ b/erpnext/setup/doctype/authorization_control/authorization_control.py
@@ -98,9 +98,12 @@
 		if doc_obj:
 			price_list_rate, base_rate = 0, 0
 			for d in doc_obj.get(doc_obj.fname):
-				if d.base_price_list_rate and d.base_rate:
-					price_list_rate += flt(d.base_price_list_rate)
+				if d.base_rate:
+					price_list_rate += flt(d.base_price_list_rate) or flt(d.base_rate)
 					base_rate += flt(d.base_rate)
+			if doc_obj.get("discount_amount"):
+				base_rate -= flt(doc_obj.discount_amount)
+
 			if price_list_rate: av_dis = 100 - flt(base_rate * 100 / price_list_rate)
 
 		final_based_on = ['Grand Total','Average Discount','Customerwise Discount','Itemwise Discount']