Merge pull request #7826 from KanchanChauhan/landed-cost-voucher-test

[Minor] Landed Cost Voucher test case fixed
diff --git a/erpnext/__init__.py b/erpnext/__init__.py
index 2de394c..35508cc 100644
--- a/erpnext/__init__.py
+++ b/erpnext/__init__.py
@@ -2,7 +2,7 @@
 from __future__ import unicode_literals
 import frappe
 
-__version__ = '7.2.22'
+__version__ = '7.2.23'
 
 def get_default_company(user=None):
 	'''Get default company for user'''
diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.js b/erpnext/accounts/doctype/journal_entry/journal_entry.js
index fc261a5..bb01103 100644
--- a/erpnext/accounts/doctype/journal_entry/journal_entry.js
+++ b/erpnext/accounts/doctype/journal_entry/journal_entry.js
@@ -38,7 +38,7 @@
 	},
 	
 	posting_date: function(frm) {
-		if(!frm.doc.multi_currency) return;
+		if(!frm.doc.multi_currency || !frm.doc.posting_date) return;
 		
 		$.each(frm.doc.accounts || [], function(i, row) {
 			erpnext.journal_entry.set_exchange_rate(frm, row.doctype, row.name);
diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.py b/erpnext/accounts/doctype/journal_entry/journal_entry.py
index 0cf34dd..28a746e 100644
--- a/erpnext/accounts/doctype/journal_entry/journal_entry.py
+++ b/erpnext/accounts/doctype/journal_entry/journal_entry.py
@@ -837,7 +837,7 @@
 
 # Added posting_date as one of the parameters of get_exchange_rate
 @frappe.whitelist()
-def get_exchange_rate(posting_date, account, account_currency=None, company=None,
+def get_exchange_rate(posting_date, account=None, account_currency=None, company=None,
 		reference_type=None, reference_name=None, debit=None, credit=None, exchange_rate=None):
 	from erpnext.setup.utils import get_exchange_rate
 	account_details = frappe.db.get_value("Account", account,
diff --git a/erpnext/accounts/report/balance_sheet/balance_sheet.py b/erpnext/accounts/report/balance_sheet/balance_sheet.py
index 5ff8e3e..7e57dce 100644
--- a/erpnext/accounts/report/balance_sheet/balance_sheet.py
+++ b/erpnext/accounts/report/balance_sheet/balance_sheet.py
@@ -8,7 +8,7 @@
 from erpnext.accounts.report.financial_statements import (get_period_list, get_columns, get_data)
 
 def execute(filters=None):
-	period_list = get_period_list(filters.from_fiscal_year, filters.to_fiscal_year, filters.periodicity)
+	period_list = get_period_list(filters.from_fiscal_year, filters.to_fiscal_year, filters.periodicity, filters.company)
 
 	asset = get_data(filters.company, "Asset", "Debit", period_list, only_current_fiscal_year=False)
 	liability = get_data(filters.company, "Liability", "Credit", period_list, only_current_fiscal_year=False)
diff --git a/erpnext/accounts/report/cash_flow/cash_flow.py b/erpnext/accounts/report/cash_flow/cash_flow.py
index 7a776f5..d2c8c3e 100644
--- a/erpnext/accounts/report/cash_flow/cash_flow.py
+++ b/erpnext/accounts/report/cash_flow/cash_flow.py
@@ -11,7 +11,7 @@
 
 def execute(filters=None):
 	period_list = get_period_list(filters.from_fiscal_year, filters.to_fiscal_year, 
-		filters.periodicity)
+		filters.periodicity, filters.company)
 
 	operation_accounts = {
 		"section_name": "Operations",
diff --git a/erpnext/accounts/report/financial_statements.py b/erpnext/accounts/report/financial_statements.py
index c897d1c..5e84a65 100644
--- a/erpnext/accounts/report/financial_statements.py
+++ b/erpnext/accounts/report/financial_statements.py
@@ -6,7 +6,7 @@
 from frappe import _
 from frappe.utils import flt, getdate, get_first_day, add_months, add_days, formatdate
 
-def get_period_list(from_fiscal_year, to_fiscal_year, periodicity):
+def get_period_list(from_fiscal_year, to_fiscal_year, periodicity, company):
 	"""Get a list of dict {"from_date": from_date, "to_date": to_date, "key": key, "label": label}
 		Periodicity can be (Yearly, Quarterly, Monthly)"""
 
@@ -48,7 +48,7 @@
 			# if a fiscal year ends before a 12 month period
 			period.to_date = year_end_date
 
-		period.to_date_fiscal_year = get_date_fiscal_year(period.to_date)
+		period.to_date_fiscal_year = get_date_fiscal_year(period.to_date, company)
 
 		period_list.append(period)
 
@@ -140,14 +140,15 @@
 				if entry.posting_date <= period.to_date:
 					if (accumulated_values or entry.posting_date >= period.from_date) and \
 						(entry.fiscal_year == period.to_date_fiscal_year or not ignore_accumulated_values_for_fy):
+						frappe.errprint([entry.fiscal_year, period.to_date_fiscal_year])
 						d[period.key] = d.get(period.key, 0.0) + flt(entry.debit) - flt(entry.credit)
 
 			if entry.posting_date < period_list[0].year_start_date:
 				d["opening_balance"] = d.get("opening_balance", 0.0) + flt(entry.debit) - flt(entry.credit)
 				
-def get_date_fiscal_year(date):
+def get_date_fiscal_year(date, company):
 	from erpnext.accounts.utils import get_fiscal_year
-	return get_fiscal_year(date)[0]
+	return get_fiscal_year(date, company=company)[0]
 
 def accumulate_values_into_parents(accounts, accounts_by_name, period_list, accumulated_values):
 	"""accumulate children's values in parent accounts"""
diff --git a/erpnext/accounts/report/profit_and_loss_statement/profit_and_loss_statement.py b/erpnext/accounts/report/profit_and_loss_statement/profit_and_loss_statement.py
index 254523f..02dc870 100644
--- a/erpnext/accounts/report/profit_and_loss_statement/profit_and_loss_statement.py
+++ b/erpnext/accounts/report/profit_and_loss_statement/profit_and_loss_statement.py
@@ -8,7 +8,8 @@
 from erpnext.accounts.report.financial_statements import (get_period_list, get_columns, get_data)
 
 def execute(filters=None):
-	period_list = get_period_list(filters.from_fiscal_year, filters.to_fiscal_year, filters.periodicity)
+	period_list = get_period_list(filters.from_fiscal_year, filters.to_fiscal_year, 
+		filters.periodicity, filters.company)
 
 	income = get_data(filters.company, "Income", "Credit", period_list, filters = filters,
 		accumulated_values=filters.accumulated_values, ignore_closing_entries=True, ignore_accumulated_values_for_fy= True)
diff --git a/erpnext/hr/doctype/salary_slip/salary_slip.py b/erpnext/hr/doctype/salary_slip/salary_slip.py
index 55314ac..6ff6f36 100644
--- a/erpnext/hr/doctype/salary_slip/salary_slip.py
+++ b/erpnext/hr/doctype/salary_slip/salary_slip.py
@@ -155,11 +155,10 @@
 			cond = """and payroll_frequency = '%(payroll_frequency)s'""" % {"payroll_frequency": self.payroll_frequency}
 
 		st_name = frappe.db.sql("""select parent from `tabSalary Structure Employee`
-			where employee=%s
+			where employee=%s and (from_date <= %s or from_date <= %s)
+			and (to_date is null or to_date >= %s or to_date >= %s)
 			and parent in (select name from `tabSalary Structure`
-				where is_active = 'Yes'
-				and (from_date <= %s or from_date <= %s)
-				and (to_date is null or to_date >= %s or to_date >= %s) %s)
+				where is_active = 'Yes'%s)
 			"""% ('%s', '%s', '%s','%s','%s', cond),(self.employee, self.start_date, joining_date, self.end_date, relieving_date))
 
 		if st_name:
diff --git a/erpnext/hr/doctype/salary_slip/test_salary_slip.py b/erpnext/hr/doctype/salary_slip/test_salary_slip.py
index cf76ee7..ce20396 100644
--- a/erpnext/hr/doctype/salary_slip/test_salary_slip.py
+++ b/erpnext/hr/doctype/salary_slip/test_salary_slip.py
@@ -7,7 +7,7 @@
 import erpnext
 import calendar
 from erpnext.accounts.utils import get_fiscal_year
-from frappe.utils import getdate, nowdate, add_days, flt
+from frappe.utils import getdate, nowdate, add_days, add_months, flt
 from erpnext.hr.doctype.salary_structure.salary_structure import make_salary_slip
 from erpnext.hr.doctype.process_payroll.test_process_payroll import get_salary_component_account
 from erpnext.hr.doctype.process_payroll.process_payroll import get_month_details
@@ -273,7 +273,6 @@
 			"doctype": "Salary Structure",
 			"name": sal_struct,
 			"company": erpnext.get_default_company(),
-			"from_date": nowdate(),
 			"employees": get_employee_details(employee),
 			"earnings": get_earnings_component(),
 			"deductions": get_deductions_component(),
@@ -286,7 +285,8 @@
 		sal_struct.append("employees", {"employee": employee,
 			"employee_name": employee,
 			"base": 32000,
-			"variable": 3200
+			"variable": 3200,
+			"from_date": add_months(nowdate(),-1)
 			})
 		sal_struct.save()
 		sal_struct = sal_struct.name
@@ -295,7 +295,8 @@
 def get_employee_details(employee):
 	return [{"employee": employee,
 			"base": 50000,
-			"variable": 5000
+			"variable": 5000,
+			"from_date": add_months(nowdate(),-1)
 			}
 		]
 
diff --git a/erpnext/hr/doctype/salary_structure/salary_structure.json b/erpnext/hr/doctype/salary_structure/salary_structure.json
index 025dd73..74ead24 100644
--- a/erpnext/hr/doctype/salary_structure/salary_structure.json
+++ b/erpnext/hr/doctype/salary_structure/salary_structure.json
@@ -103,38 +103,6 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "default": "Monthly", 
-   "depends_on": "eval:(!doc.salary_slip_based_on_timesheet)", 
-   "fieldname": "payroll_frequency", 
-   "fieldtype": "Select", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "Payroll Frequency", 
-   "length": 0, 
-   "no_copy": 0, 
-   "options": "\nMonthly\nFortnightly\nBimonthly\nWeekly\nDaily", 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
    "fieldname": "column_break1", 
    "fieldtype": "Column Break", 
    "hidden": 0, 
@@ -195,6 +163,38 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "default": "Monthly", 
+   "depends_on": "eval:(!doc.salary_slip_based_on_timesheet)", 
+   "fieldname": "payroll_frequency", 
+   "fieldtype": "Select", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Payroll Frequency", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "\nMonthly\nFortnightly\nBimonthly\nWeekly\nDaily", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
    "default": "No", 
    "fieldname": "is_default", 
    "fieldtype": "Select", 
@@ -226,66 +226,6 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "fieldname": "from_date", 
-   "fieldtype": "Date", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 1, 
-   "in_standard_filter": 0, 
-   "label": "From Date", 
-   "length": 0, 
-   "no_copy": 0, 
-   "oldfieldname": "from_date", 
-   "oldfieldtype": "Date", 
-   "permlevel": 0, 
-   "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, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "to_date", 
-   "fieldtype": "Date", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 1, 
-   "in_standard_filter": 0, 
-   "label": "To Date", 
-   "length": 0, 
-   "no_copy": 0, 
-   "oldfieldname": "to_date", 
-   "oldfieldtype": "Date", 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
    "fieldname": "employee_break", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
diff --git a/erpnext/hr/doctype/salary_structure/salary_structure.py b/erpnext/hr/doctype/salary_structure/salary_structure.py
index d60cd35..22697f0 100644
--- a/erpnext/hr/doctype/salary_structure/salary_structure.py
+++ b/erpnext/hr/doctype/salary_structure/salary_structure.py
@@ -4,7 +4,7 @@
 from __future__ import unicode_literals
 import frappe
 
-from frappe.utils import flt, cint
+from frappe.utils import flt, cint, getdate
 from frappe import _
 from frappe.model.mapper import get_mapped_doc
 from frappe.model.document import Document
@@ -16,6 +16,7 @@
 		self.validate_amount()
 		for e in self.get('employees'):
 			set_employee_name(e)
+		self.validate_joining_date()
 
 	def get_ss_values(self,employee):
 		basic_info = frappe.db.sql("""select bank_name, bank_ac_no
@@ -27,7 +28,13 @@
 	def validate_amount(self):
 		if flt(self.net_pay) < 0 and self.salary_slip_based_on_timesheet:
 			frappe.throw(_("Net pay cannot be negative"))
-				
+
+	def validate_joining_date(self):
+		for e in self.get('employees'):
+			joining_date = getdate(frappe.db.get_value("Employee", e.employee, "date_of_joining"))
+			if e.from_date and getdate(e.from_date) < joining_date:
+				frappe.throw(_("From Date {0} for Employee {1} cannot be before employee's joining Date {2}")
+					    .format(e.from_date, e.employee, joining_date))	
 
 @frappe.whitelist()
 def make_salary_slip(source_name, target_doc = None, employee = None, as_print = False, print_format = None):
diff --git a/erpnext/hr/doctype/salary_structure/test_salary_structure.py b/erpnext/hr/doctype/salary_structure/test_salary_structure.py
index 665f8a8..7270ab7 100644
--- a/erpnext/hr/doctype/salary_structure/test_salary_structure.py
+++ b/erpnext/hr/doctype/salary_structure/test_salary_structure.py
@@ -6,7 +6,7 @@
 import unittest
 import erpnext
 from frappe.utils.make_random import get_random
-from frappe.utils import nowdate, add_days, add_years, getdate
+from frappe.utils import nowdate, add_days, add_years, getdate, add_months
 from erpnext.hr.doctype.salary_structure.salary_structure import make_salary_slip
 from erpnext.hr.doctype.salary_slip.test_salary_slip \
 	import make_earning_salary_component, make_deduction_salary_component
@@ -93,7 +93,6 @@
 			"doctype": "Salary Structure",
 			"name": sal_struct,
 			"company": erpnext.get_default_company(),
-			"from_date": nowdate(),
 			"employees": get_employee_details(),
 			"earnings": get_earnings_component(),
 			"deductions": get_deductions_component(),
@@ -107,11 +106,13 @@
 	return [{"employee": frappe.get_value("Employee", {"employee_name":"test_employee@salary.com"}, "name"),
 			"base": 25000,
 			"variable": 5000,
+			"from_date": add_months(nowdate(),-1),
 			"idx": 1
 			},
 			{"employee": frappe.get_value("Employee", {"employee_name":"test_employee_2@salary.com"}, "name"),
 			 "base": 15000,
 			 "variable": 100,
+			 "from_date": add_months(nowdate(),-1),
 			 "idx": 2
 			}
 		]
diff --git a/erpnext/hr/doctype/salary_structure_employee/salary_structure_employee.json b/erpnext/hr/doctype/salary_structure_employee/salary_structure_employee.json
index d169759..9725ff9 100644
--- a/erpnext/hr/doctype/salary_structure_employee/salary_structure_employee.json
+++ b/erpnext/hr/doctype/salary_structure_employee/salary_structure_employee.json
@@ -10,6 +10,7 @@
  "doctype": "DocType", 
  "document_type": "", 
  "editable_grid": 1, 
+ "engine": "InnoDB", 
  "fields": [
   {
    "allow_on_submit": 0, 
@@ -76,6 +77,62 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "fieldname": "from_date", 
+   "fieldtype": "Date", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "From Date", 
+   "length": 0, 
+   "no_copy": 0, 
+   "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, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "to_date", 
+   "fieldtype": "Date", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "To Date", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "base", 
    "fieldtype": "Currency", 
    "hidden": 0, 
diff --git a/erpnext/manufacturing/doctype/bom/bom.json b/erpnext/manufacturing/doctype/bom/bom.json
index 28d012f..9fa2a81 100644
--- a/erpnext/manufacturing/doctype/bom/bom.json
+++ b/erpnext/manufacturing/doctype/bom/bom.json
@@ -334,7 +334,7 @@
    "read_only": 0, 
    "remember_last_selected_value": 0, 
    "report_hide": 0, 
-   "reqd": 0, 
+   "reqd": 1, 
    "search_index": 0, 
    "set_only_once": 0, 
    "unique": 0
@@ -391,7 +391,7 @@
    "read_only": 0, 
    "remember_last_selected_value": 0, 
    "report_hide": 0, 
-   "reqd": 0, 
+   "reqd": 1, 
    "search_index": 0, 
    "set_only_once": 0, 
    "unique": 0
@@ -1010,7 +1010,7 @@
    "read_only": 0, 
    "remember_last_selected_value": 1, 
    "report_hide": 0, 
-   "reqd": 0, 
+   "reqd": 1, 
    "search_index": 0, 
    "set_only_once": 0, 
    "unique": 0
@@ -1585,7 +1585,7 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2017-02-17 17:05:55.685270", 
+ "modified": "2017-02-21 13:10:27.394012", 
  "modified_by": "Administrator", 
  "module": "Manufacturing", 
  "name": "BOM", 
diff --git a/erpnext/manufacturing/doctype/bom/bom.py b/erpnext/manufacturing/doctype/bom/bom.py
index a3d3da3..abb2817 100644
--- a/erpnext/manufacturing/doctype/bom/bom.py
+++ b/erpnext/manufacturing/doctype/bom/bom.py
@@ -332,9 +332,9 @@
 			if d.bom_no:
 				d.rate = self.get_bom_unitcost(d.bom_no)
 
-			d.base_rate = d.rate * self.conversion_rate
+			d.base_rate = flt(d.rate) * flt(self.conversion_rate)
 			d.amount = flt(d.rate, self.precision("rate", d)) * flt(d.qty, self.precision("qty", d))
-			d.base_amount = d.amount * self.conversion_rate
+			d.base_amount = d.amount * flt(self.conversion_rate)
 			d.qty_consumed_per_unit = flt(d.qty, self.precision("qty", d)) / flt(self.quantity, self.precision("quantity"))
 			total_rm_cost += d.amount
 			base_total_rm_cost += d.base_amount
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index 7d0ac97..4341057 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -375,3 +375,5 @@
 erpnext.patches.v7_2.empty_supplied_items_for_non_subcontracted
 erpnext.patches.v7_2.arrear_leave_encashment_as_salary_component
 erpnext.patches.v7_2.rename_att_date_attendance
+erpnext.patches.v7_2.update_attendance_docstatus
+erpnext.patches.v7_2.move_dates_from_salary_structure_to_employee
diff --git a/erpnext/patches/v7_2/move_dates_from_salary_structure_to_employee.py b/erpnext/patches/v7_2/move_dates_from_salary_structure_to_employee.py
new file mode 100644
index 0000000..98e076e
--- /dev/null
+++ b/erpnext/patches/v7_2/move_dates_from_salary_structure_to_employee.py
@@ -0,0 +1,9 @@
+import frappe
+
+def execute():
+	frappe.reload_doc('hr', 'doctype', 'salary_structure_employee')
+	salary_structures = frappe.db.sql("""select name, to_date, from_date from `tabSalary Structure`""", as_dict=True)
+
+	for salary_structure in salary_structures:
+		frappe.db.sql(""" update `tabSalary Structure Employee` set from_date = %s, to_date = %s
+			where parent = %s """, (salary_structure.from_date, salary_structure.to_date or 'null', salary_structure.name))
\ No newline at end of file
diff --git a/erpnext/patches/v7_2/update_attendance_docstatus.py b/erpnext/patches/v7_2/update_attendance_docstatus.py
new file mode 100644
index 0000000..6fbab01
--- /dev/null
+++ b/erpnext/patches/v7_2/update_attendance_docstatus.py
@@ -0,0 +1,10 @@
+import frappe
+
+def execute():
+	frappe.reload_doctype('Student Attendance')
+	# frappe.reload_doc("schools", "doctype", "student_attendance")
+	frappe.db.sql('''
+		update `tabStudent Attendance` set
+			docstatus=0
+		where
+			docstatus=1''')
\ No newline at end of file
diff --git a/erpnext/projects/doctype/timesheet/test_timesheet.py b/erpnext/projects/doctype/timesheet/test_timesheet.py
index 11d0b1c..1db0610 100644
--- a/erpnext/projects/doctype/timesheet/test_timesheet.py
+++ b/erpnext/projects/doctype/timesheet/test_timesheet.py
@@ -7,7 +7,7 @@
 import unittest
 import datetime
 from frappe.utils.make_random import get_random
-from frappe.utils import now_datetime, nowdate, add_days
+from frappe.utils import now_datetime, nowdate, add_days, add_months
 from erpnext.projects.doctype.timesheet.timesheet import OverlapError
 from erpnext.projects.doctype.timesheet.timesheet import make_salary_slip, make_sales_invoice
 from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice
@@ -88,7 +88,8 @@
 
 		es = salary_structure.append('employees', {
 			"employee": employee,
-			"base": 1200 
+			"base": 1200,
+			"from_date": add_months(nowdate(),-1)
 		})
 		
 		
diff --git a/erpnext/public/js/schools/student_button.html b/erpnext/public/js/schools/student_button.html
index dabaf26..4196808 100644
--- a/erpnext/public/js/schools/student_button.html
+++ b/erpnext/public/js/schools/student_button.html
@@ -1,5 +1,5 @@
 <div class="col-sm-3">
-    <div class="checkbox {% if status %} text-muted {% endif %}">
+    <div class="checkbox">
         <label>
             <input 
                 type="checkbox"
@@ -7,9 +7,6 @@
                 data-student="{{student}}"
                 data-student-name="{{student_name}}"
                 class="students-check" 
-                {% if status %} 
-                disabled="true"
-                {% endif %}
                 {% if status === "Present" %}
                 checked
                 {% endif %}
diff --git a/erpnext/schools/api.py b/erpnext/schools/api.py
index f1d3753..316f0dd 100644
--- a/erpnext/schools/api.py
+++ b/erpnext/schools/api.py
@@ -67,21 +67,31 @@
 	frappe.msgprint(_("Attendance has been marked successfully."))
 
 def make_attendance_records(student, student_name, status, course_schedule=None, student_batch=None, date=None):
-	"""Creates Attendance Record.
+	"""Creates/Update Attendance Record.
 
 	:param student: Student.
 	:param student_name: Student Name.
 	:param course_schedule: Course Schedule.
 	:param status: Status (Present/Absent)
 	"""
-	student_attendance = frappe.new_doc("Student Attendance")
+	student_attendance_list = frappe.get_list("Student Attendance", fields = ['name'], filters = {
+		"student": student,
+		"course_schedule": course_schedule,
+		"student_batch": student_batch,
+		"date": date
+	})
+		
+	if student_attendance_list:
+		student_attendance = frappe.get_doc("Student Attendance", student_attendance_list[0])
+	else:
+		student_attendance = frappe.new_doc("Student Attendance")
 	student_attendance.student = student
 	student_attendance.student_name = student_name
 	student_attendance.course_schedule = course_schedule
 	student_attendance.student_batch = student_batch
 	student_attendance.date = date
 	student_attendance.status = status
-	student_attendance.submit()
+	student_attendance.save()
 
 @frappe.whitelist()
 def get_student_guardians(student):
@@ -283,4 +293,4 @@
 			email = frappe.db.get_value("Guardian", guard.guardian, "email_address")
 			if email:
 				email_list.append(email)	
-	add_subscribers(name, email_list)
\ No newline at end of file
+	add_subscribers(name, email_list)
diff --git a/erpnext/schools/doctype/assessment_result/assessment_result.json b/erpnext/schools/doctype/assessment_result/assessment_result.json
index 87f4f44..d56c941 100644
--- a/erpnext/schools/doctype/assessment_result/assessment_result.json
+++ b/erpnext/schools/doctype/assessment_result/assessment_result.json
@@ -366,6 +366,63 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "fieldname": "section_break_13", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "comment", 
+   "fieldtype": "Long Text", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Comment", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "amended_from", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -401,7 +458,7 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2017-02-20 13:20:51.700918", 
+ "modified": "2017-02-21 08:03:46.054604", 
  "modified_by": "Administrator", 
  "module": "Schools", 
  "name": "Assessment Result", 
diff --git a/erpnext/schools/doctype/student_applicant/student_applicant.json b/erpnext/schools/doctype/student_applicant/student_applicant.json
index 27a88e9..315ba8cd 100644
--- a/erpnext/schools/doctype/student_applicant/student_applicant.json
+++ b/erpnext/schools/doctype/student_applicant/student_applicant.json
@@ -578,6 +578,7 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "default": "INDIAN", 
    "fieldname": "nationality", 
    "fieldtype": "Data", 
    "hidden": 0, 
@@ -1022,7 +1023,7 @@
  "istable": 0, 
  "max_attachments": 0, 
  "menu_index": 0, 
- "modified": "2017-02-20 13:20:10.117987", 
+ "modified": "2017-02-21 01:14:59.352772", 
  "modified_by": "Administrator", 
  "module": "Schools", 
  "name": "Student Applicant", 
@@ -1053,7 +1054,7 @@
  "quick_entry": 1, 
  "read_only": 0, 
  "read_only_onload": 0, 
- "show_name_in_global_search": 1, 
+ "show_name_in_global_search": 1,
  "sort_field": "modified", 
  "sort_order": "DESC", 
  "title_field": "title", 
diff --git a/erpnext/schools/doctype/student_attendance/student_attendance.json b/erpnext/schools/doctype/student_attendance/student_attendance.json
index df7fc14..e5a4075 100644
--- a/erpnext/schools/doctype/student_attendance/student_attendance.json
+++ b/erpnext/schools/doctype/student_attendance/student_attendance.json
@@ -170,7 +170,7 @@
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
-   "in_global_search": 1, 
+   "in_global_search": 1,
    "in_list_view": 0, 
    "in_standard_filter": 1, 
    "label": "Student Batch", 
@@ -256,11 +256,11 @@
  "image_view": 0, 
  "in_create": 0, 
  "in_dialog": 0, 
- "is_submittable": 1, 
+ "is_submittable": 0, 
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2017-02-20 13:19:02.708904", 
+ "modified": "2017-02-21 01:15:20.989687", 
  "modified_by": "Administrator", 
  "module": "Schools", 
  "name": "Student Attendance", 
@@ -268,9 +268,9 @@
  "owner": "Administrator", 
  "permissions": [
   {
-   "amend": 1, 
+   "amend": 0, 
    "apply_user_permissions": 0, 
-   "cancel": 1, 
+   "cancel": 0, 
    "create": 1, 
    "delete": 1, 
    "email": 1, 
@@ -284,7 +284,7 @@
    "role": "Academics User", 
    "set_user_permissions": 0, 
    "share": 1, 
-   "submit": 1, 
+   "submit": 0, 
    "write": 1
   }
  ], 
diff --git a/erpnext/schools/doctype/student_attendance_tool/student_attendance_tool.js b/erpnext/schools/doctype/student_attendance_tool/student_attendance_tool.js
index 7dd9dda..20fb2fd 100644
--- a/erpnext/schools/doctype/student_attendance_tool/student_attendance_tool.js
+++ b/erpnext/schools/doctype/student_attendance_tool/student_attendance_tool.js
@@ -3,148 +3,152 @@
 frappe.provide("schools")
 
 frappe.ui.form.on('Student Attendance Tool', {
-    refresh: function(frm) {
-        frm.disable_save();
-    },
+	refresh: function(frm) {
+		frm.disable_save();
+	},
 
-    based_on: function(frm) {
-        if (frm.doc.based_on == "Student Batch") {
-            frm.set_value("course_schedule", "");
-        } else {
-            frm.set_value("student_batch", "");
-        }
-    },
+	based_on: function(frm) {
+		if (frm.doc.based_on == "Student Batch") {
+			frm.set_value("course_schedule", "");
+		} else {
+			frm.set_value("student_batch", "");
+		}
+	},
 
-    student_batch: function(frm) {
-        if ((frm.doc.student_batch && frm.doc.date) || frm.doc.course_schedule) {
-            var method = "erpnext.schools.doctype.student_attendance_tool.student_attendance_tool.get_student_attendance_records";
+	student_batch: function(frm) {
+		if ((frm.doc.student_batch && frm.doc.date) || frm.doc.course_schedule) {
+			var method = "erpnext.schools.doctype.student_attendance_tool.student_attendance_tool.get_student_attendance_records";
 
-            frappe.call({
-                method: method,
-                args: {
-                    based_on: frm.doc.based_on,
-                    student_batch: frm.doc.student_batch,
-                    date: frm.doc.date,
-                    course_schedule: frm.doc.course_schedule
-                },
-                callback: function(r) {
-                    frm.events.get_students(frm, r.message);
-                }
-            })
-        }
-    },
+			frappe.call({
+				method: method,
+				args: {
+					based_on: frm.doc.based_on,
+					student_batch: frm.doc.student_batch,
+					date: frm.doc.date,
+					course_schedule: frm.doc.course_schedule
+				},
+				callback: function(r) {
+					frm.events.get_students(frm, r.message);
+				}
+			})
+		}
+	},
 
-    date: function(frm) {
-        frm.trigger("student_batch");
-    },
+	date: function(frm) {
+		frm.trigger("student_batch");
+	},
 
-    course_schedule: function(frm) {
-        frm.trigger("student_batch");
-    },
+	course_schedule: function(frm) {
+		frm.trigger("student_batch");
+	},
 
-    get_students: function(frm, students) {
-        if (!frm.students_area) {
-            frm.students_area = $('<div>')
-                .appendTo(frm.fields_dict.students_html.wrapper);
-        }
-        frm.students_editor = new schools.StudentsEditor(frm, frm.students_area, students)
-    }
+	get_students: function(frm, students) {
+		if (!frm.students_area) {
+			frm.students_area = $('<div>')
+				.appendTo(frm.fields_dict.students_html.wrapper);
+		}
+		frm.students_editor = new schools.StudentsEditor(frm, frm.students_area, students)
+	}
 });
 
 
 schools.StudentsEditor = Class.extend({
-    init: function(frm, wrapper, students) {
-        this.wrapper = wrapper;
-        this.frm = frm;
-        this.make(frm, students);
-    },
-    make: function(frm, students) {
-        var me = this;
+	init: function(frm, wrapper, students) {
+		this.wrapper = wrapper;
+		this.frm = frm;
+		this.make(frm, students);
+	},
+	make: function(frm, students) {
+		var me = this;
 
-        $(this.wrapper).empty();
-        var student_toolbar = $('<p>\
+		$(this.wrapper).empty();
+		var student_toolbar = $('<p>\
 			<button class="btn btn-default btn-add btn-xs" style="margin-right: 5px;"></button>\
 			<button class="btn btn-xs btn-default btn-remove" style="margin-right: 5px;"></button>\
 			<button class="btn btn-default btn-primary btn-mark-att btn-xs"></button></p>').appendTo($(this.wrapper));
 
-        student_toolbar.find(".btn-add")
-            .html(__('Check all'))
-            .on("click", function() {
-                $(me.wrapper).find('input[type="checkbox"]').each(function(i, check) {
-                    if (!$(check).prop("disabled")) {
-                        check.checked = true;
-                    }
-                });
-            });
+		student_toolbar.find(".btn-add")
+			.html(__('Check all'))
+			.on("click", function() {
+				$(me.wrapper).find('input[type="checkbox"]').each(function(i, check) {
+					if (!$(check).prop("disabled")) {
+						check.checked = true;
+					}
+				});
+			});
 
-        student_toolbar.find(".btn-remove")
-            .html(__('Uncheck all'))
-            .on("click", function() {
-                $(me.wrapper).find('input[type="checkbox"]').each(function(i, check) {
-                    if (!$(check).prop("disabled")) {
-                        check.checked = false;
-                    }
-                });
-            });
+		student_toolbar.find(".btn-remove")
+			.html(__('Uncheck all'))
+			.on("click", function() {
+				$(me.wrapper).find('input[type="checkbox"]').each(function(i, check) {
+					if (!$(check).prop("disabled")) {
+						check.checked = false;
+					}
+				});
+			});
 
-        var get_present_student = function(student) {
-            return students.filter(function(s) {
-                return s.idx === idx;
-            })
-        }
-        var get_absent_student = function(idx) {
-            return students.filter(function(s) {
-                return s.idx === idx;
-            })
-        }
+		var get_present_student = function(student) {
+			return students.filter(function(s) {
+				return s.idx === idx;
+			})
+		}
+		var get_absent_student = function(idx) {
+			return students.filter(function(s) {
+				return s.idx === idx;
+			})
+		}
 
-        student_toolbar.find(".btn-mark-att")
-            .html(__('Mark Attendence'))
-            .on("click", function() {
-                var studs = [];
-                $(me.wrapper.find('input[type="checkbox"]')).each(function(i, check) {
-                    var $check = $(check);
-                    studs.push({
-                        student: $check.data().student,
-                        student_name: $check.data().studentName,
-                        idx: $check.data().idx,
-                        disabled: $check.prop("disabled"),
-                        checked: $check.is(":checked")
-                    });
-                });
+		student_toolbar.find(".btn-mark-att")
+			.html(__('Mark Attendence'))
+			.on("click", function() {
+				var studs = [];
+				$(me.wrapper.find('input[type="checkbox"]')).each(function(i, check) {
+					var $check = $(check);
+					studs.push({
+						student: $check.data().student,
+						student_name: $check.data().studentName,
+						idx: $check.data().idx,
+						disabled: $check.prop("disabled"),
+						checked: $check.is(":checked")
+					});
+				});
 
-                var students_present = studs.filter(function(stud) {
-                    return !stud.disabled && stud.checked;
-                });
+				var students_present = studs.filter(function(stud) {
+					return !stud.disabled && stud.checked;
+				});
 
-                var students_absent = studs.filter(function(stud) {
-                    return !stud.disabled && !stud.checked;
-                });
+				var students_absent = studs.filter(function(stud) {
+					return !stud.disabled && !stud.checked;
+				});
 
-                frappe.call({
-                    method: "erpnext.schools.api.mark_attendance",
-                    args: {
-                        "students_present": students_present,
-                        "students_absent": students_absent,
-                        "student_batch": frm.doc.student_batch,
-                        "course_schedule": frm.doc.course_schedule,
-                        "date": frm.doc.date
-                    },
-                    callback: function(r) {
-                        frm.trigger("student_batch");
-                    }
-                });
-            });
+				frappe.confirm(__("Do you want to update attendance?<br>Present: {0}\
+					<br>Absent: {1}", [students_present.length, students_absent.length]), function() {
+					frappe.call({
+						method: "erpnext.schools.api.mark_attendance",
+						args: {
+							"students_present": students_present,
+							"students_absent": students_absent,
+							"student_batch": frm.doc.student_batch,
+							"course_schedule": frm.doc.course_schedule,
+							"date": frm.doc.date
+						},
+						callback: function(r) {
+							frm.trigger("student_batch");
+						}
+					});
+				});
 
-        var htmls = students.map(function(student) {
-            return frappe.render_template("student_button", {
-                student: student.student,
-                student_name: student.student_name,
-                idx: student.idx,
-                status: student.status
-            })
-        });
+			});
 
-        $(htmls.join("")).appendTo(me.wrapper);
-    }
+		var htmls = students.map(function(student) {
+			return frappe.render_template("student_button", {
+				student: student.student,
+				student_name: student.student_name,
+				idx: student.idx,
+				status: student.status
+			})
+		});
+
+		$(htmls.join("")).appendTo(me.wrapper);
+	}
 });
\ No newline at end of file
diff --git a/erpnext/schools/doctype/student_attendance_tool/student_attendance_tool.json b/erpnext/schools/doctype/student_attendance_tool/student_attendance_tool.json
index 092af04..51b015c 100644
--- a/erpnext/schools/doctype/student_attendance_tool/student_attendance_tool.json
+++ b/erpnext/schools/doctype/student_attendance_tool/student_attendance_tool.json
@@ -23,6 +23,7 @@
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
+   "in_global_search": 0, 
    "in_list_view": 0, 
    "in_standard_filter": 0, 
    "label": "Based On", 
@@ -52,6 +53,7 @@
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
+   "in_global_search": 0, 
    "in_list_view": 0, 
    "in_standard_filter": 0, 
    "length": 0, 
@@ -80,6 +82,7 @@
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
+   "in_global_search": 0, 
    "in_list_view": 0, 
    "in_standard_filter": 0, 
    "label": "Student Batch", 
@@ -110,6 +113,7 @@
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
+   "in_global_search": 0, 
    "in_list_view": 0, 
    "in_standard_filter": 0, 
    "label": "Course Schedule", 
@@ -140,6 +144,7 @@
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
+   "in_global_search": 0, 
    "in_list_view": 0, 
    "in_standard_filter": 0, 
    "label": "Date", 
@@ -169,6 +174,7 @@
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
+   "in_global_search": 0, 
    "in_list_view": 0, 
    "in_standard_filter": 0, 
    "label": "Attendance", 
@@ -197,6 +203,7 @@
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
+   "in_global_search": 0, 
    "in_list_view": 0, 
    "in_standard_filter": 0, 
    "label": "Students HTML", 
@@ -225,7 +232,7 @@
  "issingle": 1, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2016-12-09 17:36:28.739318", 
+ "modified": "2017-02-21 01:15:11.435110", 
  "modified_by": "Administrator", 
  "module": "Schools", 
  "name": "Student Attendance Tool", 
@@ -242,7 +249,6 @@
    "export": 0, 
    "if_owner": 0, 
    "import": 0, 
-   "is_custom": 0, 
    "permlevel": 0, 
    "print": 0, 
    "read": 1, 
@@ -263,7 +269,6 @@
    "export": 0, 
    "if_owner": 0, 
    "import": 0, 
-   "is_custom": 0, 
    "permlevel": 0, 
    "print": 1, 
    "read": 1, 
@@ -278,7 +283,9 @@
  "quick_entry": 0, 
  "read_only": 0, 
  "read_only_onload": 0, 
+ "show_name_in_global_search": 0, 
  "sort_field": "modified", 
  "sort_order": "DESC", 
+ "track_changes": 0, 
  "track_seen": 0
 }
\ No newline at end of file
diff --git a/erpnext/schools/doctype/student_attendance_tool/student_attendance_tool.py b/erpnext/schools/doctype/student_attendance_tool/student_attendance_tool.py
index 58588a9..0734747 100644
--- a/erpnext/schools/doctype/student_attendance_tool/student_attendance_tool.py
+++ b/erpnext/schools/doctype/student_attendance_tool/student_attendance_tool.py
@@ -27,10 +27,10 @@
 	
 	if course_schedule:
 		student_attendance_list= frappe.db.sql("""select student, status from `tabStudent Attendance` where \
-			course_schedule= %s and docstatus=1""", (course_schedule), as_dict=1)
+			course_schedule= %s""", (course_schedule), as_dict=1)
 	else:
 		student_attendance_list= frappe.db.sql("""select student, status from `tabStudent Attendance` where \
-			student_batch= %s and date= %s and docstatus=1 and \
+			student_batch= %s and date= %s and \
 			(course_schedule is Null or course_schedule='')""",
 			(student_batch, date), as_dict=1)
 	
@@ -38,4 +38,5 @@
 		for student in student_list:
 			if student.student == attendance.student:
 				student.status = attendance.status
+
 	return student_list
\ No newline at end of file
diff --git a/erpnext/schools/doctype/student_language/__init__.py b/erpnext/schools/doctype/student_language/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/erpnext/schools/doctype/student_language/__init__.py
diff --git a/erpnext/schools/doctype/student_language/student_language.js b/erpnext/schools/doctype/student_language/student_language.js
new file mode 100644
index 0000000..6239ed1
--- /dev/null
+++ b/erpnext/schools/doctype/student_language/student_language.js
@@ -0,0 +1,8 @@
+// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
+// For license information, please see license.txt
+
+frappe.ui.form.on('Student Language', {
+	refresh: function(frm) {
+
+	}
+});
diff --git a/erpnext/schools/doctype/student_language/student_language.json b/erpnext/schools/doctype/student_language/student_language.json
new file mode 100644
index 0000000..f3b4eb1
--- /dev/null
+++ b/erpnext/schools/doctype/student_language/student_language.json
@@ -0,0 +1,92 @@
+{
+ "allow_copy": 0, 
+ "allow_import": 0, 
+ "allow_rename": 0, 
+ "autoname": "field:language_name", 
+ "beta": 0, 
+ "creation": "2017-02-21 01:55:00.366273", 
+ "custom": 0, 
+ "docstatus": 0, 
+ "doctype": "DocType", 
+ "document_type": "", 
+ "editable_grid": 1, 
+ "engine": "InnoDB", 
+ "fields": [
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "language_name", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Language Name", 
+   "length": 0, 
+   "no_copy": 0, 
+   "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, 
+   "set_only_once": 0, 
+   "unique": 0
+  }
+ ], 
+ "hide_heading": 0, 
+ "hide_toolbar": 0, 
+ "idx": 0, 
+ "image_view": 0, 
+ "in_create": 0, 
+ "in_dialog": 0, 
+ "is_submittable": 0, 
+ "issingle": 0, 
+ "istable": 0, 
+ "max_attachments": 0, 
+ "modified": "2017-02-22 13:03:48.600707", 
+ "modified_by": "Administrator", 
+ "module": "Schools", 
+ "name": "Student Language", 
+ "name_case": "", 
+ "owner": "Administrator", 
+ "permissions": [
+  {
+   "amend": 0, 
+   "apply_user_permissions": 0, 
+   "cancel": 0, 
+   "create": 1, 
+   "delete": 1, 
+   "email": 1, 
+   "export": 1, 
+   "if_owner": 0, 
+   "import": 0, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Academics User", 
+   "set_user_permissions": 0, 
+   "share": 1, 
+   "submit": 0, 
+   "write": 1
+  }
+ ], 
+ "quick_entry": 1, 
+ "read_only": 0, 
+ "read_only_onload": 0, 
+ "show_name_in_global_search": 0, 
+ "sort_field": "modified", 
+ "sort_order": "DESC", 
+ "title_field": "", 
+ "track_changes": 1, 
+ "track_seen": 0
+}
\ No newline at end of file
diff --git a/erpnext/schools/doctype/student_language/student_language.py b/erpnext/schools/doctype/student_language/student_language.py
new file mode 100644
index 0000000..be6d5de
--- /dev/null
+++ b/erpnext/schools/doctype/student_language/student_language.py
@@ -0,0 +1,10 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+import frappe
+from frappe.model.document import Document
+
+class StudentLanguage(Document):
+	pass
diff --git a/erpnext/schools/doctype/student_language/test_student_language.py b/erpnext/schools/doctype/student_language/test_student_language.py
new file mode 100644
index 0000000..592b94a
--- /dev/null
+++ b/erpnext/schools/doctype/student_language/test_student_language.py
@@ -0,0 +1,12 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
+# See license.txt
+from __future__ import unicode_literals
+
+import frappe
+import unittest
+
+# test_records = frappe.get_test_records('Student Language')
+
+class TestStudentLanguage(unittest.TestCase):
+	pass
diff --git a/erpnext/schools/report/absent_student_report/absent_student_report.py b/erpnext/schools/report/absent_student_report/absent_student_report.py
index 11b2e13..ba2b7ad 100644
--- a/erpnext/schools/report/absent_student_report/absent_student_report.py
+++ b/erpnext/schools/report/absent_student_report/absent_student_report.py
@@ -49,7 +49,7 @@
 
 def get_absent_students(date):
 	absent_students = frappe.db.sql("""select student, student_name, student_batch from `tabStudent Attendance` 
-		where docstatus = 1 and status="Absent" and date = %s order by student_batch, student_name""", date, as_dict=1)
+		where status="Absent" and date = %s order by student_batch, student_name""", date, as_dict=1)
 	return absent_students
 
 def get_leave_applications(date):
diff --git a/erpnext/schools/report/student_batch_wise_attendance/student_batch_wise_attendance.py b/erpnext/schools/report/student_batch_wise_attendance/student_batch_wise_attendance.py
index b6bedcb..d8df3a0 100644
--- a/erpnext/schools/report/student_batch_wise_attendance/student_batch_wise_attendance.py
+++ b/erpnext/schools/report/student_batch_wise_attendance/student_batch_wise_attendance.py
@@ -58,7 +58,7 @@
 
 def get_student_attendance(student_batch, date):
 	student_attendance = frappe.db.sql("""select count(*) as count, status from `tabStudent Attendance` where \
-				student_batch= %s and date= %s and docstatus=1 and\
+				student_batch= %s and date= %s and\
 				(course_schedule is Null or course_schedule='') group by status""",
 				(student_batch, date), as_dict=1)
 	return student_attendance
\ No newline at end of file
diff --git a/erpnext/schools/report/student_monthly_attendance_sheet/student_monthly_attendance_sheet.py b/erpnext/schools/report/student_monthly_attendance_sheet/student_monthly_attendance_sheet.py
index 01cee58..f906034 100644
--- a/erpnext/schools/report/student_monthly_attendance_sheet/student_monthly_attendance_sheet.py
+++ b/erpnext/schools/report/student_monthly_attendance_sheet/student_monthly_attendance_sheet.py
@@ -53,7 +53,7 @@
 
 def get_attendance_list(from_date, to_date, student_batch, students_list):
 	attendance_list = frappe.db.sql("""select student, date, status 
-		from `tabStudent Attendance` where docstatus = 1 and student_batch = %s 
+		from `tabStudent Attendance` where student_batch = %s 
 		and date between %s and %s
 		order by student, date""",
 		(student_batch, from_date, to_date), as_dict=1)
diff --git a/erpnext/schools/web_form/student_applicant/student_applicant.json b/erpnext/schools/web_form/student_applicant/student_applicant.json
index 1feb159..f87a147 100644
--- a/erpnext/schools/web_form/student_applicant/student_applicant.json
+++ b/erpnext/schools/web_form/student_applicant/student_applicant.json
@@ -16,7 +16,7 @@
  "is_standard": 1, 
  "login_required": 1, 
  "max_attachment_size": 0, 
- "modified": "2017-02-12 01:28:57.997942", 
+ "modified": "2017-02-21 04:44:46.022738", 
  "modified_by": "Administrator", 
  "module": "Schools", 
  "name": "student-applicant", 
@@ -133,6 +133,7 @@
    "reqd": 0
   }, 
   {
+   "default": "INDIAN", 
    "fieldname": "nationality", 
    "fieldtype": "Data", 
    "hidden": 0,