Merge pull request #7373 from KanchanChauhan/leave-for-absent

[Fix] Attendance validation in Leave Application
diff --git a/erpnext/__init__.py b/erpnext/__init__.py
index 5b26c08..06af401 100644
--- a/erpnext/__init__.py
+++ b/erpnext/__init__.py
@@ -2,7 +2,7 @@
 from __future__ import unicode_literals
 import frappe
 
-__version__ = '7.2.3'
+__version__ = '7.2.5'
 
 def get_default_company(user=None):
 	'''Get default company for user'''
diff --git a/erpnext/accounts/doctype/budget_account/budget_account.json b/erpnext/accounts/doctype/budget_account/budget_account.json
index 58bb90e..172e092 100644
--- a/erpnext/accounts/doctype/budget_account/budget_account.json
+++ b/erpnext/accounts/doctype/budget_account/budget_account.json
@@ -9,11 +9,13 @@
  "doctype": "DocType", 
  "document_type": "", 
  "editable_grid": 1, 
+ "engine": "InnoDB", 
  "fields": [
   {
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "account", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -30,6 +32,7 @@
    "print_hide": 0, 
    "print_hide_if_no_value": 0, 
    "read_only": 0, 
+   "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 1, 
    "search_index": 0, 
@@ -40,6 +43,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "budget_amount", 
    "fieldtype": "Currency", 
    "hidden": 0, 
@@ -50,11 +54,13 @@
    "label": "Budget Amount", 
    "length": 0, 
    "no_copy": 0, 
+   "options": "Company:company:default_currency", 
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
    "print_hide_if_no_value": 0, 
    "read_only": 0, 
+   "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 1, 
    "search_index": 0, 
@@ -72,7 +78,7 @@
  "issingle": 0, 
  "istable": 1, 
  "max_attachments": 0, 
- "modified": "2016-07-11 03:27:58.705376", 
+ "modified": "2017-01-02 17:02:53.339420", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Budget Account", 
diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.py b/erpnext/accounts/doctype/journal_entry/journal_entry.py
index 1dd1ee9..b31a304 100644
--- a/erpnext/accounts/doctype/journal_entry/journal_entry.py
+++ b/erpnext/accounts/doctype/journal_entry/journal_entry.py
@@ -326,10 +326,12 @@
 			if d.account_currency == self.company_currency:
 				d.exchange_rate = 1
 			elif not d.exchange_rate or d.exchange_rate == 1 or \
-				(d.reference_type in ("Sales Invoice", "Purchase Invoice") and d.reference_name and d.posting_date):
+				(d.reference_type in ("Sales Invoice", "Purchase Invoice") 
+				and d.reference_name and self.posting_date):
+				
 					# Modified to include the posting date for which to retreive the exchange rate
-					d.exchange_rate = get_exchange_rate(self.posting_date, d.account, d.account_currency, self.company,
-						d.reference_type, d.reference_name, d.debit, d.credit, d.exchange_rate)
+					d.exchange_rate = get_exchange_rate(self.posting_date, d.account, d.account_currency, 
+						self.company, d.reference_type, d.reference_name, d.debit, d.credit, d.exchange_rate)
 
 			if not d.exchange_rate:
 				frappe.throw(_("Row {0}: Exchange Rate is mandatory").format(d.idx))
diff --git a/erpnext/accounts/doctype/pricing_rule/pricing_rule.py b/erpnext/accounts/doctype/pricing_rule/pricing_rule.py
index 9928227..3c62297 100644
--- a/erpnext/accounts/doctype/pricing_rule/pricing_rule.py
+++ b/erpnext/accounts/doctype/pricing_rule/pricing_rule.py
@@ -109,12 +109,16 @@
 
 	item_list = args.get("items")
 	args.pop("items")
+	
+	set_serial_nos_based_on_fifo = frappe.db.get_single_value("Stock Settings", 
+		"automatically_set_serial_nos_based_on_fifo")
 
 	for item in item_list:
 		args_copy = copy.deepcopy(args)
 		args_copy.update(item)
 		out.append(get_pricing_rule_for_item(args_copy))
-		out.append(get_serial_no_for_item(args_copy))
+		if set_serial_nos_based_on_fifo:
+			out.append(get_serial_no_for_item(args_copy))
 	return out
 	
 def get_serial_no_for_item(args):
diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js
index dcbb56b..799730e 100644
--- a/erpnext/public/js/controllers/transaction.js
+++ b/erpnext/public/js/controllers/transaction.js
@@ -349,7 +349,7 @@
 						me.frm.set_value("letter_head", company_doc.default_letter_head);
 					}
 				}
-				if (company_doc.default_terms && me.frm.doc.doctype != "Purchase Invoice") {
+				if (company_doc.default_terms && me.frm.doc.doctype != "Purchase Invoice" && frappe.meta.has_field(me.frm.doc.doctype, "tc_name")) {
 					me.frm.set_value("tc_name", company_doc.default_terms);
 				}
 
diff --git a/erpnext/stock/doctype/quality_inspection/quality_inspection.js b/erpnext/stock/doctype/quality_inspection/quality_inspection.js
index 5d7b6b4..53579fb 100644
--- a/erpnext/stock/doctype/quality_inspection/quality_inspection.js
+++ b/erpnext/stock/doctype/quality_inspection/quality_inspection.js
@@ -9,7 +9,7 @@
 		return {
 			query: "erpnext.stock.doctype.quality_inspection.quality_inspection.item_query",
 			filters: {
-				"from": doc.reference_type,
+				"from": doc.reference_type + " Item",
 				"parent": doc.reference_name
 			}
 		}