Fixed merge conflict
diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md
new file mode 100644
index 0000000..aa3a104
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/bug_report.md
@@ -0,0 +1,68 @@
+---
+name: Bug report
+about: Create a report to help us improve
+
+---
+
+Issue: Bug report
+
+Our project, as you've probably heard, is getting really popular and truth is we're getting a bit overwhelmed by the activity surrounding it. There are just too many issues for us to manage properly.
+
+**Do the checklist before filing an issue:**
+ - [ ] Have a usage question? Ask your question on  [Discuss Forum](https://discuss.erpnext.com). We use [Discuss Forum](https://discuss.erpnext.com) for usage question and GitHub for bugs.
+ - [ ] Can you replicate the issue? 
+ - [ ] Is this something you can debug and fix? Send a pull request! Bug fixes and documentation fixes are welcome
+
+**Describe the bug** :chart_with_downwards_trend: 
+A clear and concise description of what the bug is.
+
+**To Reproduce** :page_with_curl:
+Steps to reproduce the behavior:
+1. Go to '...'
+2. Click on '....'
+3. Scroll down to '....'
+4. See error
+
+**Expected behavior** :chart_with_upwards_trend:
+A clear and concise description of what you expected to happen.
+
+**Screenshots** :crystal_ball:
+If applicable, add screenshots to help explain your problem.
+
+**Desktop (please complete the following information):** :cyclone:
+ - OS:
+    - [ ] Linux
+    - [ ] macOS
+    - [ ] Windows
+    - [ ] Others? Please mention: 
+ - Browser:
+    - [ ] Safari
+    - [ ] Chrome
+    - [ ] Firefox
+    - [ ] Other? Please mention: 
+
+**Smartphone (please complete the following information):** :iphone: :computer:
+ - Device:
+    - [ ] iPhone
+    - [ ] Android
+ - Browser:
+    - [ ] Safari
+    - [ ] Chrome
+    - [ ] Firefox
+    - [ ] Other? Please mention: 
+
+**Version Information**
+- Which branch are you on?
+    - [ ] `master` :star2: 
+    - [ ] `develop` :fire:
+- Frappe Version: 
+- ERPNext Version: 
+
+**Additional context** :page_facing_up:
+Add any other context about the problem here.
+
+**Possible Solution** :bookmark_tabs:
+Any idea what might be causing the issue. Or if you have a proposed solution to the problem,
+
+**Please don't be intimidated by the long list of options you've fill. Try to fill out as much as you can. Remember, the more the information the easier it is for us to replicate and fix the issue** :grin: 
+
diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md
new file mode 100644
index 0000000..e09e5e9
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/feature_request.md
@@ -0,0 +1,21 @@
+---
+name: Feature request
+about: Suggest an idea for this project
+
+---
+
+Issue: Feature Request
+
+**Is your feature request related to a problem? Please describe.**
+A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
+
+**Describe the solution you'd like**
+A clear and concise description of what you want to happen.
+
+**Describe alternatives you've considered**
+A clear and concise description of any alternative solutions or features you've considered.
+
+**Additional context**
+Add any other context or screenshots about the feature request here.
+
+
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
new file mode 100644
index 0000000..8e2bd85
--- /dev/null
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -0,0 +1,28 @@
+Pull-Request
+
+- [ ] Have you followed the guidelines in our Contributing document?
+- [ ] Have you checked to ensure there aren't other open [Pull Requests](../pulls) for the same update/change?
+- [ ] Have you lint your code locally prior to submission?
+- [ ] Have you successfully run tests with your changes locally?
+- [ ] Does your commit message have an explanation for your changes and why you'd like us to include them?
+- [ ] Docs have been added / updated
+- [ ] Tests for the changes have been added (for bug fixes / features)
+- [ ] Did you modify the existing test cases? If yes, why?
+
+---
+
+What type of a PR is this? 
+
+- [ ] Changes to Existing Features
+- [ ] New Feature Submissions
+- [ ] Bug Fix
+- [ ] Breaking Change
+
+--- 
+
+- Motivation and Context (What existing problem does the pull request solve):
+- Related Issue: 
+- Screenshots (if applicable, remember, a picture tells a thousand words): 
+
+**Please don't be intimidated by the long list of options you've fill. Try to fill out as much as you can. Remember, the more the information the easier it is for us to test and get your pull request merged** :grin: 
+
diff --git a/.gitignore b/.gitignore
index 68272c7..2b52a49 100644
--- a/.gitignore
+++ b/.gitignore
@@ -9,6 +9,9 @@
 dist/
 erpnext/docs/current
 *.swp
+<<<<<<< HEAD
 *.swo
 __pycache__
 *~
+=======
+>>>>>>> master
diff --git a/.travis.yml b/.travis.yml
index 74ed7b7..b8ffffb 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -4,10 +4,6 @@
 python:
   - "2.7"
   - "3.6"
-  
- matrix:
-  - allow_failures:
-    - python: "3.6"
 
 services:
   - mysql
@@ -57,3 +53,5 @@
         - bench --force restore ~/frappe-bench/20171108_190013_955977f8_database.sql.gz --mariadb-root-password travis
         - bench migrate
       env: Patch Testing
+  allow_failures:
+    - python: "3.6"
\ No newline at end of file
diff --git a/erpnext/__init__.py b/erpnext/__init__.py
index 28212c5..b9e3cfc 100644
--- a/erpnext/__init__.py
+++ b/erpnext/__init__.py
@@ -5,7 +5,7 @@
 from erpnext.hooks import regional_overrides
 from frappe.utils import getdate
 
-__version__ = '10.1.35'
+__version__ = '10.1.36'
 
 def get_default_company(user=None):
 	'''Get default company for user'''
diff --git a/erpnext/hr/doctype/additional_salary_component/__init__.py b/erpnext/accounts/doctype/bank_account/__init__.py
similarity index 100%
copy from erpnext/hr/doctype/additional_salary_component/__init__.py
copy to erpnext/accounts/doctype/bank_account/__init__.py
diff --git a/erpnext/accounts/doctype/bank_account/bank_account.js b/erpnext/accounts/doctype/bank_account/bank_account.js
new file mode 100644
index 0000000..5ac41e4
--- /dev/null
+++ b/erpnext/accounts/doctype/bank_account/bank_account.js
@@ -0,0 +1,28 @@
+// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
+// For license information, please see license.txt
+
+frappe.ui.form.on('Bank Account', {
+	setup: function(frm) {
+		frm.set_query("account", function() {
+			return {
+				filters: {
+					'account_type': 'Bank',
+					'company': frm.doc.company,
+					'is_group': 0
+				}
+			};
+		});
+	},
+	refresh: function(frm) {
+		frappe.dynamic_link = { doc: frm.doc, fieldname: 'name', doctype: 'Bank Account' }
+		
+		frm.toggle_display(['address_html','contact_html'], !frm.doc.__islocal);
+
+		if (frm.doc.__islocal) {
+			frappe.contacts.clear_address_and_contact(frm);
+		}
+		else {
+			frappe.contacts.render_address_and_contact(frm);
+		}
+	}
+});
diff --git a/erpnext/accounts/doctype/bank_account/bank_account.json b/erpnext/accounts/doctype/bank_account/bank_account.json
new file mode 100644
index 0000000..4f84cbb
--- /dev/null
+++ b/erpnext/accounts/doctype/bank_account/bank_account.json
@@ -0,0 +1,533 @@
+{
+ "allow_copy": 0,
+ "allow_guest_to_view": 0,
+ "allow_import": 0,
+ "allow_rename": 1,
+ "autoname": "field:account_name",
+ "beta": 0,
+ "creation": "2017-05-29 21:35:13.136357",
+ "custom": 0,
+ "docstatus": 0,
+ "doctype": "DocType",
+ "document_type": "Setup",
+ "editable_grid": 0,
+ "engine": "InnoDB",
+ "fields": [
+  {
+   "allow_bulk_edit": 0,
+   "allow_in_quick_entry": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fieldname": "account_name",
+   "fieldtype": "Data",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_global_search": 1,
+   "in_list_view": 1,
+   "in_standard_filter": 1,
+   "label": "Account 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": 1,
+   "set_only_once": 0,
+   "translatable": 0,
+   "unique": 0
+  },
+  {
+   "allow_bulk_edit": 0,
+   "allow_in_quick_entry": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fieldname": "account",
+   "fieldtype": "Link",
+   "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": "Account",
+   "length": 0,
+   "no_copy": 0,
+   "options": "Account",
+   "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,
+   "translatable": 0,
+   "unique": 0
+  },
+  {
+   "allow_bulk_edit": 0,
+   "allow_in_quick_entry": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fieldname": "company",
+   "fieldtype": "Link",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_global_search": 0,
+   "in_list_view": 1,
+   "in_standard_filter": 1,
+   "label": "Company",
+   "length": 0,
+   "no_copy": 0,
+   "options": "Company",
+   "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,
+   "translatable": 0,
+   "unique": 0
+  },
+  {
+   "allow_bulk_edit": 0,
+   "allow_in_quick_entry": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fieldname": "bank",
+   "fieldtype": "Link",
+   "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": "Bank",
+   "length": 0,
+   "no_copy": 0,
+   "options": "Bank",
+   "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,
+   "translatable": 0,
+   "unique": 0
+  },
+  {
+   "allow_bulk_edit": 0,
+   "allow_in_quick_entry": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fieldname": "column_break_7",
+   "fieldtype": "Column 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,
+   "label": "",
+   "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": 1,
+   "set_only_once": 0,
+   "translatable": 0,
+   "unique": 0
+  },
+  {
+   "allow_bulk_edit": 0,
+   "allow_in_quick_entry": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fieldname": "bank_account_no",
+   "fieldtype": "Data",
+   "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": "Bank Account No",
+   "length": 30,
+   "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,
+   "translatable": 0,
+   "unique": 0
+  },
+  {
+   "allow_bulk_edit": 0,
+   "allow_in_quick_entry": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fieldname": "iban",
+   "fieldtype": "Data",
+   "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": "IBAN",
+   "length": 25,
+   "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,
+   "translatable": 0,
+   "unique": 0
+  },
+  {
+   "allow_bulk_edit": 0,
+   "allow_in_quick_entry": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fieldname": "branch_code",
+   "fieldtype": "Data",
+   "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": "Branch Code",
+   "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,
+   "translatable": 0,
+   "unique": 0
+  },
+  {
+   "allow_bulk_edit": 0,
+   "allow_in_quick_entry": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fieldname": "swift_number",
+   "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": "SWIFT number",
+   "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,
+   "translatable": 0,
+   "unique": 0
+  },
+  {
+   "allow_bulk_edit": 0,
+   "allow_in_quick_entry": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fieldname": "address_and_contact",
+   "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,
+   "label": "Address and Contact",
+   "length": 0,
+   "no_copy": 0,
+   "options": "fa fa-map-marker",
+   "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,
+   "translatable": 0,
+   "unique": 0
+  },
+  {
+   "allow_bulk_edit": 0,
+   "allow_in_quick_entry": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fieldname": "address_html",
+   "fieldtype": "HTML",
+   "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": "Address HTML",
+   "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,
+   "translatable": 0,
+   "unique": 0
+  },
+  {
+   "allow_bulk_edit": 0,
+   "allow_in_quick_entry": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fieldname": "website",
+   "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": "Website",
+   "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,
+   "translatable": 0,
+   "unique": 0
+  },
+  {
+   "allow_bulk_edit": 0,
+   "allow_in_quick_entry": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fieldname": "column_break_12",
+   "fieldtype": "Column 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,
+   "translatable": 0,
+   "unique": 0
+  },
+  {
+   "allow_bulk_edit": 0,
+   "allow_in_quick_entry": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fieldname": "contact_html",
+   "fieldtype": "HTML",
+   "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": "Contact HTML",
+   "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,
+   "translatable": 0,
+   "unique": 0
+  }
+ ],
+ "has_web_view": 0,
+ "hide_heading": 0,
+ "hide_toolbar": 0,
+ "idx": 0,
+ "image_view": 0,
+ "in_create": 0,
+ "is_submittable": 0,
+ "issingle": 0,
+ "istable": 0,
+ "max_attachments": 0,
+ "modified": "2018-05-30 17:44:06.032697",
+ "modified_by": "Administrator",
+ "module": "Accounts",
+ "name": "Bank Account",
+ "name_case": "",
+ "owner": "Administrator",
+ "permissions": [
+  {
+   "amend": 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": "Accounts Manager",
+   "set_user_permissions": 0,
+   "share": 1,
+   "submit": 0,
+   "write": 1
+  },
+  {
+   "amend": 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": "Accounts User",
+   "set_user_permissions": 0,
+   "share": 1,
+   "submit": 0,
+   "write": 1
+  }
+ ],
+ "quick_entry": 0,
+ "read_only": 0,
+ "read_only_onload": 0,
+ "search_fields": "bank,account",
+ "show_name_in_global_search": 0,
+ "sort_field": "modified",
+ "sort_order": "DESC",
+ "track_changes": 1,
+ "track_seen": 0
+}
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/bank_account/bank_account.py b/erpnext/accounts/doctype/bank_account/bank_account.py
new file mode 100644
index 0000000..e3aef15
--- /dev/null
+++ b/erpnext/accounts/doctype/bank_account/bank_account.py
@@ -0,0 +1,16 @@
+# -*- 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
+from frappe.contacts.address_and_contact import load_address_and_contact, delete_contact_and_address
+
+class BankAccount(Document):
+	def onload(self):
+		"""Load address and contacts in `__onload`"""
+		load_address_and_contact(self)
+
+	def on_trash(self):
+		delete_contact_and_address('BankAccount', self.name)
diff --git a/erpnext/hr/doctype/additional_salary_component/test_additional_salary_component.js b/erpnext/accounts/doctype/bank_account/test_bank_account.js
similarity index 65%
rename from erpnext/hr/doctype/additional_salary_component/test_additional_salary_component.js
rename to erpnext/accounts/doctype/bank_account/test_bank_account.js
index 118290b..c20a799 100644
--- a/erpnext/hr/doctype/additional_salary_component/test_additional_salary_component.js
+++ b/erpnext/accounts/doctype/bank_account/test_bank_account.js
@@ -2,15 +2,15 @@
 // rename this file from _test_[name] to test_[name] to activate
 // and remove above this line
 
-QUnit.test("test: Additional Salary Component", function (assert) {
+QUnit.test("test: Bank Account", function (assert) {
 	let done = assert.async();
 
 	// number of asserts
 	assert.expect(1);
 
 	frappe.run_serially([
-		// insert a new Additional Salary Component
-		() => frappe.tests.make('Additional Salary Component', [
+		// insert a new Bank Account
+		() => frappe.tests.make('Bank Account', [
 			// values to be set
 			{key: 'value'}
 		]),
diff --git a/erpnext/accounts/doctype/bank_account/test_bank_account.py b/erpnext/accounts/doctype/bank_account/test_bank_account.py
new file mode 100644
index 0000000..43a3298
--- /dev/null
+++ b/erpnext/accounts/doctype/bank_account/test_bank_account.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('Bank Account')
+
+class TestBankAccount(unittest.TestCase):
+	pass
diff --git a/erpnext/accounts/doctype/bank_guarantee/bank_guarantee.js b/erpnext/accounts/doctype/bank_guarantee/bank_guarantee.js
index f7ffc6c..2a44cb3 100644
--- a/erpnext/accounts/doctype/bank_guarantee/bank_guarantee.js
+++ b/erpnext/accounts/doctype/bank_guarantee/bank_guarantee.js
@@ -1,20 +1,33 @@
 // Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
 // For license information, please see license.txt
 
+cur_frm.add_fetch('bank_account','account','account');
+cur_frm.add_fetch('bank_account','bank_account_no','bank_account_no');
+cur_frm.add_fetch('bank_account','iban','iban');
+cur_frm.add_fetch('bank_account','branch_code','branch_code');
+cur_frm.add_fetch('bank_account','swift_number','swift_number');
+
 frappe.ui.form.on('Bank Guarantee', {
 	setup: function(frm) {
-		cur_frm.set_query("account", function() {
+		frm.set_query("bank", function() {
 			return {
-				"filters": {
-					"account_type": "Bank",
-					"is_group": 0
+				filters: {
+					company: frm.doc.company
 				}
 			};
 		});
-		cur_frm.set_query("project", function() {
+		frm.set_query("bank_account", function() {
 			return {
-				"filters": {
-					"customer": cur_frm.doc.customer
+				filters: {
+					company: frm.doc.company,
+					bank: frm.doc.bank
+				}
+			}
+		});
+		frm.set_query("project", function() {
+			return {
+				filters: {
+					customer: frm.doc.customer
 				}
 			};
 		});
@@ -60,4 +73,4 @@
 		var end_date = frappe.datetime.add_days(cur_frm.doc.start_date, cur_frm.doc.validity - 1);
 		cur_frm.set_value("end_date", end_date);
 	}
-});
\ No newline at end of file
+});
diff --git a/erpnext/accounts/doctype/bank_guarantee/bank_guarantee.json b/erpnext/accounts/doctype/bank_guarantee/bank_guarantee.json
index b3cd157..0d21cab 100644
--- a/erpnext/accounts/doctype/bank_guarantee/bank_guarantee.json
+++ b/erpnext/accounts/doctype/bank_guarantee/bank_guarantee.json
@@ -1,807 +1,1055 @@
 {
- "allow_copy": 0, 
- "allow_guest_to_view": 0, 
- "allow_import": 0, 
- "allow_rename": 0, 
- "autoname": "BG-.#####", 
- "beta": 0, 
- "creation": "2016-12-17 10:43:35.731631", 
- "custom": 0, 
- "docstatus": 0, 
- "doctype": "DocType", 
- "document_type": "Document", 
- "editable_grid": 1, 
- "engine": "InnoDB", 
+ "allow_copy": 0,
+ "allow_guest_to_view": 0,
+ "allow_import": 0,
+ "allow_rename": 0,
+ "autoname": "BG-.#####",
+ "beta": 0,
+ "creation": "2016-12-17 10:43:35.731631",
+ "custom": 0,
+ "docstatus": 0,
+ "doctype": "DocType",
+ "document_type": "Document",
+ "editable_grid": 1,
+ "engine": "InnoDB",
  "fields": [
   {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "bg_type", 
-   "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": "Bank Guarantee Type", 
-   "length": 0, 
-   "no_copy": 0, 
-   "options": "\nReceiving\nProviding", 
-   "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, 
-   "translatable": 0, 
+   "allow_bulk_edit": 0,
+   "allow_in_quick_entry": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fieldname": "bg_type",
+   "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": "Bank Guarantee Type",
+   "length": 0,
+   "no_copy": 0,
+   "options": "\nReceiving\nProviding",
+   "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,
+   "translatable": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "reference_doctype", 
-   "fieldtype": "Link", 
-   "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": "Reference Document Type", 
-   "length": 0, 
-   "no_copy": 0, 
-   "options": "DocType", 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 1, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "translatable": 0, 
+   "allow_bulk_edit": 0,
+   "allow_in_quick_entry": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fieldname": "reference_doctype",
+   "fieldtype": "Link",
+   "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": "Reference Document Type",
+   "length": 0,
+   "no_copy": 0,
+   "options": "DocType",
+   "permlevel": 0,
+   "precision": "",
+   "print_hide": 0,
+   "print_hide_if_no_value": 0,
+   "read_only": 1,
+   "remember_last_selected_value": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
+   "translatable": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "reference_docname", 
-   "fieldtype": "Dynamic Link", 
-   "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": "Reference Document Name", 
-   "length": 0, 
-   "no_copy": 0, 
-   "options": "reference_doctype", 
-   "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, 
-   "translatable": 0, 
+   "allow_bulk_edit": 0,
+   "allow_in_quick_entry": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fieldname": "reference_docname",
+   "fieldtype": "Dynamic Link",
+   "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": "Reference Document Name",
+   "length": 0,
+   "no_copy": 0,
+   "options": "reference_doctype",
+   "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,
+   "translatable": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "depends_on": "eval: doc.bg_type == \"Receiving\"", 
-   "fieldname": "customer", 
-   "fieldtype": "Link", 
-   "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": "Customer", 
-   "length": 0, 
-   "no_copy": 0, 
-   "options": "Customer", 
-   "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, 
-   "translatable": 0, 
+   "allow_bulk_edit": 0,
+   "allow_in_quick_entry": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "depends_on": "eval: doc.bg_type == \"Receiving\"",
+   "fieldname": "customer",
+   "fieldtype": "Link",
+   "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": "Customer",
+   "length": 0,
+   "no_copy": 0,
+   "options": "Customer",
+   "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,
+   "translatable": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "depends_on": "eval: doc.bg_type == \"Providing\"", 
-   "fieldname": "supplier", 
-   "fieldtype": "Link", 
-   "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": "Supplier", 
-   "length": 0, 
-   "no_copy": 0, 
-   "options": "Supplier", 
-   "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, 
-   "translatable": 0, 
+   "allow_bulk_edit": 0,
+   "allow_in_quick_entry": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "depends_on": "eval: doc.bg_type == \"Providing\"",
+   "fieldname": "supplier",
+   "fieldtype": "Link",
+   "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": "Supplier",
+   "length": 0,
+   "no_copy": 0,
+   "options": "Supplier",
+   "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,
+   "translatable": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 1, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "project", 
-   "fieldtype": "Link", 
-   "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": "Project", 
-   "length": 0, 
-   "no_copy": 0, 
-   "options": "Project", 
-   "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, 
-   "translatable": 0, 
+   "allow_bulk_edit": 0,
+   "allow_in_quick_entry": 0,
+   "allow_on_submit": 1,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fieldname": "project",
+   "fieldtype": "Link",
+   "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": "Project",
+   "length": 0,
+   "no_copy": 0,
+   "options": "Project",
+   "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,
+   "translatable": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "column_break_6", 
-   "fieldtype": "Column 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, 
-   "translatable": 0, 
+   "allow_bulk_edit": 0,
+   "allow_in_quick_entry": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fieldname": "column_break_6",
+   "fieldtype": "Column 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,
+   "translatable": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "account", 
-   "fieldtype": "Link", 
-   "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": "Bank Account", 
-   "length": 0, 
-   "no_copy": 0, 
-   "options": "Account", 
-   "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, 
-   "translatable": 0, 
+   "allow_bulk_edit": 0,
+   "allow_in_quick_entry": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fieldname": "amount",
+   "fieldtype": "Currency",
+   "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": "Amount",
+   "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,
+   "translatable": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "amount", 
-   "fieldtype": "Currency", 
-   "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": "Amount", 
-   "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, 
-   "translatable": 0, 
+   "allow_bulk_edit": 0,
+   "allow_in_quick_entry": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fieldname": "start_date",
+   "fieldtype": "Date",
+   "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": "Start 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,
+   "translatable": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "start_date", 
-   "fieldtype": "Date", 
-   "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": "Start 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, 
-   "translatable": 0, 
+   "allow_bulk_edit": 0,
+   "allow_in_quick_entry": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "description": "",
+   "fieldname": "validity",
+   "fieldtype": "Int",
+   "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": "Validity in Days",
+   "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,
+   "translatable": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "description": "", 
-   "fieldname": "validity", 
-   "fieldtype": "Int", 
-   "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": "Validity in Days", 
-   "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, 
-   "translatable": 0, 
+   "allow_bulk_edit": 0,
+   "allow_in_quick_entry": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fieldname": "end_date",
+   "fieldtype": "Date",
+   "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": "End Date",
+   "length": 0,
+   "no_copy": 0,
+   "permlevel": 0,
+   "precision": "",
+   "print_hide": 0,
+   "print_hide_if_no_value": 0,
+   "read_only": 1,
+   "remember_last_selected_value": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
+   "translatable": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "end_date", 
-   "fieldtype": "Date", 
-   "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": "End Date", 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 1, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "translatable": 0, 
+   "allow_bulk_edit": 0,
+   "allow_in_quick_entry": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fieldname": "bank_account_info",
+   "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,
+   "label": "Bank Account Info",
+   "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,
+   "translatable": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "section_break_14", 
-   "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, 
-   "label": "", 
-   "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, 
-   "translatable": 0, 
+   "allow_bulk_edit": 0,
+   "allow_in_quick_entry": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fieldname": "bank",
+   "fieldtype": "Link",
+   "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": "Bank",
+   "length": 0,
+   "no_copy": 0,
+   "options": "Bank",
+   "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,
+   "translatable": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "more_information", 
-   "fieldtype": "Text Editor", 
-   "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": "Clauses and Conditions", 
-   "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, 
-   "translatable": 0, 
+   "allow_bulk_edit": 0,
+   "allow_in_quick_entry": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fieldname": "bank_account",
+   "fieldtype": "Link",
+   "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": "Bank Account",
+   "length": 0,
+   "no_copy": 0,
+   "options": "Bank Account",
+   "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,
+   "translatable": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "margin_details", 
-   "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, 
-   "label": "Other Details", 
-   "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, 
-   "translatable": 0, 
+   "allow_bulk_edit": 0,
+   "allow_in_quick_entry": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fieldname": "account",
+   "fieldtype": "Link",
+   "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": "Account",
+   "length": 0,
+   "no_copy": 0,
+   "options": "Account",
+   "permlevel": 0,
+   "precision": "",
+   "print_hide": 0,
+   "print_hide_if_no_value": 0,
+   "read_only": 1,
+   "remember_last_selected_value": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
+   "translatable": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "bank_guarantee_number", 
-   "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": "Bank Guarantee Number", 
-   "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, 
-   "translatable": 0, 
+   "allow_bulk_edit": 0,
+   "allow_in_quick_entry": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fieldname": "bank_account_no",
+   "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": "Bank Account No",
+   "length": 0,
+   "no_copy": 0,
+   "permlevel": 0,
+   "precision": "",
+   "print_hide": 0,
+   "print_hide_if_no_value": 0,
+   "read_only": 1,
+   "remember_last_selected_value": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
+   "translatable": 0,
+   "unique": 0
+  },
+  {
+   "allow_bulk_edit": 0,
+   "allow_in_quick_entry": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fieldname": "column_break_17",
+   "fieldtype": "Column 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,
+   "translatable": 0,
+   "unique": 0
+  },
+  {
+   "allow_bulk_edit": 0,
+   "allow_in_quick_entry": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fieldname": "iban",
+   "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": "IBAN",
+   "length": 0,
+   "no_copy": 0,
+   "permlevel": 0,
+   "precision": "",
+   "print_hide": 0,
+   "print_hide_if_no_value": 0,
+   "read_only": 1,
+   "remember_last_selected_value": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
+   "translatable": 0,
+   "unique": 0
+  },
+  {
+   "allow_bulk_edit": 0,
+   "allow_in_quick_entry": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fieldname": "branch_code",
+   "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": "Branch Code",
+   "length": 0,
+   "no_copy": 0,
+   "permlevel": 0,
+   "precision": "",
+   "print_hide": 0,
+   "print_hide_if_no_value": 0,
+   "read_only": 1,
+   "remember_last_selected_value": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
+   "translatable": 0,
+   "unique": 0
+  },
+  {
+   "allow_bulk_edit": 0,
+   "allow_in_quick_entry": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fieldname": "swift_number",
+   "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": "SWIFT number",
+   "length": 0,
+   "no_copy": 0,
+   "permlevel": 0,
+   "precision": "",
+   "print_hide": 0,
+   "print_hide_if_no_value": 0,
+   "read_only": 1,
+   "remember_last_selected_value": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
+   "translatable": 0,
+   "unique": 0
+  },
+  {
+   "allow_bulk_edit": 0,
+   "allow_in_quick_entry": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fieldname": "section_break_14",
+   "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,
+   "label": "",
+   "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,
+   "translatable": 0,
+   "unique": 0
+  },
+  {
+   "allow_bulk_edit": 0,
+   "allow_in_quick_entry": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fieldname": "more_information",
+   "fieldtype": "Text Editor",
+   "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": "Clauses and Conditions",
+   "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,
+   "translatable": 0,
+   "unique": 0
+  },
+  {
+   "allow_bulk_edit": 0,
+   "allow_in_quick_entry": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fieldname": "margin_details",
+   "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,
+   "label": "Other Details",
+   "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,
+   "translatable": 0,
+   "unique": 0
+  },
+  {
+   "allow_bulk_edit": 0,
+   "allow_in_quick_entry": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fieldname": "bank_guarantee_number",
+   "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": "Bank Guarantee Number",
+   "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,
+   "translatable": 0,
    "unique": 1
-  }, 
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "name_of_beneficiary", 
-   "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": "Name of Beneficiary", 
-   "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, 
-   "translatable": 0, 
+   "allow_bulk_edit": 0,
+   "allow_in_quick_entry": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fieldname": "name_of_beneficiary",
+   "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": "Name of Beneficiary",
+   "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,
+   "translatable": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "name_of_bank", 
-   "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": "Name of Bank", 
-   "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, 
-   "translatable": 0, 
+   "allow_bulk_edit": 0,
+   "allow_in_quick_entry": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fieldname": "column_break_19",
+   "fieldtype": "Column 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,
+   "translatable": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "column_break_19", 
-   "fieldtype": "Column 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, 
-   "translatable": 0, 
+   "allow_bulk_edit": 0,
+   "allow_in_quick_entry": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fieldname": "margin_money",
+   "fieldtype": "Currency",
+   "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": "Margin Money",
+   "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,
+   "translatable": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "margin_money", 
-   "fieldtype": "Currency", 
-   "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": "Margin Money", 
-   "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, 
-   "translatable": 0, 
+   "allow_bulk_edit": 0,
+   "allow_in_quick_entry": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "default": "",
+   "depends_on": "",
+   "fieldname": "charges",
+   "fieldtype": "Currency",
+   "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": "Charges Incurred",
+   "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,
+   "translatable": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "default": "", 
-   "depends_on": "", 
-   "fieldname": "charges", 
-   "fieldtype": "Currency", 
-   "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": "Charges Incurred", 
-   "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, 
-   "translatable": 0, 
+   "allow_bulk_edit": 0,
+   "allow_in_quick_entry": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "depends_on": "",
+   "fieldname": "fixed_deposit_number",
+   "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": "Fixed Deposit Number",
+   "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,
+   "translatable": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "depends_on": "", 
-   "fieldname": "fixed_deposit_number", 
-   "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": "Fixed Deposit Number", 
-   "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, 
-   "translatable": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "amended_from", 
-   "fieldtype": "Link", 
-   "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": "Amended From", 
-   "length": 0, 
-   "no_copy": 1, 
-   "options": "Bank Guarantee", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 1, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "translatable": 0, 
+   "allow_bulk_edit": 0,
+   "allow_in_quick_entry": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fieldname": "amended_from",
+   "fieldtype": "Link",
+   "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": "Amended From",
+   "length": 0,
+   "no_copy": 1,
+   "options": "Bank Guarantee",
+   "permlevel": 0,
+   "print_hide": 1,
+   "print_hide_if_no_value": 0,
+   "read_only": 1,
+   "remember_last_selected_value": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
+   "translatable": 0,
    "unique": 0
   }
- ], 
- "has_web_view": 0, 
- "hide_heading": 0, 
- "hide_toolbar": 0, 
- "idx": 0, 
- "image_view": 0, 
- "in_create": 0, 
- "is_submittable": 1, 
- "issingle": 0, 
- "istable": 0, 
- "max_attachments": 0, 
- "modified": "2018-05-08 06:27:08.959864", 
- "modified_by": "Administrator", 
- "module": "Accounts", 
- "name": "Bank Guarantee", 
- "name_case": "", 
- "owner": "Administrator", 
+ ],
+ "has_web_view": 0,
+ "hide_heading": 0,
+ "hide_toolbar": 0,
+ "idx": 0,
+ "image_view": 0,
+ "in_create": 0,
+ "is_submittable": 1,
+ "issingle": 0,
+ "istable": 0,
+ "max_attachments": 0,
+ "modified": "2018-05-30 17:35:43.391115",
+ "modified_by": "Administrator",
+ "module": "Accounts",
+ "name": "Bank Guarantee",
+ "name_case": "",
+ "owner": "Administrator",
  "permissions": [
   {
-   "amend": 0, 
-   "cancel": 0, 
-   "create": 1, 
-   "delete": 0, 
-   "email": 1, 
-   "export": 1, 
-   "if_owner": 0, 
-   "import": 0, 
-   "permlevel": 0, 
-   "print": 1, 
-   "read": 1, 
-   "report": 1, 
-   "role": "Accounts User", 
-   "set_user_permissions": 0, 
-   "share": 1, 
-   "submit": 1, 
+   "amend": 0,
+   "cancel": 0,
+   "create": 1,
+   "delete": 0,
+   "email": 1,
+   "export": 1,
+   "if_owner": 0,
+   "import": 0,
+   "permlevel": 0,
+   "print": 1,
+   "read": 1,
+   "report": 1,
+   "role": "Accounts User",
+   "set_user_permissions": 0,
+   "share": 1,
+   "submit": 1,
    "write": 1
-  }, 
+  },
   {
-   "amend": 0, 
-   "cancel": 1, 
-   "create": 1, 
-   "delete": 1, 
-   "email": 1, 
-   "export": 1, 
-   "if_owner": 0, 
-   "import": 0, 
-   "permlevel": 0, 
-   "print": 1, 
-   "read": 1, 
-   "report": 1, 
-   "role": "Accounts Manager", 
-   "set_user_permissions": 0, 
-   "share": 1, 
-   "submit": 1, 
+   "amend": 0,
+   "cancel": 1,
+   "create": 1,
+   "delete": 1,
+   "email": 1,
+   "export": 1,
+   "if_owner": 0,
+   "import": 0,
+   "permlevel": 0,
+   "print": 1,
+   "read": 1,
+   "report": 1,
+   "role": "Accounts Manager",
+   "set_user_permissions": 0,
+   "share": 1,
+   "submit": 1,
    "write": 1
   }
- ], 
- "quick_entry": 1, 
- "read_only": 0, 
- "read_only_onload": 0, 
- "search_fields": "customer", 
- "show_name_in_global_search": 0, 
- "sort_field": "modified", 
- "sort_order": "DESC", 
- "title_field": "customer", 
- "track_changes": 0, 
+ ],
+ "quick_entry": 1,
+ "read_only": 0,
+ "read_only_onload": 0,
+ "search_fields": "customer",
+ "show_name_in_global_search": 0,
+ "sort_field": "modified",
+ "sort_order": "DESC",
+ "title_field": "customer",
+ "track_changes": 0,
  "track_seen": 0
 }
\ No newline at end of file
diff --git a/erpnext/hr/doctype/additional_salary_component/test_additional_salary_component.js b/erpnext/accounts/doctype/bank_guarantee/test_bank_guarantee.js
similarity index 65%
copy from erpnext/hr/doctype/additional_salary_component/test_additional_salary_component.js
copy to erpnext/accounts/doctype/bank_guarantee/test_bank_guarantee.js
index 118290b..0c60920 100644
--- a/erpnext/hr/doctype/additional_salary_component/test_additional_salary_component.js
+++ b/erpnext/accounts/doctype/bank_guarantee/test_bank_guarantee.js
@@ -2,15 +2,15 @@
 // rename this file from _test_[name] to test_[name] to activate
 // and remove above this line
 
-QUnit.test("test: Additional Salary Component", function (assert) {
+QUnit.test("test: Bank Guarantee", function (assert) {
 	let done = assert.async();
 
 	// number of asserts
 	assert.expect(1);
 
 	frappe.run_serially([
-		// insert a new Additional Salary Component
-		() => frappe.tests.make('Additional Salary Component', [
+		// insert a new Bank Guarantee
+		() => frappe.tests.make('Bank Guarantee', [
 			// values to be set
 			{key: 'value'}
 		]),
diff --git a/erpnext/hr/doctype/additional_salary_component/test_additional_salary_component.py b/erpnext/accounts/doctype/bank_guarantee/test_bank_guarantee.py
similarity index 74%
copy from erpnext/hr/doctype/additional_salary_component/test_additional_salary_component.py
copy to erpnext/accounts/doctype/bank_guarantee/test_bank_guarantee.py
index eda2f79..816743a 100644
--- a/erpnext/hr/doctype/additional_salary_component/test_additional_salary_component.py
+++ b/erpnext/accounts/doctype/bank_guarantee/test_bank_guarantee.py
@@ -2,7 +2,9 @@
 # Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors
 # See license.txt
 from __future__ import unicode_literals
+
+import frappe
 import unittest
 
-class TestAdditionalSalaryComponent(unittest.TestCase):
+class TestBankGuarantee(unittest.TestCase):
 	pass
diff --git a/erpnext/accounts/doctype/budget/budget.json b/erpnext/accounts/doctype/budget/budget.json
index 7c273ee..63322a7 100644
--- a/erpnext/accounts/doctype/budget/budget.json
+++ b/erpnext/accounts/doctype/budget/budget.json
@@ -13,6 +13,7 @@
  "fields": [
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -46,6 +47,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -78,6 +80,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -111,6 +114,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -144,6 +148,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -176,6 +181,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -206,6 +212,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -239,6 +246,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -270,6 +278,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -301,6 +310,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -332,6 +342,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -366,6 +377,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -400,6 +412,38 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "column_break_13", 
+   "fieldtype": "Column 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, 
+   "translatable": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -431,6 +475,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -465,6 +510,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -499,6 +545,38 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "section_break_16", 
+   "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, 
+   "translatable": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -530,6 +608,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -564,6 +643,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -598,6 +678,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -640,7 +721,7 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2018-05-15 19:26:13.840265", 
+ "modified": "2018-05-31 00:21:23.449225", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Budget", 
diff --git a/erpnext/accounts/doctype/payment_schedule/payment_schedule.json b/erpnext/accounts/doctype/payment_schedule/payment_schedule.json
index a145e85..83e3ba0 100644
--- a/erpnext/accounts/doctype/payment_schedule/payment_schedule.json
+++ b/erpnext/accounts/doctype/payment_schedule/payment_schedule.json
@@ -116,6 +116,7 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 2, 
+   "fetch_from": "payment_term.invoice_portion", 
    "fieldname": "invoice_portion", 
    "fieldtype": "Percent", 
    "hidden": 0, 
@@ -128,7 +129,7 @@
    "label": "Invoice Portion", 
    "length": 0, 
    "no_copy": 0, 
-   "options": "payment_term.invoice_portion", 
+   "options": "", 
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 1, 
@@ -217,7 +218,7 @@
  "issingle": 0, 
  "istable": 1, 
  "max_attachments": 0, 
- "modified": "2018-05-16 22:43:31.890251",
+ "modified": "2018-05-25 22:43:31.890251",
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Payment Schedule", 
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json
index 8f4e4bf..b62a0f0 100755
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json
@@ -1507,6 +1507,37 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "fieldname": "total_qty", 
+   "fieldtype": "Float", 
+   "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": "Total Quantity", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "translatable": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "base_total", 
    "fieldtype": "Currency", 
    "hidden": 0, 
@@ -3681,6 +3712,65 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "fieldname": "group_same_items",
+   "fieldtype": "Check",
+   "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": "Group same items",
+   "length": 0,
+   "no_copy": 0,
+   "permlevel": 0,
+   "precision": "",
+   "print_hide": 1,
+   "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_bulk_edit": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fieldname": "column_break_112",
+   "fieldtype": "Column 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_bulk_edit": 0,
+   "allow_on_submit": 1,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
    "fieldname": "select_print_heading", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -4233,7 +4323,7 @@
  "istable": 0, 
  "max_attachments": 0, 
  "menu_index": 0, 
- "modified": "2018-05-16 22:43:03.488958",
+ "modified": "2018-05-28 02:38:40.310899",
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Purchase Invoice", 
diff --git a/erpnext/accounts/doctype/sales_invoice/pos.py b/erpnext/accounts/doctype/sales_invoice/pos.py
index 86491f8..43a0d01 100755
--- a/erpnext/accounts/doctype/sales_invoice/pos.py
+++ b/erpnext/accounts/doctype/sales_invoice/pos.py
@@ -158,9 +158,8 @@
 		# Get items based on the item groups defined in the POS profile
 		for d in pos_profile.get('item_groups'):
 			args_list.extend([d.name for d in get_child_nodes('Item Group', d.item_group)])
-		cond = "and i.item_group in (%s)" % (', '.join(['%s'] * len(args_list)))
-		
-		args_list = [company] + args_list
+		if args_list:
+			cond = "and i.item_group in (%s)" % (', '.join(['%s'] * len(args_list)))
 
 	return frappe.db.sql("""
 		select
@@ -172,7 +171,7 @@
 		where
 			i.disabled = 0 and i.has_variants = 0 and i.is_sales_item = 1
 			{cond}
-		""".format(cond=cond), tuple(args_list), as_dict=1)
+		""".format(cond=cond), tuple([company] + args_list), as_dict=1)
 
 
 def get_item_groups(pos_profile):
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json
index c32db74..c173e9c 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json
@@ -1763,6 +1763,37 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "fieldname": "total_qty", 
+   "fieldtype": "Float", 
+   "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": "Total Quantity", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "translatable": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "base_total", 
    "fieldtype": "Currency", 
    "hidden": 0, 
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
index 3750c2d..d0994eb 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
@@ -341,9 +341,8 @@
 			# set pos values in items
 			for item in self.get("items"):
 				if item.get('item_code'):
-					for fname, val in get_pos_profile_item_details(pos,
-						iteritems(frappe._dict(item.as_dict()), pos)):
-
+					profile_details = get_pos_profile_item_details(pos, frappe._dict(item.as_dict()), pos)
+					for fname, val in iteritems(profile_details):
 						if (not for_validate) or (for_validate and not item.get(fname)):
 							item.set(fname, val)
 
diff --git a/erpnext/accounts/party.py b/erpnext/accounts/party.py
index c35242e..92fc610 100644
--- a/erpnext/accounts/party.py
+++ b/erpnext/accounts/party.py
@@ -400,10 +400,21 @@
 	from frappe.desk.form.load import get_communication_data
 
 	out = {}
+	fields = 'date(creation), count(name)'
+	after = add_years(None, -1).strftime('%Y-%m-%d')
+	group_by='group by date(creation)'
+
 	data = get_communication_data(doctype, name,
-		fields = 'date(creation), count(name)',
-		after = add_years(None, -1).strftime('%Y-%m-%d'),
-		group_by='group by date(creation)', as_dict=False)
+		fields=fields, after=after, group_by=group_by, as_dict=False)
+
+	# fetch and append data from Activity Log
+	data += frappe.db.sql("""select {fields}
+		from `tabActivity Log`
+		where reference_doctype='{doctype}' and reference_name='{name}'
+		and status!='Success' and creation > {after}
+		{group_by} order by creation desc
+		""".format(doctype=doctype, name=name, fields=fields,
+			group_by=group_by, after=after), as_dict=False)
 
 	timeline_items = dict(data)
 
diff --git a/erpnext/accounts/report/consolidated_financial_statement/consolidated_financial_statement.py b/erpnext/accounts/report/consolidated_financial_statement/consolidated_financial_statement.py
index 39f4771..380e3a2 100644
--- a/erpnext/accounts/report/consolidated_financial_statement/consolidated_financial_statement.py
+++ b/erpnext/accounts/report/consolidated_financial_statement/consolidated_financial_statement.py
@@ -365,10 +365,10 @@
 	company_finance_book = erpnext.get_default_finance_book(filters.get("company"))
 
 	if not filters.get('finance_book') or (filters.get('finance_book') == company_finance_book):
-		additional_conditions.append("finance_book in ('%s', '')" %
+		additional_conditions.append("ifnull(finance_book, '') in ('%s', '')" %
 			frappe.db.escape(company_finance_book))
 	elif filters.get("finance_book"):
-		additional_conditions.append("finance_book = '%s' " %
+		additional_conditions.append("ifnull(finance_book, '') = '%s' " %
 			frappe.db.escape(filters.get("finance_book")))
 
 	return " and {}".format(" and ".join(additional_conditions)) if additional_conditions else ""
diff --git a/erpnext/accounts/report/financial_statements.py b/erpnext/accounts/report/financial_statements.py
index 7300b9c..f8eec9e 100644
--- a/erpnext/accounts/report/financial_statements.py
+++ b/erpnext/accounts/report/financial_statements.py
@@ -380,10 +380,10 @@
 		company_finance_book = erpnext.get_default_finance_book(filters.get("company"))
 
 		if not filters.get('finance_book') or (filters.get('finance_book') == company_finance_book):
-			additional_conditions.append("finance_book in ('%s', '')" %
+			additional_conditions.append("ifnull(finance_book, '') in ('%s', '')" %
 				frappe.db.escape(company_finance_book))
 		elif filters.get("finance_book"):
-			additional_conditions.append("finance_book = '%s' " %
+			additional_conditions.append("ifnull(finance_book, '') = '%s' " %
 				frappe.db.escape(filters.get("finance_book")))
 
 	return " and {}".format(" and ".join(additional_conditions)) if additional_conditions else ""
diff --git a/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py b/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py
index 710099e..72661ff 100644
--- a/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py
+++ b/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py
@@ -49,7 +49,7 @@
 
 		row += [
 			d.credit_to, d.mode_of_payment, d.project, d.company, d.purchase_order,
-			purchase_receipt, expense_account, d.stock_qty, d.stock_uom, d.base_net_rate, d.base_net_amount
+			purchase_receipt, expense_account, d.stock_qty, d.stock_uom, d.base_net_amount / d.stock_qty, d.base_net_amount
 		]
 
 		total_tax = 0
@@ -120,8 +120,7 @@
 			`tabPurchase Invoice Item`.`project`, `tabPurchase Invoice Item`.`purchase_order`,
 			`tabPurchase Invoice Item`.`purchase_receipt`, `tabPurchase Invoice Item`.`po_detail`,
 			`tabPurchase Invoice Item`.`expense_account`, `tabPurchase Invoice Item`.`stock_qty`,
-			`tabPurchase Invoice Item`.`stock_uom`, `tabPurchase Invoice Item`.`base_net_rate`,
-			`tabPurchase Invoice Item`.`base_net_amount`,
+			`tabPurchase Invoice Item`.`stock_uom`, `tabPurchase Invoice Item`.`base_net_amount`,
 			`tabPurchase Invoice`.supplier_name, `tabPurchase Invoice`.mode_of_payment {0}
 		from `tabPurchase Invoice`, `tabPurchase Invoice Item`
 		where `tabPurchase Invoice`.name = `tabPurchase Invoice Item`.`parent` and
diff --git a/erpnext/accounts/report/sales_payment_summary/sales_payment_summary.py b/erpnext/accounts/report/sales_payment_summary/sales_payment_summary.py
index 4fcc05b..0c11d52 100644
--- a/erpnext/accounts/report/sales_payment_summary/sales_payment_summary.py
+++ b/erpnext/accounts/report/sales_payment_summary/sales_payment_summary.py
@@ -5,22 +5,59 @@
 from frappe import _
 from frappe.utils import cstr
 
+
 def execute(filters=None):
 	columns, data = [], []
-	columns=get_columns()
-	data=get_sales_payment_data(filters, columns)
+	columns = get_columns(filters)
+	data = get_pos_sales_payment_data(filters) if filters.get('is_pos') else get_sales_payment_data(filters, columns)
 	return columns, data
 
-def get_columns():
+
+def get_pos_columns():
 	return [
 		_("Date") + ":Date:80",
 		_("Owner") + ":Data:200",
 		_("Payment Mode") + ":Data:240",
 		_("Sales and Returns") + ":Currency/currency:120",
 		_("Taxes") + ":Currency/currency:120",
-		_("Payments") + ":Currency/currency:120"
+		_("Payments") + ":Currency/currency:120",
+		_("Warehouse") + ":Data:200",
+		_("Cost Center") + ":Data:200"
 	]
 
+
+def get_columns(filters):
+	if filters.get('is_pos'):
+		return get_pos_columns()
+	else:
+		return [
+			_("Date") + ":Date:80",
+			_("Owner") + ":Data:200",
+			_("Payment Mode") + ":Data:240",
+			_("Sales and Returns") + ":Currency/currency:120",
+			_("Taxes") + ":Currency/currency:120",
+			_("Payments") + ":Currency/currency:120",
+			_("Warehouse") + ":Data:200"
+		]
+
+
+def get_pos_sales_payment_data(filters):
+	sales_invoice_data = get_pos_invoice_data(filters)
+	data = [
+		[
+			row['posting_date'],
+			row['owner'],
+			row['mode_of_payment'],
+			row['net_total'],
+			row['total_taxes'],
+			row['paid_amount'],
+			row['warehouse'],
+			row['cost_center']
+		] for row in sales_invoice_data]
+
+	return data
+
+
 def get_sales_payment_data(filters, columns):
 	data = []
 	show_payment_detail = False
@@ -51,16 +88,57 @@
 			data.append(row)
 	return data
 
+
 def get_conditions(filters):
 	conditions = "1=1"
-	if filters.get("from_date"): conditions += " and a.posting_date >= %(from_date)s"
-	if filters.get("to_date"): conditions += " and a.posting_date <= %(to_date)s"
-	if filters.get("company"): conditions += " and a.company=%(company)s"
-	if filters.get("customer"): conditions += " and a.customer = %(customer)s"
-	if filters.get("owner"): conditions += " and a.owner = %(owner)s"
-	if filters.get("is_pos"): conditions += " and a.is_pos = %(is_pos)s"
+	if filters.get("from_date"):
+		conditions += " and a.posting_date >= %(from_date)s"
+	if filters.get("to_date"):
+		conditions += " and a.posting_date <= %(to_date)s"
+	if filters.get("company"):
+		conditions += " and a.company=%(company)s"
+	if filters.get("customer"):
+		conditions += " and a.customer = %(customer)s"
+	if filters.get("owner"):
+		conditions += " and a.owner = %(owner)s"
+	if filters.get("is_pos"):
+		conditions += " and a.is_pos = %(is_pos)s"
 	return conditions
 
+
+def get_pos_invoice_data(filters):
+	conditions = get_conditions(filters)
+	result = frappe.db.sql(''
+						   'SELECT '
+						   'posting_date, owner, sum(net_total) as "net_total", sum(total_taxes) as "total_taxes", '
+						   'sum(paid_amount) as "paid_amount", sum(outstanding_amount) as "outstanding_amount", '
+						   'mode_of_payment, warehouse, cost_center '
+						   'FROM ('
+						   'SELECT '
+						   'parent, item_code, sum(amount) as "base_total", warehouse, cost_center '
+						   'from `tabSales Invoice Item`  group by parent'
+						   ') t1 '
+						   'left join '
+						   '(select parent, mode_of_payment from `tabSales Invoice Payment` group by parent) t3 '
+						   'on (t3.parent = t1.parent) '
+						   'JOIN ('
+						   'SELECT '
+						   'docstatus, company, is_pos, name, posting_date, owner, sum(base_total) as "base_total", '
+						   'sum(net_total) as "net_total", sum(total_taxes_and_charges) as "total_taxes", '
+						   'sum(base_paid_amount) as "paid_amount", sum(outstanding_amount) as "outstanding_amount" '
+						   'FROM `tabSales Invoice` '
+						   'GROUP BY name'
+						   ') a '
+						   'ON ('
+						   't1.parent = a.name and t1.base_total = a.base_total) '
+						   'WHERE a.docstatus = 1'
+						   ' AND {conditions} '
+						   'GROUP BY '
+						   'owner, posting_date, warehouse'.format(conditions=conditions), filters, as_dict=1
+						   )
+	return result
+
+
 def get_sales_invoice_data(filters):
 	conditions = get_conditions(filters)
 	return frappe.db.sql("""
@@ -77,6 +155,7 @@
 			a.owner, a.posting_date
 	""".format(conditions=conditions), filters, as_dict=1)
 
+
 def get_mode_of_payments(filters):
 	mode_of_payments = {}
 	invoice_list = get_invoices(filters)
@@ -105,6 +184,7 @@
 			mode_of_payments.setdefault(d["owner"]+cstr(d["posting_date"]), []).append(d.mode_of_payment)
 	return mode_of_payments
 
+
 def get_invoices(filters):
 	conditions = get_conditions(filters)
 	return frappe.db.sql("""select a.name
@@ -112,6 +192,7 @@
 		where a.docstatus = 1 and {conditions}""".format(conditions=conditions),
 		filters, as_dict=1)
 
+
 def get_mode_of_payment_details(filters):
 	mode_of_payment_details = {}
 	invoice_list = get_invoices(filters)
@@ -160,4 +241,4 @@
 		for d in inv_mop_detail:
 			mode_of_payment_details.setdefault(d["owner"]+cstr(d["posting_date"]), []).append((d.mode_of_payment,d.paid_amount))
 
-	return mode_of_payment_details
\ No newline at end of file
+	return mode_of_payment_details
diff --git a/erpnext/accounts/utils.py b/erpnext/accounts/utils.py
index 9cb93e0..adb8dca 100644
--- a/erpnext/accounts/utils.py
+++ b/erpnext/accounts/utils.py
@@ -497,7 +497,7 @@
 
 	if not value:
 		throw(_("Please set default {0} in Company {1}")
-		      .format(frappe.get_meta("Company").get_label(fieldname), company))
+			.format(frappe.get_meta("Company").get_label(fieldname), company))
 
 	return value
 
@@ -550,16 +550,16 @@
 	pr_valuation_amount = frappe.db.sql("""
 		select sum(pr_item.valuation_rate * pr_item.qty * pr_item.conversion_factor)
 		from `tabPurchase Receipt Item` pr_item, `tabPurchase Receipt` pr
-	    where pr.name = pr_item.parent and pr.docstatus=1 and pr.company=%s
+		where pr.name = pr_item.parent and pr.docstatus=1 and pr.company=%s
 		and pr.posting_date <= %s and pr_item.item_code in (%s)""" %
-	    ('%s', '%s', ', '.join(['%s']*len(stock_items))), tuple([company, posting_date] + stock_items))[0][0]
+		('%s', '%s', ', '.join(['%s']*len(stock_items))), tuple([company, posting_date] + stock_items))[0][0]
 
 	pi_valuation_amount = frappe.db.sql("""
 		select sum(pi_item.valuation_rate * pi_item.qty * pi_item.conversion_factor)
 		from `tabPurchase Invoice Item` pi_item, `tabPurchase Invoice` pi
-	    where pi.name = pi_item.parent and pi.docstatus=1 and pi.company=%s
+		where pi.name = pi_item.parent and pi.docstatus=1 and pi.company=%s
 		and pi.posting_date <= %s and pi_item.item_code in (%s)""" %
-	    ('%s', '%s', ', '.join(['%s']*len(stock_items))), tuple([company, posting_date] + stock_items))[0][0]
+		('%s', '%s', ', '.join(['%s']*len(stock_items))), tuple([company, posting_date] + stock_items))[0][0]
 
 	# Balance should be
 	stock_rbnb = flt(pr_valuation_amount, 2) - flt(pi_valuation_amount, 2)
@@ -681,29 +681,24 @@
 def get_children(doctype, parent, company, is_root=False):
 	from erpnext.accounts.report.financial_statements import sort_accounts
 
-	fieldname = frappe.db.escape(doctype.lower().replace(' ','_'))
-	doctype = frappe.db.escape(doctype)
+	parent_fieldname = 'parent_' + doctype.lower().replace(' ', '_')
+	fields = [
+		'name as value',
+		'is_group as expandable'
+	]
+	filters = [['docstatus', '<', 2]]
 
-	# root
+	filters.append(['ifnull(`{0}`,"")'.format(parent_fieldname), '=', '' if is_root else parent])
+
 	if is_root:
-		fields = ", root_type, report_type, account_currency" if doctype=="Account" else ""
-		acc = frappe.db.sql(""" select
-			name as value, is_group as expandable {fields}
-			from `tab{doctype}`
-			where ifnull(`parent_{fieldname}`,'') = ''
-			and `company` = %s	and docstatus<2
-			order by name""".format(fields=fields, fieldname = fieldname, doctype=doctype),
-				company, as_dict=1)
+		fields += ['root_type', 'report_type', 'account_currency'] if doctype == 'Account' else []
+		filters.append(['company', '=', company])
+
 	else:
-		# other
-		fields = ", account_currency" if doctype=="Account" else ""
-		acc = frappe.db.sql("""select
-			name as value, is_group as expandable, parent_{fieldname} as parent {fields}
-			from `tab{doctype}`
-			where ifnull(`parent_{fieldname}`,'') = %s
-			and docstatus<2
-			order by name""".format(fields=fields, fieldname=fieldname, doctype=doctype),
-				parent, as_dict=1)
+		fields += ['account_currency'] if doctype == 'Account' else []
+		fields += [parent_fieldname + ' as parent']
+
+	acc = frappe.get_list(doctype, fields=fields, filters=filters)
 
 	if doctype == 'Account':
 		sort_accounts(acc, is_root, key="value")
diff --git a/erpnext/agriculture/doctype/crop_cycle/crop_cycle.json b/erpnext/agriculture/doctype/crop_cycle/crop_cycle.json
index 79e3abe..f14213b 100644
--- a/erpnext/agriculture/doctype/crop_cycle/crop_cycle.json
+++ b/erpnext/agriculture/doctype/crop_cycle/crop_cycle.json
@@ -460,6 +460,7 @@
    "collapsible": 0, 
    "columns": 0, 
    "description": "The minimum length between each plant in the field for optimum growth", 
+   "fetch_from": "crop.crop_spacing", 
    "fieldname": "crop_spacing", 
    "fieldtype": "Float", 
    "hidden": 0, 
@@ -472,7 +473,7 @@
    "label": "Crop Spacing", 
    "length": 0, 
    "no_copy": 0, 
-   "options": "crop.crop_spacing", 
+   "options": "", 
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
@@ -555,6 +556,7 @@
    "collapsible": 0, 
    "columns": 0, 
    "description": "The minimum distance between rows of plants for optimum growth", 
+   "fetch_from": "crop.row_spacing", 
    "fieldname": "row_spacing", 
    "fieldtype": "Float", 
    "hidden": 0, 
@@ -567,7 +569,7 @@
    "label": "Row Spacing", 
    "length": 0, 
    "no_copy": 0, 
-   "options": "crop.row_spacing", 
+   "options": "", 
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
@@ -817,7 +819,7 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2018-05-16 22:43:33.462001",
+ "modified": "2018-05-25 22:43:33.462001",
  "modified_by": "Administrator", 
  "module": "Agriculture", 
  "name": "Crop Cycle", 
diff --git a/erpnext/agriculture/doctype/land_unit/land_unit.py b/erpnext/agriculture/doctype/land_unit/land_unit.py
index f577eca..269bbce 100644
--- a/erpnext/agriculture/doctype/land_unit/land_unit.py
+++ b/erpnext/agriculture/doctype/land_unit/land_unit.py
@@ -25,12 +25,12 @@
 	def on_trash(self):
 		ancestors = self.get_ancestors()
 		for ancestor in ancestors:
-			ancestor_doc = frappe.get_doc('Land Unit', ancestor)	
+			ancestor_doc = frappe.get_doc('Land Unit', ancestor)
 			ancestor_child_features, ancestor_non_child_features = ancestor_doc.feature_seperator(child_feature = self.get('land_unit_name'))
 			ancestor_features = ancestor_non_child_features
 			for index,feature in enumerate(ancestor_features):
 				ancestor_features[index] = json.loads(feature)
-			ancestor_doc.set_location_value(features = ancestor_features)	
+			ancestor_doc.set_location_value(features = ancestor_features)
 			ancestor_doc.db_set(fieldname='area', value=ancestor_doc.get('area')-self.get('area'),commit=True)
 		super(LandUnit, self).on_update()
 
@@ -42,7 +42,7 @@
 				features = json.loads(self.get('location')).get('features')
 			new_area = compute_area(features)
 			self.area_difference = new_area - flt(self.area)
-			self.area = new_area	
+			self.area = new_area
 
 			if self.get('parent_land_unit'):
 				ancestors = self.get_ancestors()
@@ -55,8 +55,8 @@
 					ancestor_features = list(set(ancestor_non_child_features))
 					child_features = set(ancestor_child_features)
 
-					if not (self_features.issubset(child_features) and child_features.issubset(self_features)): 
-						features_to_be_appended =	self_features - child_features 
+					if not (self_features.issubset(child_features) and child_features.issubset(self_features)):
+						features_to_be_appended =	self_features - child_features
 						features_to_be_discarded = 	child_features - self_features
 						for feature in features_to_be_discarded:
 							child_features.discard(feature)
@@ -67,7 +67,7 @@
 					ancestor_features.extend(child_features)
 					for index,feature in enumerate(ancestor_features):
 						ancestor_features[index] = json.loads(feature)
-					ancestor_doc.set_location_value(features = ancestor_features)	
+					ancestor_doc.set_location_value(features = ancestor_features)
 					ancestor_doc.db_set(fieldname='area', value=ancestor_doc.get('area')+\
 						self.get('area_difference'),commit=True)
 
@@ -84,18 +84,18 @@
 	def add_child_property(self):
 		location = self.get('location')
 		if location:
-			features = json.loads(location).get('features')	
+			features = json.loads(location).get('features')
 			if type(features) != list:
 				features = json.loads(features)
 			filter_features = [feature for feature in features if feature.get('properties').get('child_feature') != True]
 			for index,feature in enumerate(filter_features):
 				feature['properties'].update({'child_feature': True, 'feature_of': self.land_unit_name})
 				filter_features[index] = json.dumps(filter_features[index])
-			return filter_features 
+			return filter_features
 		return []
 
 	def feature_seperator(self, child_feature=None):
-		doc = self 
+		doc = self
 		child_features = []
 		non_child_features = []
 		location = doc.get('location')
@@ -108,11 +108,11 @@
 					child_features.extend([json.dumps(feature)])
 				else:
 					non_child_features.extend([json.dumps(feature)])
-		
+
 		return child_features, non_child_features
 
 
-def compute_area(features):                                
+def compute_area(features):
 	layer_area = 0
 	for feature in features:
 		if feature.get('geometry').get('type') == 'Polygon':
@@ -128,10 +128,10 @@
 	area = 0
 	if coords and len(coords) > 0:
 		area += math.fabs(ring_area(coords[0]));
-		for i in range(1, len(coords)): 
+		for i in range(1, len(coords)):
 			area -= math.fabs(ring_area(coords[i]));
 	return area;
-	
+
 def ring_area(coords):
 	p1 = 0
 	p2 = 0
@@ -142,7 +142,7 @@
 	i = 0
 	area = 0
 	coords_length = len(coords)
-	if coords_length > 2: 
+	if coords_length > 2:
 		for i in range(0, coords_length):
 			if i == coords_length - 2: # i = N-2
 				lower_index = coords_length - 2;
@@ -169,11 +169,10 @@
 	if is_root:
 		parent = ''
 
-	land_units = frappe.db.sql("""select name as value,
-		is_group as expandable
-		from `tabLand Unit`
-		where ifnull(`parent_land_unit`,'') = %s
-		order by name""", (parent), as_dict=1)
+	land_units = frappe.get_list(doctype,
+		fields = ['name as value', 'is_group as expandable'],
+		filters= [['ifnull(`parent_land_unit`, "")', '=', parent]],
+		order_by='name')
 
 	# return nodes
 	return land_units
diff --git a/erpnext/assets/doctype/asset_maintenance_log/asset_maintenance_log.json b/erpnext/assets/doctype/asset_maintenance_log/asset_maintenance_log.json
index 45967b9..767097d 100644
--- a/erpnext/assets/doctype/asset_maintenance_log/asset_maintenance_log.json
+++ b/erpnext/assets/doctype/asset_maintenance_log/asset_maintenance_log.json
@@ -403,6 +403,7 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "fetch_from": "task.next_due_date", 
    "fieldname": "due_date", 
    "fieldtype": "Date", 
    "hidden": 0, 
@@ -415,7 +416,7 @@
    "label": "Due Date", 
    "length": 0, 
    "no_copy": 0, 
-   "options": "task.next_due_date", 
+   "options": "", 
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
@@ -528,6 +529,7 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "fetch_from": "task.has_certificate", 
    "fieldname": "has_certificate", 
    "fieldtype": "Check", 
    "hidden": 0, 
@@ -540,7 +542,7 @@
    "label": "Has Certificate ", 
    "length": 0, 
    "no_copy": 0, 
-   "options": "task.has_certificate", 
+   "options": "", 
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
@@ -753,7 +755,7 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2018-05-16 22:43:39.866477",
+ "modified": "2018-05-25 22:43:39.866477",
  "modified_by": "Administrator", 
  "module": "Assets", 
  "name": "Asset Maintenance Log", 
diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.json b/erpnext/buying/doctype/purchase_order/purchase_order.json
index dec8bcb..a7799b6 100644
--- a/erpnext/buying/doctype/purchase_order/purchase_order.json
+++ b/erpnext/buying/doctype/purchase_order/purchase_order.json
@@ -1475,6 +1475,37 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "fieldname": "total_qty", 
+   "fieldtype": "Float", 
+   "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": "Total Quantity", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "translatable": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "base_total", 
    "fieldtype": "Currency", 
    "hidden": 0, 
@@ -3561,7 +3592,7 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2018-05-16 22:43:11.709029",
+ "modified": "2018-05-17 12:55:20.008156", 
  "modified_by": "Administrator", 
  "module": "Buying", 
  "name": "Purchase Order", 
diff --git a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.json b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.json
index 7cefea5..27f24bf 100644
--- a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.json
+++ b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.json
@@ -906,6 +906,37 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "fieldname": "total_qty", 
+   "fieldtype": "Float", 
+   "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": "Total Quantity", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "translatable": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "base_total", 
    "fieldtype": "Currency", 
    "hidden": 0, 
@@ -2248,6 +2279,65 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "fieldname": "group_same_items",
+   "fieldtype": "Check",
+   "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": "Group same items",
+   "length": 0,
+   "no_copy": 0,
+   "permlevel": 0,
+   "precision": "",
+   "print_hide": 1,
+   "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_bulk_edit": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fieldname": "column_break_72",
+   "fieldtype": "Column 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_bulk_edit": 0,
+   "allow_on_submit": 1,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
    "fieldname": "letter_head", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -2571,7 +2661,7 @@
  "istable": 0, 
  "max_attachments": 0, 
  "menu_index": 0, 
- "modified": "2018-05-16 22:42:48.908070",
+ "modified": "2018-05-28 02:45:48.616334", 
  "modified_by": "Administrator", 
  "module": "Buying", 
  "name": "Supplier Quotation", 
diff --git a/erpnext/config/hr.py b/erpnext/config/hr.py
index 9e893c0..7ead572 100644
--- a/erpnext/config/hr.py
+++ b/erpnext/config/hr.py
@@ -96,6 +96,10 @@
 				},
 				{
 					"type": "doctype",
+					"name": "Additional Salary",
+				},
+				{
+					"type": "doctype",
 					"name": "Employee Tax Exemption Declaration",
 				},
 				{
@@ -125,10 +129,6 @@
 				},
 				{
 					"type": "doctype",
-					"name": "Additional Salary Component",
-				},
-				{
-					"type": "doctype",
 					"name": "Salary Structure",
 				},
 				{
@@ -397,5 +397,16 @@
 					"youtube_id": "5SZHJF--ZFY"
 				}
 			]
+		},
+		{
+			"label": _("Analytics"),
+			"items": [
+				{
+					"type": "report",
+					"is_query_report": True,
+					"name": "Department Analytics",
+					"doctype": "Employee"
+				},
+			]
 		}
 	]
diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py
index e3f7d1e..76be942 100644
--- a/erpnext/controllers/accounts_controller.py
+++ b/erpnext/controllers/accounts_controller.py
@@ -102,7 +102,8 @@
 			self.validate_non_invoice_documents_schedule()
 
 	def before_print(self):
-		if self.doctype in ['Purchase Order', 'Sales Order']:
+		if self.doctype in ['Purchase Order', 'Sales Order', 'Sales Invoice', 'Purchase Invoice',
+			'Supplier Quotation', 'Purchase Receipt', 'Delivery Note', 'Quotation']:
 			if self.get("group_same_items"):
 				self.group_similar_items()
 
@@ -684,6 +685,7 @@
 			if item.item_code in group_item_qty:
 				item.qty = group_item_qty[item.item_code]
 				item.amount = group_item_amount[item.item_code]
+				item.rate = flt(flt(item.amount)/flt(item.qty), item.precision("rate"))
 				del group_item_qty[item.item_code]
 			else:
 				duplicate_list.append(item)
diff --git a/erpnext/controllers/buying_controller.py b/erpnext/controllers/buying_controller.py
index 83fe46a..4099392 100644
--- a/erpnext/controllers/buying_controller.py
+++ b/erpnext/controllers/buying_controller.py
@@ -74,7 +74,8 @@
 	def set_supplier_from_item_default(self):
 		if self.meta.get_field("supplier") and not self.supplier:
 			for d in self.get("items"):
-				supplier = frappe.db.get_value("Item", d.item_code, "default_supplier")
+				supplier = frappe.db.get_value("Item Default",
+					{"parent": d.item_code, "company": self.company}, "default_supplier")
 				if supplier:
 					self.supplier = supplier
 					break
diff --git a/erpnext/controllers/taxes_and_totals.py b/erpnext/controllers/taxes_and_totals.py
index d1c42b8..a595b4b 100644
--- a/erpnext/controllers/taxes_and_totals.py
+++ b/erpnext/controllers/taxes_and_totals.py
@@ -38,6 +38,7 @@
 		self.manipulate_grand_total_for_inclusive_tax()
 		self.calculate_totals()
 		self._cleanup()
+		self.calculate_total_net_weight()
 
 	def validate_conversion_rate(self):
 		# validate conversion rate
@@ -164,9 +165,10 @@
 			return tax.rate
 
 	def calculate_net_total(self):
-		self.doc.total = self.doc.base_total = self.doc.net_total = self.doc.base_net_total = 0.0
+		self.doc.total_qty = self.doc.total = self.doc.base_total = self.doc.net_total = self.doc.base_net_total = 0.0
 		for item in self.doc.get("items"):
 			self.doc.total += item.amount
+			self.doc.total_qty += item.qty
 			self.doc.base_total += item.base_amount
 			self.doc.net_total += item.net_amount
 			self.doc.base_net_total += item.base_net_amount
@@ -328,6 +330,13 @@
 
 		self.set_rounded_total()
 
+	def calculate_total_net_weight(self):
+		if self.doc.meta.get_field('total_net_weight'):
+			self.doc.total_net_weight = 0.0
+			for d in self.doc.items:
+				if d.total_weight:
+					self.doc.total_net_weight += d.total_weight
+
 	def set_rounded_total(self):
 		if self.doc.meta.get_field("rounded_total"):
 			if self.doc.is_rounded_total_disabled():
diff --git a/erpnext/crm/doctype/opportunity/test_opportunity.py b/erpnext/crm/doctype/opportunity/test_opportunity.py
index 1e96976..ef2945b 100644
--- a/erpnext/crm/doctype/opportunity/test_opportunity.py
+++ b/erpnext/crm/doctype/opportunity/test_opportunity.py
@@ -64,6 +64,7 @@
 
 	opp_doc = frappe.get_doc({
 		"doctype": "Opportunity",
+		"company": args.company or "_Test Company",
 		"enquiry_from": args.enquiry_from or "Customer",
 		"opportunity_type": "Sales",
 		"with_items": args.with_items or 0,
diff --git a/erpnext/demo/setup/setup_data.py b/erpnext/demo/setup/setup_data.py
index 03e3414..41f24e1 100644
--- a/erpnext/demo/setup/setup_data.py
+++ b/erpnext/demo/setup/setup_data.py
@@ -138,20 +138,8 @@
 	import_json('Employee')
 
 def setup_salary_structure(employees, salary_slip_based_on_timesheet=0):
-	f = frappe.get_doc('Fiscal Year', frappe.defaults.get_global_default('fiscal_year'))
-
 	ss = frappe.new_doc('Salary Structure')
 	ss.name = "Sample Salary Structure - " + random_string(5)
-	for e in employees:
-		ss.append('employees', {
-			'employee': e.name,
-			'from_date': "2015-01-01",
-			'base': random.random() * 10000
-		})
-
-	ss.from_date = e.date_of_joining if (e.date_of_joining
-		and e.date_of_joining > f.year_start_date) else f.year_start_date
-	ss.to_date = f.year_end_date
 	ss.salary_slip_based_on_timesheet = salary_slip_based_on_timesheet
 
 	if salary_slip_based_on_timesheet:
@@ -179,6 +167,12 @@
 	})
 	ss.insert()
 
+	for e in employees:
+		sa  = frappe.new_doc("Salary Structure Assignment")
+		sa.employee = e.name
+		sa.from_date = "2015-01-01"
+		sa.base = random.random() * 10000
+
 	return ss
 
 def setup_user_roles():
diff --git a/erpnext/docs/assets/img/accounts/make-inter-company-invoice.png b/erpnext/docs/assets/img/accounts/make-inter-company-invoice.png
new file mode 100644
index 0000000..af55847
--- /dev/null
+++ b/erpnext/docs/assets/img/accounts/make-inter-company-invoice.png
Binary files differ
diff --git a/erpnext/docs/assets/img/accounts/make-internal-customer.png b/erpnext/docs/assets/img/accounts/make-internal-customer.png
new file mode 100644
index 0000000..cf7e040
--- /dev/null
+++ b/erpnext/docs/assets/img/accounts/make-internal-customer.png
Binary files differ
diff --git a/erpnext/docs/assets/img/accounts/make-internal-supplier.png b/erpnext/docs/assets/img/accounts/make-internal-supplier.png
new file mode 100644
index 0000000..598eb65
--- /dev/null
+++ b/erpnext/docs/assets/img/accounts/make-internal-supplier.png
Binary files differ
diff --git a/erpnext/docs/assets/img/articles/allowance-percentage-1.png b/erpnext/docs/assets/img/articles/allowance-percentage-1.png
deleted file mode 100644
index 4fbed90..0000000
--- a/erpnext/docs/assets/img/articles/allowance-percentage-1.png
+++ /dev/null
Binary files differ
diff --git a/erpnext/docs/assets/img/articles/allowance-percentage-2.png b/erpnext/docs/assets/img/articles/allowance-percentage-2.png
deleted file mode 100644
index a7b9688..0000000
--- a/erpnext/docs/assets/img/articles/allowance-percentage-2.png
+++ /dev/null
Binary files differ
diff --git a/erpnext/docs/assets/img/articles/limit-1.png b/erpnext/docs/assets/img/articles/limit-1.png
new file mode 100644
index 0000000..5e3cb27
--- /dev/null
+++ b/erpnext/docs/assets/img/articles/limit-1.png
Binary files differ
diff --git a/erpnext/docs/assets/img/articles/limit-2.png b/erpnext/docs/assets/img/articles/limit-2.png
new file mode 100644
index 0000000..ffa72b3
--- /dev/null
+++ b/erpnext/docs/assets/img/articles/limit-2.png
Binary files differ
diff --git a/erpnext/docs/assets/img/human-resources/employee-job-profile.png b/erpnext/docs/assets/img/human-resources/employee-job-profile.png
new file mode 100644
index 0000000..a0decd4
--- /dev/null
+++ b/erpnext/docs/assets/img/human-resources/employee-job-profile.png
Binary files differ
diff --git a/erpnext/docs/assets/img/human-resources/employee-view.gif b/erpnext/docs/assets/img/human-resources/employee-view.gif
new file mode 100644
index 0000000..52633d0
--- /dev/null
+++ b/erpnext/docs/assets/img/human-resources/employee-view.gif
Binary files differ
diff --git a/erpnext/docs/assets/img/human-resources/employee.png b/erpnext/docs/assets/img/human-resources/employee.png
index ec2e70e..0120a76 100644
--- a/erpnext/docs/assets/img/human-resources/employee.png
+++ b/erpnext/docs/assets/img/human-resources/employee.png
Binary files differ
diff --git a/erpnext/docs/assets/img/human-resources/supplier1.1.png b/erpnext/docs/assets/img/human-resources/supplier1.1.png
new file mode 100644
index 0000000..48aa485
--- /dev/null
+++ b/erpnext/docs/assets/img/human-resources/supplier1.1.png
Binary files differ
diff --git a/erpnext/docs/assets/img/manufacturing/manufacturing-settings.png b/erpnext/docs/assets/img/manufacturing/manufacturing-settings.png
new file mode 100644
index 0000000..dd37fee
--- /dev/null
+++ b/erpnext/docs/assets/img/manufacturing/manufacturing-settings.png
Binary files differ
diff --git a/erpnext/docs/assets/img/manufacturing/scrap-1.png b/erpnext/docs/assets/img/manufacturing/scrap-1.png
new file mode 100644
index 0000000..3be19e3
--- /dev/null
+++ b/erpnext/docs/assets/img/manufacturing/scrap-1.png
Binary files differ
diff --git a/erpnext/docs/assets/img/manufacturing/scrap-2.gif b/erpnext/docs/assets/img/manufacturing/scrap-2.gif
new file mode 100644
index 0000000..0b9d42e
--- /dev/null
+++ b/erpnext/docs/assets/img/manufacturing/scrap-2.gif
Binary files differ
diff --git a/erpnext/docs/assets/img/project/profitability-analysis.png b/erpnext/docs/assets/img/project/profitability-analysis.png
new file mode 100644
index 0000000..2c43adf
--- /dev/null
+++ b/erpnext/docs/assets/img/project/profitability-analysis.png
Binary files differ
diff --git a/erpnext/docs/assets/img/project/project-1.1.png b/erpnext/docs/assets/img/project/project-1.1.png
new file mode 100644
index 0000000..ea23665
--- /dev/null
+++ b/erpnext/docs/assets/img/project/project-1.1.png
Binary files differ
diff --git a/erpnext/docs/assets/img/project/project-1.png b/erpnext/docs/assets/img/project/project-1.png
new file mode 100644
index 0000000..f416cd6
--- /dev/null
+++ b/erpnext/docs/assets/img/project/project-1.png
Binary files differ
diff --git a/erpnext/docs/assets/img/project/project-2.png b/erpnext/docs/assets/img/project/project-2.png
new file mode 100644
index 0000000..cadb20d
--- /dev/null
+++ b/erpnext/docs/assets/img/project/project-2.png
Binary files differ
diff --git a/erpnext/docs/assets/img/project/project-budgeting.png b/erpnext/docs/assets/img/project/project-budgeting.png
new file mode 100644
index 0000000..989cff2
--- /dev/null
+++ b/erpnext/docs/assets/img/project/project-budgeting.png
Binary files differ
diff --git a/erpnext/docs/assets/img/project/project-expense-claim-1.png b/erpnext/docs/assets/img/project/project-expense-claim-1.png
new file mode 100644
index 0000000..3ed5955
--- /dev/null
+++ b/erpnext/docs/assets/img/project/project-expense-claim-1.png
Binary files differ
diff --git a/erpnext/docs/assets/img/project/project-expense-claim-2.png b/erpnext/docs/assets/img/project/project-expense-claim-2.png
new file mode 100644
index 0000000..380a9a6
--- /dev/null
+++ b/erpnext/docs/assets/img/project/project-expense-claim-2.png
Binary files differ
diff --git a/erpnext/docs/assets/img/project/project-percent-complete.png b/erpnext/docs/assets/img/project/project-percent-complete.png
deleted file mode 100644
index cebfde3..0000000
--- a/erpnext/docs/assets/img/project/project-percent-complete.png
+++ /dev/null
Binary files differ
diff --git a/erpnext/docs/assets/img/project/project-portal-2.png b/erpnext/docs/assets/img/project/project-portal-2.png
new file mode 100644
index 0000000..f86d707
--- /dev/null
+++ b/erpnext/docs/assets/img/project/project-portal-2.png
Binary files differ
diff --git a/erpnext/docs/assets/img/project/project-portal-user.png b/erpnext/docs/assets/img/project/project-portal-user.png
new file mode 100644
index 0000000..c12f203
--- /dev/null
+++ b/erpnext/docs/assets/img/project/project-portal-user.png
Binary files differ
diff --git a/erpnext/docs/assets/img/project/project-portal.gif b/erpnext/docs/assets/img/project/project-portal.gif
new file mode 100644
index 0000000..a89fb0b
--- /dev/null
+++ b/erpnext/docs/assets/img/project/project-portal.gif
Binary files differ
diff --git a/erpnext/docs/assets/img/project/project-profitability-1.png b/erpnext/docs/assets/img/project/project-profitability-1.png
new file mode 100644
index 0000000..1928ee2
--- /dev/null
+++ b/erpnext/docs/assets/img/project/project-profitability-1.png
Binary files differ
diff --git a/erpnext/docs/assets/img/project/project-profitability-2.png b/erpnext/docs/assets/img/project/project-profitability-2.png
new file mode 100644
index 0000000..39ba059
--- /dev/null
+++ b/erpnext/docs/assets/img/project/project-profitability-2.png
Binary files differ
diff --git a/erpnext/docs/assets/img/project/project.png b/erpnext/docs/assets/img/project/project.png
deleted file mode 100644
index c6bcd92..0000000
--- a/erpnext/docs/assets/img/project/project.png
+++ /dev/null
Binary files differ
diff --git a/erpnext/docs/assets/img/project/project_cost_center.png b/erpnext/docs/assets/img/project/project_cost_center.png
deleted file mode 100644
index 09bd557..0000000
--- a/erpnext/docs/assets/img/project/project_cost_center.png
+++ /dev/null
Binary files differ
diff --git a/erpnext/docs/assets/img/project/project_costing.png b/erpnext/docs/assets/img/project/project_costing.png
deleted file mode 100644
index c55976d..0000000
--- a/erpnext/docs/assets/img/project/project_costing.png
+++ /dev/null
Binary files differ
diff --git a/erpnext/docs/assets/img/project/project_expense_claim_link.png b/erpnext/docs/assets/img/project/project_expense_claim_link.png
deleted file mode 100644
index 077cea1..0000000
--- a/erpnext/docs/assets/img/project/project_expense_claim_link.png
+++ /dev/null
Binary files differ
diff --git a/erpnext/docs/assets/img/project/project_gantt_chart.png b/erpnext/docs/assets/img/project/project_gantt_chart.png
deleted file mode 100644
index 3eba443..0000000
--- a/erpnext/docs/assets/img/project/project_gantt_chart.png
+++ /dev/null
Binary files differ
diff --git a/erpnext/docs/assets/img/project/project_sales_order.png b/erpnext/docs/assets/img/project/project_sales_order.png
deleted file mode 100644
index ff4030d..0000000
--- a/erpnext/docs/assets/img/project/project_sales_order.png
+++ /dev/null
Binary files differ
diff --git a/erpnext/docs/assets/img/project/project_task.png b/erpnext/docs/assets/img/project/project_task.png
deleted file mode 100644
index 88f1e68..0000000
--- a/erpnext/docs/assets/img/project/project_task.png
+++ /dev/null
Binary files differ
diff --git a/erpnext/docs/assets/img/project/project_task_grid.png b/erpnext/docs/assets/img/project/project_task_grid.png
deleted file mode 100644
index 935fba6..0000000
--- a/erpnext/docs/assets/img/project/project_task_grid.png
+++ /dev/null
Binary files differ
diff --git a/erpnext/docs/assets/img/project/project_task_list.png b/erpnext/docs/assets/img/project/project_task_list.png
deleted file mode 100644
index 2a59caf..0000000
--- a/erpnext/docs/assets/img/project/project_task_list.png
+++ /dev/null
Binary files differ
diff --git a/erpnext/docs/assets/img/project/project_time_log_link.png b/erpnext/docs/assets/img/project/project_time_log_link.png
deleted file mode 100644
index 08ac36c..0000000
--- a/erpnext/docs/assets/img/project/project_time_log_link.png
+++ /dev/null
Binary files differ
diff --git a/erpnext/docs/assets/img/project/project_time_log_list.png b/erpnext/docs/assets/img/project/project_time_log_list.png
deleted file mode 100644
index 3b3724b..0000000
--- a/erpnext/docs/assets/img/project/project_time_log_list.png
+++ /dev/null
Binary files differ
diff --git a/erpnext/docs/assets/img/project/project_total_expense_claim.png b/erpnext/docs/assets/img/project/project_total_expense_claim.png
deleted file mode 100644
index cbd3c01..0000000
--- a/erpnext/docs/assets/img/project/project_total_expense_claim.png
+++ /dev/null
Binary files differ
diff --git a/erpnext/docs/assets/img/project/project_view_expense_claim.png b/erpnext/docs/assets/img/project/project_view_expense_claim.png
deleted file mode 100644
index 32056ca..0000000
--- a/erpnext/docs/assets/img/project/project_view_expense_claim.png
+++ /dev/null
Binary files differ
diff --git a/erpnext/docs/assets/img/project/project_view_gantt_chart.png b/erpnext/docs/assets/img/project/project_view_gantt_chart.png
deleted file mode 100644
index 7039a45..0000000
--- a/erpnext/docs/assets/img/project/project_view_gantt_chart.png
+++ /dev/null
Binary files differ
diff --git a/erpnext/docs/assets/img/project/project_view_task.png b/erpnext/docs/assets/img/project/project_view_task.png
deleted file mode 100644
index dfdff8b..0000000
--- a/erpnext/docs/assets/img/project/project_view_task.png
+++ /dev/null
Binary files differ
diff --git a/erpnext/docs/assets/img/project/project_view_time_log.png b/erpnext/docs/assets/img/project/project_view_time_log.png
deleted file mode 100644
index dbf184e..0000000
--- a/erpnext/docs/assets/img/project/project_view_time_log.png
+++ /dev/null
Binary files differ
diff --git a/erpnext/docs/assets/img/setup/workflow-6.png b/erpnext/docs/assets/img/setup/workflow-6.png
new file mode 100644
index 0000000..a13d17c
--- /dev/null
+++ b/erpnext/docs/assets/img/setup/workflow-6.png
Binary files differ
diff --git a/erpnext/docs/assets/img/setup/workflow-actions-email.png b/erpnext/docs/assets/img/setup/workflow-actions-email.png
new file mode 100644
index 0000000..0fe3bca
--- /dev/null
+++ b/erpnext/docs/assets/img/setup/workflow-actions-email.png
Binary files differ
diff --git a/erpnext/docs/assets/img/setup/workflow-actions-list.png b/erpnext/docs/assets/img/setup/workflow-actions-list.png
new file mode 100644
index 0000000..cb8ccc2
--- /dev/null
+++ b/erpnext/docs/assets/img/setup/workflow-actions-list.png
Binary files differ
diff --git a/erpnext/docs/assets/img/stock/customer-warehouse-2.png b/erpnext/docs/assets/img/stock/customer-warehouse-2.png
new file mode 100644
index 0000000..d44f88f
--- /dev/null
+++ b/erpnext/docs/assets/img/stock/customer-warehouse-2.png
Binary files differ
diff --git a/erpnext/docs/assets/img/stock/customer-warehouse.gif b/erpnext/docs/assets/img/stock/customer-warehouse.gif
new file mode 100644
index 0000000..c587b98
--- /dev/null
+++ b/erpnext/docs/assets/img/stock/customer-warehouse.gif
Binary files differ
diff --git a/erpnext/docs/user/manual/en/accounts/index.txt b/erpnext/docs/user/manual/en/accounts/index.txt
index 61e0db4..3b84be9 100644
--- a/erpnext/docs/user/manual/en/accounts/index.txt
+++ b/erpnext/docs/user/manual/en/accounts/index.txt
@@ -4,6 +4,7 @@
 point-of-sale-pos-invoice
 point-of-sales
 purchase-invoice
+inter-company-invoices
 payments
 journal-entry
 inter-company-journal-entry
diff --git a/erpnext/docs/user/manual/en/accounts/inter-company-invoices.md b/erpnext/docs/user/manual/en/accounts/inter-company-invoices.md
new file mode 100644
index 0000000..ed2ec42
--- /dev/null
+++ b/erpnext/docs/user/manual/en/accounts/inter-company-invoices.md
@@ -0,0 +1,32 @@
+
+# Inter Company Invoices
+
+Along with creating Purchase Invoices or Sales Invoices for a single company, you can create inter-linked invoices for multiple companies.
+
+Such as, you can create a Purchase Invoice for a company say 'Company ABC', and create a Sales Invoice against this Purchase Invoice for a company say 'Company XYZ' and link them together.
+
+#### To create Inter Company Invoices as mentioned in the above process, you need to follow the below steps:
+
+ - Go to the Customer list, select the customer which you would want to choose for the inter-linked invoices, enable the checkbox, **Is Internal Customer** as shown below:
+
+ <img class="screenshot" alt="Internal Customer" src="{{docs_base_url}}/assets/img/accounts/make-internal-customer.png">
+
+ - Along with that, add the company which the Customer represents, i.e. the company for which the Sales Invoice will be created.
+ - Next, fill up the child table **Allowed To Transact With** as shown in the image and add the company against which you will be creating a Purchase Invoice, which will be linked with the Sales Invoice created  using this Customer.
+ - *Easy peasy, right?* Now, you need to follow the similar procedure for setting up a Supplier for inter-linked invoices. And, in the **Represents Company** field, add the company which you added in the child table **Allowed To Transact With** for the Customer.
+ - And, in the child table **Allowed To Transact With** for the Supplier, add the company which the Customer represents or against which you are going to make an inter-linked Purchase Invoice. You can refer the below image to avoid any confusion.
+
+ <img class="screenshot" alt="Internal Supplier" src="{{docs_base_url}}/assets/img/accounts/make-internal-supplier.png">
+
+- Now, create a new Sales Invoice, fill up the fields, and remember to select the Customer who is an internal customer and company which the Customer represents.
+- Submit the Invoice.
+
+ <img class="screenshot" alt="Inter company invoice" src="{{docs_base_url}}/assets/img/accounts/make-inter-company-invoice.png">
+
+- Under the **Make** button dropdown, you will find a link **Inter Company Invoice**, on clicking the link, you will be routed to a new Purchase Invoice form page.
+- Here, the supplier and company will be auto-fetched depending on the company you selected in the Sales Invoice. ***Remember**: There can only be a single Internal Supplier or Customer per company.*
+- Submit the invoice, done! Now, both the invoices are inter-linked. *Also, on cancelling any of the invoices, the link will break as well.*
+
+You can follow the same process to create a Purchase Invoice and then an inter-linked Sales Invoice from the submitted Purchase Invoice.
+
+{next}
\ No newline at end of file
diff --git a/erpnext/docs/user/manual/en/accounts/pricing-rule.md b/erpnext/docs/user/manual/en/accounts/pricing-rule.md
index c4a3eb9..02c6c8b 100644
--- a/erpnext/docs/user/manual/en/accounts/pricing-rule.md
+++ b/erpnext/docs/user/manual/en/accounts/pricing-rule.md
@@ -11,7 +11,7 @@
 
 3. Items categorized under specific Item Group has same selling or buying price.
 
-4. Customers balonging to specific Customer Group should get ### selling price, ot % of Discount on Items.
+4. Customers balonging to specific Customer Group should get ### selling price, or % of Discount on Items.
 
 5. Supplier's categorized under specific Supplier Type should have ### buying rate applied.
 
@@ -106,4 +106,4 @@
 
 For more details about pricing rule [Click Here](/docs/user/manual/en/selling/articles/adding-margin.html)
 
-<!-- markdown -->
\ No newline at end of file
+<!-- markdown -->
diff --git a/erpnext/docs/user/manual/en/buying/supplier.md b/erpnext/docs/user/manual/en/buying/supplier.md
index f116c88..2f8a154 100644
--- a/erpnext/docs/user/manual/en/buying/supplier.md
+++ b/erpnext/docs/user/manual/en/buying/supplier.md
@@ -6,18 +6,11 @@
 
 `Explore > Supplier > New Supplier`
 
-<img class="screenshot" alt="Supplier Master" src="{{docs_base_url}}/assets/img/buying/supplier-master.png">
-
-<div>
-    <div class='embed-container'>
-        <iframe src='https://www.youtube.com/embed//zsrrVDk6VBs?start=213' frameborder='0' allowfullscreen>
-        </iframe>
-    </div>
-</div>
+<img class="screenshot" alt="Supplier Master" src="{{docs_base_url}}/assets/img/buying/supplier1.1.png">
 
 ### Contacts and Addresses
 
-Contacts and Addresses in ERPNext are stored separately so that you can create multiple Contacts and Addresses for a Suppliers. Once Supplier is saved, you will find option to create Contact and Address for that Supplier.
+Contacts and Addresses in ERPNext are stored separately so that you can create multiple Contacts and Addresses for a Suppliers. Once Supplier is saved, you will find the option to create Contact and Address for that Supplier.
 
 <img class="screenshot" alt="Supplier Master" src="{{docs_base_url}}/assets/img/buying/supplier-new-address-contact.png">
 
@@ -37,8 +30,12 @@
 
 You can add multiple companies in your ERPNext instance, and one Supplier can be used across multiple companies. In this case, you should define Companywise Payable Account for the Supplier in the "Default Payable Accounts" table.
 
-<iframe width="660" height="371" src="https://www.youtube.com/embed/anoGi_RpQ20" frameborder="0" allowfullscreen></iframe>
-(Check from 2:20)
+<div>
+    <div class='embed-container'>
+        <iframe src='https://www.youtube.com/embed//zsrrVDk6VBs?start=213' frameborder='0' allowfullscreen>
+        </iframe>
+    </div>
+</div>
 
 ### Place Supplier On Hold
 In the Supplier form, check the "Block Supplier" checkbox. Next, choose the "Hold Type".
diff --git a/erpnext/docs/user/manual/en/customize-erpnext/custom-scripts/custom-script-examples/fetch value in child table field b/erpnext/docs/user/manual/en/customize-erpnext/custom-scripts/custom-script-examples/fetch value in child table field
new file mode 100644
index 0000000..8caf8f5
--- /dev/null
+++ b/erpnext/docs/user/manual/en/customize-erpnext/custom-scripts/custom-script-examples/fetch value in child table field
@@ -0,0 +1,17 @@
+## Example to fetch value in a child table field from master doctype
+
+
+### Sample Script to fetch expiry_date field from Batch doctype to Sales Invoice Item table
+
+Step 1: Create Custom Script for _**Sales Invoice**_ (parent) doctype
+
+Step 2: Script as below & Save
+
+```
+frappe.ui.form.on("Sales Invoice Item", "batch_no", function(frm, cdt, cdn) {
+	var d = locals[cdt][cdn];
+    	frappe.db.get_value("Batch", {"name": d.batch_no}, "expiry_date", function(value) {
+    		d.expiry_date = value.expiry_date;
+    	});
+});
+```
diff --git a/erpnext/docs/user/manual/en/education/Assessment/assessment_criteria.md b/erpnext/docs/user/manual/en/education/Assessment/assessment_criteria.md
index c5740ca..b443cc8b 100644
--- a/erpnext/docs/user/manual/en/education/Assessment/assessment_criteria.md
+++ b/erpnext/docs/user/manual/en/education/Assessment/assessment_criteria.md
@@ -19,6 +19,6 @@
         <iframe src='https://www.youtube.com/embed/t8ZDDq4qtIk?end=52' frameborder='0' allowfullscreen>
         </iframe>
     </div>
-<div>
+</div>
 
 {next}
\ No newline at end of file
diff --git a/erpnext/docs/user/manual/en/education/Assessment/assessment_group.md b/erpnext/docs/user/manual/en/education/Assessment/assessment_group.md
index b7599b8..3473ad1 100644
--- a/erpnext/docs/user/manual/en/education/Assessment/assessment_group.md
+++ b/erpnext/docs/user/manual/en/education/Assessment/assessment_group.md
@@ -19,6 +19,6 @@
         <iframe src='https://www.youtube.com/embed/I1T7Z2JbcP4' frameborder='0' allowfullscreen>
         </iframe>
     </div>
-<div>
+</div>
 
 {next}
\ No newline at end of file
diff --git a/erpnext/docs/user/manual/en/education/Attendance/student-attendance-tool.md b/erpnext/docs/user/manual/en/education/Attendance/student-attendance-tool.md
index 4ad2ab8..0425072 100644
--- a/erpnext/docs/user/manual/en/education/Attendance/student-attendance-tool.md
+++ b/erpnext/docs/user/manual/en/education/Attendance/student-attendance-tool.md
@@ -2,13 +2,13 @@
 
 The Student Attendance tool allow you to bulk update the attendance for students based on **Student Group and Course Schedule**.
 
-To mark the **Attedance* based on Student Group select the group based on 
+To mark the **Attedance* based on Student Group select the group based on
 
 **1. Batch
   2. Course
   3. Activity **
 
-Student detials will be autofetched and you can mark the attendance of the given date. 
+Student detials will be autofetched and you can mark the attendance of the given date.
 
 <img class="screenshot" alt="Student Attendance" src="{{docs_base_url}}/assets/img/education/setup/student-attendance-tool.gif">
 
@@ -21,6 +21,6 @@
     <iframe src='https://www.youtube.com/embed//j9pgkPuyiaI?start=63' frameborder='0' allowfullscreen>
     </iframe>
   </div>
-<div>
+</div>
 
 {next}
\ No newline at end of file
diff --git a/erpnext/docs/user/manual/en/education/index.md b/erpnext/docs/user/manual/en/education/index.md
index ff505f0..4f96b79 100644
--- a/erpnext/docs/user/manual/en/education/index.md
+++ b/erpnext/docs/user/manual/en/education/index.md
@@ -1,7 +1,7 @@
 <!-- add-breadcrumbs -->
 # ERPNext for Education
 
-The Education domain in ERPNext is designed to meet requirements of any organization which imparts knowledge and believe in doing it in an organized fashion. It has already been used at the schools, colleges and even at the private firms. 
+The Education domain in ERPNext is designed to meet requirements of any organization which imparts knowledge and believe in doing it in an organized fashion. It has already been used at the schools, colleges and even at the private firms.
 
 It helps you effectively manage administrative side and allows you to focus on what is most important for your institute, **to educate!**
 
@@ -32,7 +32,7 @@
         <iframe src='https://www.youtube.com/embed/t8ZDDq4qtIk?end=52' frameborder='0' allowfullscreen>
         </iframe>
     </div>
-<div>
+</div>
 
 ### User Manual
 
diff --git a/erpnext/docs/user/manual/en/healthcare/index.md b/erpnext/docs/user/manual/en/healthcare/index.md
index 62e537d..7755158 100755
--- a/erpnext/docs/user/manual/en/healthcare/index.md
+++ b/erpnext/docs/user/manual/en/healthcare/index.md
@@ -19,7 +19,7 @@
         <iframe src='https://www.youtube.com/embed/1n4_YqX8ArA' frameborder='0' allowfullscreen>
         </iframe>
     </div>
-<div>
+</div>
 
 ### User Manual
 
diff --git a/erpnext/docs/user/manual/en/human-resources/employee.md b/erpnext/docs/user/manual/en/human-resources/employee.md
index 092d11d..c6aed24 100644
--- a/erpnext/docs/user/manual/en/human-resources/employee.md
+++ b/erpnext/docs/user/manual/en/human-resources/employee.md
@@ -1,6 +1,20 @@
 # Employee
 
-There are many fields you can add in your Employee records.
+An individual who works part-time or full-time under a contract of employment, and has recognized rights and duties is your Employee.
+
+In ERPNext, you can manage Employee master. The Employee master captures demographics, personal and professional details. 
+
+<img class="screenshot" alt="Employee" src="{{docs_base_url}}/assets/img/human-resources/employee-view.gif">
+
+You can further use this Employee master for performing various HR functions like:
+
+1. Processing Payroll
+1. Leave Allocation and Application
+1. Employee Advance and Expense Claim
+1. Loan Application
+1. Performance Appraisal
+
+### New Employee
 
 To create new Employee go to:
 
@@ -8,6 +22,14 @@
 
 <img class="screenshot" alt="Employee" src="{{docs_base_url}}/assets/img/human-resources/employee.png">
 
+### Employee Deputation
+
+Once an Employee is created, you can update Department, Designation, Employee to whom he/she will report to etc.
+
+<img class="screenshot" alt="Employee" src="{{docs_base_url}}/assets/img/human-resources/employee-job-profile.png">
+
+<hr>
+
 <div class="embed-container">    
     <iframe src="https://www.youtube.com/embed/kkwOzeU4wFU?rel=0" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>
 </div>
diff --git a/erpnext/docs/user/manual/en/manufacturing/articles/scrap-management.md b/erpnext/docs/user/manual/en/manufacturing/articles/scrap-management.md
new file mode 100644
index 0000000..25c1eea
--- /dev/null
+++ b/erpnext/docs/user/manual/en/manufacturing/articles/scrap-management.md
@@ -0,0 +1,23 @@
+# Production Scrap Management
+
+Scrap means waste that either has no economic value or only the value of its basic material content recoverable through recycling.
+
+Scrap is generally availed at the end of the manufacture process. Also you can find some products that are damaged or that are unusable due to expiry or for some other reason, which needs to be scraped.
+
+In ERPNext, at the end of manufacturing process, scrap items are accounted in the scrap warehouse.s
+
+### Scrap in Bill of Materials
+
+You can update estimated scrap quantity of an item in the BOM, Scrap table. If required, you can reselect a raw-material item as scrap.
+
+<img class="screenshot" alt="Scrap in BOM" src="{{docs_base_url}}/assets/img/manufacturing/scrap-1.png">
+
+### Scrap in Manufacture Entry
+
+When production is completed, Finish / Manufacture Entry is created against a Production Order. In this entry, scrap item is fetched in the Item table, with only Target Warehouse updated for it. Ensure that Valuation Rate is updated for this item for the accounts posting purposes.
+
+<img class="screenshot" alt="Scrap in Manufacture Entry" src="{{docs_base_url}}/assets/img/manufacturing/scrap-2.gif">
+
+> Scrap from the BOM will only work if Manufacture Entry is created based on BOM, and not based on Material Transfer. This is configurable from Manufacturing Settings.
+
+<img class="screenshot" alt="Manufacturing Settings" src="{{docs_base_url}}/assets/img/manufacturing/manufacturing-settings.png">
\ No newline at end of file
diff --git a/erpnext/docs/user/manual/en/non_profit/index.md b/erpnext/docs/user/manual/en/non_profit/index.md
index 819cf79..db1fbe4 100644
--- a/erpnext/docs/user/manual/en/non_profit/index.md
+++ b/erpnext/docs/user/manual/en/non_profit/index.md
@@ -21,7 +21,7 @@
         <iframe src='https://www.youtube.com/embed/p3l0Kq-TU5Y' frameborder='0' allowfullscreen>
         </iframe>
     </div>
-<div>
+</div>
 
 ### User Manual
 
diff --git a/erpnext/docs/user/manual/en/projects/index.md b/erpnext/docs/user/manual/en/projects/index.md
index e658eb8..16a952a 100644
--- a/erpnext/docs/user/manual/en/projects/index.md
+++ b/erpnext/docs/user/manual/en/projects/index.md
@@ -29,7 +29,7 @@
         <iframe src='https://www.youtube.com/embed/mI8IkiGhaPA' frameborder='0' allowfullscreen>
         </iframe>
     </div>
-<div>
+</div>
 
 ### User Manual
 
diff --git a/erpnext/docs/user/manual/en/projects/index.txt b/erpnext/docs/user/manual/en/projects/index.txt
index 2f450ac..11f5901 100644
--- a/erpnext/docs/user/manual/en/projects/index.txt
+++ b/erpnext/docs/user/manual/en/projects/index.txt
@@ -1,7 +1,9 @@
 tasks
 project
-time-log-batch
+timesheet
+project-customer-portal
+project-profitability
+project-expense-claims
 activity-type
 activity-cost
 articles
-timesheet
diff --git a/erpnext/docs/user/manual/en/projects/project-customer-portal.md b/erpnext/docs/user/manual/en/projects/project-customer-portal.md
new file mode 100644
index 0000000..24ea099
--- /dev/null
+++ b/erpnext/docs/user/manual/en/projects/project-customer-portal.md
@@ -0,0 +1,21 @@
+# Project from Customer Portal
+
+If you are doing a Project for a Customer, then Customer will need to be updated on its progress on timely bases. In ERPNext, since it is a Customer Portal feature, you can let Customer update oneself on the Project's progress via Customer Portal.
+
+### Add User as a Website User
+
+For a Customer to be able to access Project from the portal, should be added as a Website User. A Customer can also sign up from the Login Page of your ERPNext account, using the same Email ID as mentioned in the Contact master. Or you can invite that User from the Contact master.
+
+<img class="screenshot" alt="Customer in Project" src="{{docs_base_url}}/assets/img/project/project-portal-2.png">
+
+### Add Customer and User in Project
+
+In the Project master, check Customer Details section. Select a Customer and Sales Order associated with this Project.
+
+<img class="screenshot" alt="Customer in Project" src="{{docs_base_url}}/assets/img/project/project-portal-user.png">
+
+### Portal View of Project
+
+When a Customer logins from the Portal, he/she will be able to view all the Task for that Project. Also, the customer will be able to update the status of the Tasks or comment when needed.
+
+<img class="screenshot" alt="Customer in Project" src="{{docs_base_url}}/assets/img/project/project-portal.gif">
\ No newline at end of file
diff --git a/erpnext/docs/user/manual/en/projects/project-expense-claims.md b/erpnext/docs/user/manual/en/projects/project-expense-claims.md
new file mode 100644
index 0000000..76e0389
--- /dev/null
+++ b/erpnext/docs/user/manual/en/projects/project-expense-claims.md
@@ -0,0 +1,15 @@
+# Project and Managing Expenses
+
+The Employees working on the Project incur various expenses, sometimes from their own pocket. In ERPNext, then can claim such expenses using [Expense Claim](/docs/user/manual/en/human-resources/expense-claim.html)
+
+In this Expense Claim, they can also select a Project for which that expense was incurred.
+
+Based on the Expense Claims made for a particular project, total Expense Claim Amount is updated in the Project master, under project costing section.
+
+* You can create an Expense Claims directly and link it to the Project.
+
+<img class="screenshot" alt="Project - Link Expense Claim" src="{{docs_base_url}}/assets/img/project/project-expense-claim-1.png">
+
+* Total amount of Expense Claims booked against a project is shown under 'Total Expense Claim' in the Project Costing Section
+
+<img class="screenshot" alt="Project - Total Expense Claim" src="{{docs_base_url}}/assets/img/project/project-expense-claim-2.png">
\ No newline at end of file
diff --git a/erpnext/docs/user/manual/en/projects/project-profitability.md b/erpnext/docs/user/manual/en/projects/project-profitability.md
new file mode 100644
index 0000000..cea7050
--- /dev/null
+++ b/erpnext/docs/user/manual/en/projects/project-profitability.md
@@ -0,0 +1,36 @@
+# Project Profitability
+
+Project and related activities are generally active for longer time periods. While developments happen on the Project, there are various income and expense incurred against it. Hence, it becomes important to track the Profitability of a Project and ensure that you don't overspend.
+
+### Project in Sales Transactions
+
+You can link a Project in all the sales transactions like Sales Order, Delivery Note, Sales Invoice, and Payment. Linking Project with the sales transactions will help you in tracking income received against that Project.
+
+In sales transactions, Project field is generally available in the More Information section.
+
+<img class="screenshot" alt="Project in Sales" src="{{docs_base_url}}/assets/img/project/project-profitability-1.png">
+
+
+#### Project in Purchase Transactions
+
+The project can also be linked to the purchase transactions like Purchase Order, Purchase Receipt, and Purchase Invoice.
+
+In the purchase transactions, Project's link field is available in the Item table. This is because you could be procuring material for multiple Projects from the same purchase entry.
+
+<img class="screenshot" alt="Project in Purchases" src="{{docs_base_url}}/assets/img/project/project-profitability-2.png">
+
+### Budgeting against Project
+
+You can create Budget for a Project as well. The expense limit defined in the Budget master will be validated in the expense transactions.
+
+<img class="screenshot" alt="Project Budgeting" src="{{docs_base_url}}/assets/img/project/project-budgeting.png">
+
+### Project Profitability
+
+Based on the all the income and expense entries created for the Project, you can get its profitability.
+
+> Accounts > Profitability Analysis
+
+Filter report based on Project to check Projectwise Profitability.
+
+<img class="screenshot" alt="Project Profitability" src="{{docs_base_url}}/assets/img/project/profitability-analysis.png">
\ No newline at end of file
diff --git a/erpnext/docs/user/manual/en/projects/project.md b/erpnext/docs/user/manual/en/projects/project.md
index 82f0e6d..a8091b8 100644
--- a/erpnext/docs/user/manual/en/projects/project.md
+++ b/erpnext/docs/user/manual/en/projects/project.md
@@ -1,13 +1,20 @@
 # Project
 
-Project management in ERPNext is Task driven. You can create Project and assign multiple Tasks against it.
+The project is an individual or collaborative enterprise, possibly involving research or design, that is carefully planned, usually by a project team, to achieve a particular aim
 
-<img class="screenshot" alt="Project" src="{{docs_base_url}}/assets/img/project/project.png">
+In ERPNext, Project management in is Task driven. You can a create Project and divide into multiple and assignable Tasks.
 
-<div class="embed-container">
-  <iframe src="https://www.youtube.com/embed/gCzShu9Niu4?rel=0" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen>
-  </iframe>
-</div>
+<img class="screenshot" alt="Project" src="{{docs_base_url}}/assets/img/project/project-1.1.png">
+
+### Managing Tasks
+
+The project is generally has a broader scope, and hence not assignable to an individual. Hence, you can divide the Project into multiple Tasks. These can be assigned to an individual and tracked better. 
+
+These Tasks can be created from a Project itself or a [Task](/docs/user/manual/en/projects/tasks.html) can be created separately as well.
+
+<img class="screenshot" alt="Project" src="{{docs_base_url}}/assets/img/project/project-1.png">
+
+### Task Completion
 
 You can also track % Completion of a Project using different methods.
 
@@ -15,100 +22,39 @@
   2. Task Progress
   3. Task Weight
 
-<img class="screenshot" alt="Project" src="{{docs_base_url}}/assets/img/project/project-percent-complete.png">
+<img class="screenshot" alt="Project 2" src="{{docs_base_url}}/assets/img/project/project-2.png">
 
 Some examples of how the % Completion is calculated based on Tasks.
 
-<img class="screenshot" alt="Project" src="{{docs_base_url}}/assets/img/project/percent-complete-calc.png">
+<img class="screenshot" alt="Project 3" src="{{docs_base_url}}/assets/img/project/percent-complete-calc.png">
 
-<img class="screenshot" alt="Project" src="{{docs_base_url}}/assets/img/project/percent-complete-formula.png">
+<img class="screenshot" alt="Project 4" src="{{docs_base_url}}/assets/img/project/percent-complete-formula.png">
 
-### Managing tasks
-Project can be divided into multiple Tasks.
-Task can be created via Project document itself or can be created via  [Task](/docs/user/manual/en/projects/tasks.html)
-
-<img class="screenshot" alt="Project" src="{{docs_base_url}}/assets/img/project/project_task.png">
-
-* To view Task made against a Project click on 'Tasks'
-
-<img class="screenshot" alt="Project - View Task" src="{{docs_base_url}}/assets/img/project/project_view_task.png">
-
-<img class="screenshot" alt="Project - Task List" src="{{docs_base_url}}/assets/img/project/project_task_list.png">
-
-* You can also view the Tasks from the Project document itself
-
-<img class="screenshot" alt="Project - Task Grid" src="{{docs_base_url}}/assets/img/project/project_task_grid.png">
-
-* To add Weights to Tasks you can follow the below steps
-
-<img class="screenshot" alt="Project - Task Grid" src="{{docs_base_url}}/assets/img/project/tasks.png">
-<img class="screenshot" alt="Project - Task Grid" src="{{docs_base_url}}/assets/img/project/task-weights.png">
-
-
-### Managing time
-
-ERPNext uses [Time Log](/docs/user/manual/en/projects/time-log.html) to track the progress of a Project.
-You can create Time Logs against each task.
-The Actual Start and End Time along with the costing shall then be updated based on the Time Log.
-
-* To view Time Log made against a Project click on 'Time Logs'
-
-<img class="screenshot" alt="Project - View Time Log" src="{{docs_base_url}}/assets/img/project/project_view_time_log.png">
-
-<img class="screenshot" alt="Project - Time Log List" src="{{docs_base_url}}/assets/img/project/project_time_log_list.png">
-
-* You can also create a Time Log directlly and link it to the Project.
-
-<img class="screenshot" alt="Project - Link Time Log" src="{{docs_base_url}}/assets/img/project/project_time_log_link.png">
-
-### Managing expenses
-
-You can book [Expense Claim](/docs/user/manual/en/human-resources/expense-claim.html) against a project task.
-The system shall update the total amount from expense claims in the project costing section.
-
-* To view Expense Claims made against a Project click on 'Expense Claims'
-
-<img class="screenshot" alt="Project - View Expense Claim" src="{{docs_base_url}}/assets/img/project/project_view_expense_claim.png">
-
-* You can also create a Expense Claims directlly and link it to the Project.
-
-<img class="screenshot" alt="Project - Link Expense Claim" src="{{docs_base_url}}/assets/img/project/project_expense_claim_link.png">
-
-* Total amount of Expense Claims booked against a project is shown under 'Total Expense Claim' in the Project Costing Section
-
-<img class="screenshot" alt="Project - Total Expense Claim" src="{{docs_base_url}}/assets/img/project/project_total_expense_claim.png">
-
-### Cost Center
-
-You can make a [Cost Center](/docs/user/manual/en/accounts/setup/cost-center.html) against a Project or use an existing cost center to track all expenses made against that project.
-
-<img class="screenshot" alt="Project - Cost Center" src="{{docs_base_url}}/assets/img/project/project_cost_center.png">
-
-###Project Costing
+### Project Costing
 
 The Project Costing section helps you track the time, expenses and purchases incurred against the project.
 
 <img class="screenshot" alt="Project - Costing" src="{{docs_base_url}}/assets/img/project/project_costing.png">
 
-* The Total Cost is composed of the costing amount from timesheets, the total cost from expense claims and the total cost from purchase invoices created against this project.
+* The Total Cost is composed of the costing amount from timesheets, the total cost of expense claims and the total cost of purchase invoices created against this project.
 
 * The Gross Margin is the difference between Total Billed Amount and the Total Cost Amount for this project.
 
-###Billing
+### Gantt Chart
 
-You can make/link a [Sales Order](/docs/user/manual/en/selling/sales-order.html) against a project. Once linked you can use the standard sales module to bill your customer against the Project.
+ERPNext gives you an illustrated view of tasks scheduled for that project in Gantt Chart View.
 
-<img class="screenshot" alt="Project - Sales Order" src="{{docs_base_url}}/assets/img/project/project_sales_order.png">
+* To view Gantt chart against a project, go to the Task list and Apply filter on the Project.
 
-###Gantt Chart
+<img class="screenshot" alt="Project Gantt" src="{{docs_base_url}}/assets/img/project/project-1.1.png">
 
-A Gantt Chart illustrates a project schedule.
-ERPNext gives you a illustrated view of tasks scheduled against that project in Gantt Chart View.
+### Project Help Video
 
-* To view gantt chart against a project, go to that project and click on 'Gantt Chart'
+This is a tutorial video on how to manage Project and associate Tasks in ERPNext.
 
-<img class="screenshot" alt="Project - View Gantt Chart" src="{{docs_base_url}}/assets/img/project/project_view_gantt_chart.png">
+<div class="embed-container">
+  <iframe src="https://www.youtube.com/embed/gCzShu9Niu4?rel=0" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen>
+  </iframe>
+</div>
 
-<img class="screenshot" alt="Project - Gantt Chart" src="{{docs_base_url}}/assets/img/project/project_gantt_chart.png">
-
-{next}
+{next}
\ No newline at end of file
diff --git a/erpnext/docs/user/manual/en/projects/time-log-batch.md b/erpnext/docs/user/manual/en/projects/time-log-batch.md
deleted file mode 100644
index 6904f4e..0000000
--- a/erpnext/docs/user/manual/en/projects/time-log-batch.md
+++ /dev/null
@@ -1,25 +0,0 @@
-# Time Log Batch
-
-You can bill Time Logs by batching them together. This gives you the flexiblity to manage your customer billing in the way you want. To create a new Time Sheet, go to 
-
-> Projects > Time Sheet > New Time Sheet
-
-OR
-
-Just open your Time Log list and check the Items to you want to add to the Time Log. Then click on "Make Time Sheet" button and these Time Logs will be selected.
-
-<img class="screenshot" alt="Time Log - Drag Calender" src="{{docs_base_url}}/assets/img/project/time_sheet.gif">
-
-###Making Sales Invoice
-
-* After submitting the Time Sheet, "Make Invoice" button shall appear.
-
-<img class="screenshot" alt="Time Log - Drag Calender" src="{{docs_base_url}}/assets/img/project/time_sheet_make_invoice.png">
-
-* Click on that button to raise a Sales Invoice against the Time Sheet.
-
-<img class="screenshot" alt="Time Log - Drag Calender" src="{{docs_base_url}}/assets/img/project/time_sheet_sales_invoice.png">
-
-* When you "Submit" the Sales Invoice, the Sales Invoice number will get updated in the Time Logs and Time Sheet and their status will change to "Billed".
-
-{next}
\ No newline at end of file
diff --git a/erpnext/docs/user/manual/en/selling/index.md b/erpnext/docs/user/manual/en/selling/index.md
index 3fa3dcc..491a022 100644
--- a/erpnext/docs/user/manual/en/selling/index.md
+++ b/erpnext/docs/user/manual/en/selling/index.md
@@ -12,6 +12,6 @@
 
 
 <div class="embed-container">
-    <iframe width="560" height="315" src="https://www.youtube.com/embed/1eP90MWoDQM?rel=0" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen>
+    <iframe src="https://www.youtube.com/embed/1eP90MWoDQM?rel=0" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen>
     </iframe>
 </div>
diff --git a/erpnext/docs/user/manual/en/setting-up/setting-up-taxes.md b/erpnext/docs/user/manual/en/setting-up/setting-up-taxes.md
index 2886c05..cf688c7 100644
--- a/erpnext/docs/user/manual/en/setting-up/setting-up-taxes.md
+++ b/erpnext/docs/user/manual/en/setting-up/setting-up-taxes.md
@@ -102,7 +102,7 @@
   <div class="embed-container">
     <iframe src="https://www.youtube.com/embed/a8Eh4zLIrkU?rel=0" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen>
     </iframe>
-  <div> 
+  </div>
 </div>
 
 {next}
diff --git a/erpnext/docs/user/manual/en/setting-up/workflows.md b/erpnext/docs/user/manual/en/setting-up/workflows.md
index e5e4c44..058f537 100644
--- a/erpnext/docs/user/manual/en/setting-up/workflows.md
+++ b/erpnext/docs/user/manual/en/setting-up/workflows.md
@@ -42,6 +42,14 @@
 > Note 4: If you wish to give the option to cancel, you will have to write a
 workflow transition step that says from submitted you can cancel.
 
+
+#### Enable/Disable Self approval
+
+> New in Version 11
+
+<img class="screenshot" alt="Workflow" src="{{docs_base_url}}/assets/img/setup/workflow-6.png">
+
+
 #### Conditions
 
 > New in Version 11
@@ -71,9 +79,30 @@
 
 <img class="screenshot" alt="Workflow" src="{{docs_base_url}}/assets/img/setup/workflow-5.png">
 
-<div class-"embed-container">
-    <iframe src="https://www.youtube.com/embed/yObJUg9FxFs?rel=0" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen>
-    </iframe>
+#### Workflow Actions
+
+> New in Version 11
+
+Workflow Actions is a single place to manage all the pending actions you can take on Workflows.
+
+If a User is eligible to take action on some workflows, emails will be sent to the user, with the relevant document as attachment, from where the user can `Approve` or `Reject` the Workflow.
+<img class="screenshot" alt="Workflow" src="{{docs_base_url}}/assets/img/setup/workflow-actions-email.png">
+
+Also the users will see entries in their Workflow Action list.
+<img class="screenshot" alt="Workflow" src="{{docs_base_url}}/assets/img/setup/workflow-actions-list.png">
+
+**Note:** You can set email template for Workflow Actions on each state.
+The template might consist message for users to proceed with the next Workflow Actions
+
+
+### Video Tutorial:
+
+<div>
+    <div class="embed-container">
+        <iframe src="https://www.youtube.com/embed/yObJUg9FxFs?rel=0" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen>
+        </iframe>
+    </div>
 </div>
 
 {next}
+
diff --git a/erpnext/docs/user/manual/en/stock/articles/allow-over-delivery-billing-against-sales-order-upto-certain-limit.md b/erpnext/docs/user/manual/en/stock/articles/allow-over-delivery-billing-against-sales-order-upto-certain-limit.md
index 9b140a6..f5a589d 100644
--- a/erpnext/docs/user/manual/en/stock/articles/allow-over-delivery-billing-against-sales-order-upto-certain-limit.md
+++ b/erpnext/docs/user/manual/en/stock/articles/allow-over-delivery-billing-against-sales-order-upto-certain-limit.md
@@ -1,22 +1,24 @@
 #Allow Over Delivery/Billing
 
-While creating Delivery Note, system validates if item's Qty mentined is same as in the Sales Order. If Item Qty has been increased, you will get over-delivery validation. If you want to be able to deliver more items than mentioned in the Sales Order, you should update "Allow over delivery or receipt upto this percent" in the Item master.
+When creating a Delivery Note, system validates if item's qty is same as in the Sales Order. If item's qty has been increased, you will get the validation message of over-delivery or receipt. 
 
-<img alt="Item wise Allowance percentage" class="screenshot" src="{{docs_base_url}}/assets/img/articles/allowance-percentage-1.png">
+Considering the case fo sales, if you want to be able to deliver more items than mentioned in the Sales Order, you should update "Allow over delivery or receipt upto this percent" in the Item master.
 
-Item's and Rate is also validated when creating Sales Invoice from Sales Order. Also when creating Purchase Receipt and Purchaes Invoice from Purchase Order. Updating "Allow over delivery or receipt upto this percent" will be affective in all sales and purchase transactions.
+<img alt="Itemised Limit Percentage" class="screenshot" src="{{docs_base_url}}/assets/img/articles/limit-1.png">
 
-For example, if you have ordered 100 units of an item, and if item's over receipt percent is 50%, then you are allowed to make Purchase Receipt for upto 150 units.
+When creating an invoice, item's rate is also validated based on the preceding transaction like Sales Order. This also applies when creating Purchase Receipt or Purchaes Invoice from Purchase Order. Updating "Allow over delivery or receipt upto this percent" will be affective in all sales and purchase transactions.
+
+For example, if you have ordered 100 units of an item, and if item's over receipt percent is 50, then you are allowed to make Purchase Receipt for upto 150 units.
 
 Update global value for "Allow over delivery or receipt upto this percent" from Stock Settings. Value updated here will be applicable for all the items.
 
 1. Go to `Stock > Setup > Stock Settings`
 
-2. Set `Allowance Percentage`.
+2. Set `Limit Percentage`.
 
 3. Save Stock Settings.
 
-<img alt="Item wise Allowance percentage" class="screenshot" src="{{docs_base_url}}/assets/img/articles/allowance-percentage-2.png">
+<img alt="Item wise Allowance percentage" class="screenshot" src="{{docs_base_url}}/assets/img/articles/limit-2.png">
 
 
 <!-- markdown -->
diff --git a/erpnext/docs/user/manual/en/stock/articles/material-transfer-from-delivery-note.md b/erpnext/docs/user/manual/en/stock/articles/material-transfer-from-delivery-note.md
new file mode 100644
index 0000000..02bdadf
--- /dev/null
+++ b/erpnext/docs/user/manual/en/stock/articles/material-transfer-from-delivery-note.md
@@ -0,0 +1,29 @@
+# Material Transfer from Delivery Note
+
+In ERPNext, you can create Material Transfer entry from [Stock Entry](/docs/user/manual/en/stock/stock-entry.html) document. However, there are some scenarios in the Material Transfer where it needs to be presented as a Delivery Note. 
+
+### Scenarios
+
+1. One of the examples is when you transfer a Material from your stores to project site, however, you need to present it as a Delivery Note to the client.
+
+2. Also, there are statutory requirements where taxes are to be applied on each transfer of Material. It is easier to manage in a transaction like Delivery Note, than in the Stock Entry.
+
+Considering these scenarios, the provision of Material Transfer has been added in the Delivery Note as well. Following are the steps to use Delivery Note for creating Material Transfer entry.
+
+### Steps
+
+#### Enable Customer Warehouse
+
+Delivery Note Item doctype as a hidden field of Customer Warehouse. You can enable it from [Customize Form](/docs/user/manual/en/customize-erpnext/customize-form.html). Here is the quick demonstration of the same.
+
+<img class="screenshot" alt="Delivery Note Material Transfer" src="{{docs_base_url}}/assets/img/stock/customer-warehouse.gif">
+
+### Select Warehouses
+
+When creating a Delivery Note for Material Transfer, for an item select source Warehouse as From Warehouse.
+
+In the Customer Warehouse, select a Warehouse where Material is to be transferred or select a target warehouse.
+
+<img class="screenshot" alt="Delivery Note Material Transfer" src="{{docs_base_url}}/assets/img/stock/customer-warehouse-2.png">
+
+On the submission of a Delivery Note, item's stock will be deducted from "From Warehouse" and added to the "Customer Warehouse".
\ No newline at end of file
diff --git a/erpnext/docs/user/manual/en/stock/articles/opening-stock-balance-entry-for-serialized-and-batch-item.md b/erpnext/docs/user/manual/en/stock/articles/opening-stock-balance-entry-for-serialized-and-batch-item.md
index 0661a2e..c7a0bb1 100644
--- a/erpnext/docs/user/manual/en/stock/articles/opening-stock-balance-entry-for-serialized-and-batch-item.md
+++ b/erpnext/docs/user/manual/en/stock/articles/opening-stock-balance-entry-for-serialized-and-batch-item.md
@@ -62,6 +62,6 @@
         <iframe src="https://www.youtube.com/embed/nlHX0ZZ84Lw?start=120" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen>
         </iframe>
     </div>
-<div>
+</div>
 
 <!-- markdown -->
\ No newline at end of file
diff --git a/erpnext/docs/user/manual/en/stock/item/item-variants.md b/erpnext/docs/user/manual/en/stock/item/item-variants.md
index b582427..7d8a3cd 100644
--- a/erpnext/docs/user/manual/en/stock/item/item-variants.md
+++ b/erpnext/docs/user/manual/en/stock/item/item-variants.md
@@ -65,6 +65,6 @@
 <div class="embed-container">
 	<iframe src="https://www.youtube.com/embed/SngZtDIMdiQ?rel=0" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen>
 	</iframe>
-<div>
+</div>
 
 {next}
diff --git a/erpnext/docs/user/manual/en/stock/material-request.md b/erpnext/docs/user/manual/en/stock/material-request.md
index 1c2eb9d..fc32093 100644
--- a/erpnext/docs/user/manual/en/stock/material-request.md
+++ b/erpnext/docs/user/manual/en/stock/material-request.md
@@ -32,10 +32,11 @@
 > Info: Material Request is not mandatory. It is ideal if you have centralized
 buying so that you can collect this information from various departments.
 
-
 <div>
-  <iframe src="https://www.youtube.com/embed/55Gk2j7Q8Zw?rel=0" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen>
-  </iframe>
+  <div class="embed-container">
+    <iframe src="https://www.youtube.com/embed/55Gk2j7Q8Zw?rel=0" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen>
+    </iframe>
+  </div>
 </div>
 
 {next}
diff --git a/erpnext/docs/user/videos/learn/advance-payments.md b/erpnext/docs/user/videos/learn/advance-payments.md
index f08053f..5abcd83 100644
--- a/erpnext/docs/user/videos/learn/advance-payments.md
+++ b/erpnext/docs/user/videos/learn/advance-payments.md
@@ -1,7 +1,7 @@
 # Advance Payment
 
-<iframe width="660" height="371" src="https://www.youtube.com/embed/J46-6qtyZ9U" frameborder="0" allowfullscreen></iframe>
+<iframe width="660" height="371" src="https://www.youtube.com/embed/3wiIXId6dzg" frameborder="0" allowfullscreen></iframe>
 
-**Duration: 2:52**
+**Duration: 3:11**
 
 In sales and purchase transaction, generally advance payments are involved. This tutorial covers how you can create advance payment entries against Sales Order and Purchase Order, and adjust the same in the final invoice.
\ No newline at end of file
diff --git a/erpnext/docs/user/videos/learn/discounts.md b/erpnext/docs/user/videos/learn/discounts.md
new file mode 100644
index 0000000..e4668bb
--- /dev/null
+++ b/erpnext/docs/user/videos/learn/discounts.md
@@ -0,0 +1,7 @@
+# Applying Discounts
+
+<iframe width="660" height="371" src="https://www.youtube.com/embed/0850LAIPUBU" frameborder="0" allowfullscreen></iframe>
+
+**Duration: 2:23**
+
+This is a video tutorial on how to apply discounts in the sales and purchase transactions.
\ No newline at end of file
diff --git a/erpnext/docs/user/videos/learn/email-account.md b/erpnext/docs/user/videos/learn/email-account.md
index 0ac4e98..b2b40d6 100644
--- a/erpnext/docs/user/videos/learn/email-account.md
+++ b/erpnext/docs/user/videos/learn/email-account.md
@@ -1,7 +1,7 @@
 # Email Account
 
-<iframe width="660" height="371" src="https://www.youtube.com/embed/YFYe0DrB95o" frameborder="0" allowfullscreen></iframe>
+<iframe width="660" height="371" src="https://www.youtube.com/embed/ChsFbIuG06g" frameborder="0" allowfullscreen></iframe>
 
-**Duration: 2:27**
+**Duration: 4:00**
 
 This video walks you through setting up Email Account for incoming and outgoing emails. For hosted users, outgoing email gateway is set by default. Based on incoming email, you can have new document (like Issue, Lead etc.) auto-created, and have email received on these id's appended to specified document.
diff --git a/erpnext/docs/user/videos/learn/email-inbox.md b/erpnext/docs/user/videos/learn/email-inbox.md
new file mode 100644
index 0000000..dd69bb8
--- /dev/null
+++ b/erpnext/docs/user/videos/learn/email-inbox.md
@@ -0,0 +1,7 @@
+# Email Inbox
+
+<iframe width="660" height="371" src="https://www.youtube.com/embed/KkKwtRwGvKw" frameborder="0" allowfullscreen></iframe>
+
+**Duration: 2:51**
+
+This is video tutorial on how a user can configure an Email Inbox for his/her ID. Email Inbox is integrated well with other functionalities like Support Issues, Opportuniies and Communication.
\ No newline at end of file
diff --git a/erpnext/docs/user/videos/learn/employee-advance.md b/erpnext/docs/user/videos/learn/employee-advance.md
new file mode 100644
index 0000000..48b9f08
--- /dev/null
+++ b/erpnext/docs/user/videos/learn/employee-advance.md
@@ -0,0 +1,7 @@
+# Employee Advance
+
+<iframe width="660" height="371" src="https://www.youtube.com/embed/ja-zY0-7NsQ" frameborder="0" allowfullscreen></iframe>
+
+**Duration: 3:46**
+
+In this video, we will learn how an advance amount is given to an Employee, and how to adjust the same against an Expense Claim.
\ No newline at end of file
diff --git a/erpnext/docs/user/videos/learn/index.md b/erpnext/docs/user/videos/learn/index.md
index f10061c..fde6b48 100644
--- a/erpnext/docs/user/videos/learn/index.md
+++ b/erpnext/docs/user/videos/learn/index.md
@@ -79,9 +79,17 @@
             Opening Account Balances</a>
             <span class="text-muted pull-right">4:40</span>
         </li>
+        <li><a href="/docs/user/videos/learn/opening-invoice-creation-tool.html">
+            Opening Invoices Creation Tool</a>
+            <span class="text-muted pull-right">2:30</span>
+        </li>
         <li><a href="/docs/user/videos/learn/email-account.html">
             Email Account</a>
-            <span class="text-muted pull-right">2:27</span>
+            <span class="text-muted pull-right">4:00</span>
+        </li>
+        <li><a href="/docs/user/videos/learn/email-inbox.html">
+            Email Inbox</a>
+            <span class="text-muted pull-right">2:51</span>
         </li>
         <li><a href="/docs/user/videos/learn/file-manager.html">
             File Manager</a>
@@ -119,6 +127,14 @@
 			Drop Ship</a>
             <span class="text-muted pull-right">2:26</span>
         </li>
+        <li><a href="/docs/user/videos/learn/pricing-rule.html">
+			Pricing Rule</a>
+            <span class="text-muted pull-right">3:56</span>
+        </li>
+        <li><a href="/docs/user/videos/learn/discounts.html">
+			Discounts</a>
+            <span class="text-muted pull-right">2:23</span>
+        </li>
     </ul>
     <br>
     <h3>Buying</h3>
@@ -143,6 +159,14 @@
             Taxes</a>
             <span class="text-muted pull-right">5:13</span>
         </li>
+        <li><a href="/docs/user/videos/learn/pricing-rule.html">
+			Pricing Rule</a>
+            <span class="text-muted pull-right">3:56</span>
+        </li>
+        <li><a href="/docs/user/videos/learn/discounts.html">
+			Discounts</a>
+            <span class="text-muted pull-right">2:23</span>
+        </li>
     </ul>
     <br>
     <h3>Stock</h3>
@@ -201,12 +225,16 @@
         </li>
         <li><a href="/docs/user/videos/learn/advance-payments.html">
             Advance Payments</a>
-              <span class="text-muted pull-right">2:52</span>
+              <span class="text-muted pull-right">3:11</span>
         </li>
         <li><a href="/docs/user/videos/learn/budgeting.html">
               Budgeting</a>
             <span class="text-muted pull-right">3:26</span>
         </li>
+        <li><a href="/docs/user/videos/learn/subscription.html">
+              Subscription Management</a>
+            <span class="text-muted pull-right">2:09</span>
+        </li>
     </ul>
     <br>
     <h3>Manufacturing</h3>
@@ -245,6 +273,10 @@
             Expense Claims</a>
             <span class="text-muted pull-right">2:52</span>
         </li>
+        <li><a href="/docs/user/videos/learn/employee-advance.html">
+            Employee Advance</a>
+            <span class="text-muted pull-right">3:46</span>
+        </li>
     </ul>
     <br>
     <h3>Retail</h3>
diff --git a/erpnext/docs/user/videos/learn/index.txt b/erpnext/docs/user/videos/learn/index.txt
index 956703b..116ac6c 100644
--- a/erpnext/docs/user/videos/learn/index.txt
+++ b/erpnext/docs/user/videos/learn/index.txt
@@ -42,4 +42,10 @@
 services
 distributors
 manufacturing-make-to-order
-manufacturing-enigneer-to-order
\ No newline at end of file
+manufacturing-enigneer-to-order
+opening-invoice-creation-tool
+pricing-rule
+discounts
+email-inbox
+subscription
+employee-advance
\ No newline at end of file
diff --git a/erpnext/docs/user/videos/learn/opening-invoice-creation-tool.md b/erpnext/docs/user/videos/learn/opening-invoice-creation-tool.md
new file mode 100644
index 0000000..0670fa1
--- /dev/null
+++ b/erpnext/docs/user/videos/learn/opening-invoice-creation-tool.md
@@ -0,0 +1,7 @@
+# Opening Invoices Creation Tool
+
+<iframe width="660" height="371" src="https://www.youtube.com/embed/vfWmugaO1zw" frameborder="0" allowfullscreen></iframe>
+
+**Duration: 2:30**
+
+An important on-boarding step for an E R P software includes updating opening sales and purchase invoices. In E R P Next, it is made simple with Opening Invoices Creation Tool. You can use this tool for quickly creatio opening Sales and Purchase Invoices.
\ No newline at end of file
diff --git a/erpnext/docs/user/videos/learn/payment-terms.md b/erpnext/docs/user/videos/learn/payment-terms.md
index 1832b7f..a3821a8 100644
--- a/erpnext/docs/user/videos/learn/payment-terms.md
+++ b/erpnext/docs/user/videos/learn/payment-terms.md
@@ -5,10 +5,8 @@
     </iframe>
 </div>    
 
-**Duration: 2:55**
+**Duration: 2:56**
 
 This tutorial shows you how to set payment terms in ERPNext. Payment Terms help in defining the multiple payment slabs during sales or purchase transactions.
 
 In Payment Terms you can define the breakup of the payment to be received (or made) in terms of different payment modes and the period after the due date. You can also create templates to quickly load the payment terms in a transaction.
-
-
diff --git a/erpnext/docs/user/videos/learn/pricing-rule.md b/erpnext/docs/user/videos/learn/pricing-rule.md
new file mode 100644
index 0000000..fcc808a
--- /dev/null
+++ b/erpnext/docs/user/videos/learn/pricing-rule.md
@@ -0,0 +1,8 @@
+# Pricing Rule
+
+<iframe width="660" height="371" src="https://www.youtube.com/embed/y-9BIWZ5x8Q" frameborder="0" allowfullscreen></iframe>
+
+**Duration: 3:56**
+
+If you apply discounts on the item based on certain conditions, you can use Pricing Rule to define these conditions. In the Pricing Rule, you define criterias based on these parameters for the auto application
+of discount or margin.
diff --git a/erpnext/docs/user/videos/learn/product-bundle.md b/erpnext/docs/user/videos/learn/product-bundle.md
index c17456a..c63fe89 100644
--- a/erpnext/docs/user/videos/learn/product-bundle.md
+++ b/erpnext/docs/user/videos/learn/product-bundle.md
@@ -1,6 +1,6 @@
 # Product Bundle
 
-<iframe width="660" height="371" src="https://www.youtube.com/embed/yk3kPrRyRRc" frameborder="0" allowfullscreen></iframe>
+<iframe width="660" height="371" src="https://www.youtube.com/embed/dxv78E3UF0U" frameborder="0" allowfullscreen></iframe>
 
 **Duration: 2:31**
 
diff --git a/erpnext/docs/user/videos/learn/serialized-inventory.md b/erpnext/docs/user/videos/learn/serialized-inventory.md
index e3b97e1..da2c036 100644
--- a/erpnext/docs/user/videos/learn/serialized-inventory.md
+++ b/erpnext/docs/user/videos/learn/serialized-inventory.md
@@ -1,8 +1,8 @@
 # Serialized Inventory
 
-<iframe width="660" height="371" src="https://www.youtube.com/embed/gvOVlEwFDAk" frameborder="0" allowfullscreen></iframe>
+<iframe width="660" height="371" src="https://www.youtube.com/embed/Q4tYKYTbVek" frameborder="0" allowfullscreen></iframe>
 
-**Duration: 4:11**
+**Duration: 5:33**
 
 If an Item is serialized, a Serial Number (Serial No) record is maintained for each unit of that Item. This information is helpful in tracking the location of the Serial No, its warranty and end-of-life (expiry) information.
 
diff --git a/erpnext/docs/user/videos/learn/subscription.md b/erpnext/docs/user/videos/learn/subscription.md
new file mode 100644
index 0000000..8193e58
--- /dev/null
+++ b/erpnext/docs/user/videos/learn/subscription.md
@@ -0,0 +1,7 @@
+# Subscription Management
+
+<iframe width="660" height="371" src="https://www.youtube.com/embed/CRQfGiMm3_U" frameborder="0" allowfullscreen></iframe>
+
+**Duration: 2:09**
+
+In this video, we will learn about subscription management in ERPNext. Let's suppose you have to create a purchase invoice every month for paying the property rent. You should only create first Purchase Invoice manually, and then create a Subscription for it, so that purchase invoice is auto-created for subsequent each month.
\ No newline at end of file
diff --git a/erpnext/healthcare/doctype/consultation/consultation.py b/erpnext/healthcare/doctype/consultation/consultation.py
index b647c2e..ace5ac0 100755
--- a/erpnext/healthcare/doctype/consultation/consultation.py
+++ b/erpnext/healthcare/doctype/consultation/consultation.py
@@ -5,7 +5,7 @@
 from __future__ import unicode_literals
 import frappe
 from frappe.model.document import Document
-from frappe.utils import getdate
+from frappe.utils import getdate, cstr
 import json
 from erpnext.healthcare.doctype.healthcare_settings.healthcare_settings import get_receivable_account, get_income_account
 
@@ -120,7 +120,7 @@
 def set_subject_field(consultation):
 	subject = "No Diagnosis "
 	if(consultation.diagnosis):
-		subject = "Diagnosis: "+ str(consultation.diagnosis)+". "
+		subject = "Diagnosis: \n"+ cstr(consultation.diagnosis)+". "
 	if(consultation.drug_prescription):
 		subject +="\nDrug(s) Prescribed. "
 	if(consultation.test_prescription):
diff --git a/erpnext/healthcare/doctype/fee_validity/test_fee_validity.py b/erpnext/healthcare/doctype/fee_validity/test_fee_validity.py
index 7ad673d..ed852f1 100644
--- a/erpnext/healthcare/doctype/fee_validity/test_fee_validity.py
+++ b/erpnext/healthcare/doctype/fee_validity/test_fee_validity.py
@@ -61,5 +61,6 @@
 	appointment.physician = physician
 	appointment.department = department
 	appointment.appointment_date = appointment_date
+	appointment.company = "_Test Company"
 	appointment.save(ignore_permissions=True)
 	return appointment
diff --git a/erpnext/healthcare/doctype/lab_test/lab_test.py b/erpnext/healthcare/doctype/lab_test/lab_test.py
index c910d7c..4e07ed6 100644
--- a/erpnext/healthcare/doctype/lab_test/lab_test.py
+++ b/erpnext/healthcare/doctype/lab_test/lab_test.py
@@ -6,7 +6,7 @@
 import frappe
 from frappe.model.document import Document
 import json
-from frappe.utils import getdate
+from frappe.utils import getdate, cstr
 from erpnext.healthcare.doctype.healthcare_settings.healthcare_settings import get_receivable_account
 from frappe import _
 
@@ -228,9 +228,10 @@
 	return employee
 
 def insert_lab_test_to_medical_record(doc):
-	subject = str(doc.test_name)
+	subject = cstr(doc.test_name)
 	if(doc.test_comment):
-		subject += ", "+str(doc.test_comment)
+		subject += ", \n"+ cstr(doc.test_comment)
+
 	medical_record = frappe.new_doc("Patient Medical Record")
 	medical_record.patient = doc.patient
 	medical_record.subject = subject
diff --git a/erpnext/healthcare/doctype/lab_test_groups/lab_test_groups.json b/erpnext/healthcare/doctype/lab_test_groups/lab_test_groups.json
index 8fa5c64..82d88ee 100644
--- a/erpnext/healthcare/doctype/lab_test_groups/lab_test_groups.json
+++ b/erpnext/healthcare/doctype/lab_test_groups/lab_test_groups.json
@@ -84,6 +84,7 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "fetch_from": "test_template.test_rate", 
    "fieldname": "test_rate", 
    "fieldtype": "Currency", 
    "hidden": 0, 
@@ -96,7 +97,7 @@
    "label": "Rate", 
    "length": 0, 
    "no_copy": 0, 
-   "options": "test_template.test_rate", 
+   "options": "", 
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 1, 
@@ -281,7 +282,7 @@
  "issingle": 0, 
  "istable": 1, 
  "max_attachments": 0, 
- "modified": "2018-05-16 22:43:38.667043",
+ "modified": "2018-05-25 22:43:38.667043",
  "modified_by": "Administrator", 
  "module": "Healthcare", 
  "name": "Lab Test Groups", 
diff --git a/erpnext/healthcare/doctype/patient_appointment/patient_appointment.py b/erpnext/healthcare/doctype/patient_appointment/patient_appointment.py
index 72b2764..a9561a0 100755
--- a/erpnext/healthcare/doctype/patient_appointment/patient_appointment.py
+++ b/erpnext/healthcare/doctype/patient_appointment/patient_appointment.py
@@ -207,6 +207,7 @@
 	sales_invoice.appointment = appointment_doc.name
 	sales_invoice.due_date = getdate()
 	sales_invoice.is_pos = '0'
+	sales_invoice.company = appointment_doc.company
 	sales_invoice.debit_to = get_receivable_account(appointment_doc.company)
 
 	fee_validity = get_fee_validity(appointment_doc.physician, appointment_doc.patient, appointment_doc.appointment_date)
diff --git a/erpnext/healthcare/doctype/vital_signs/vital_signs.py b/erpnext/healthcare/doctype/vital_signs/vital_signs.py
index 41d9258..bf4dace 100644
--- a/erpnext/healthcare/doctype/vital_signs/vital_signs.py
+++ b/erpnext/healthcare/doctype/vital_signs/vital_signs.py
@@ -5,6 +5,7 @@
 from __future__ import unicode_literals
 import frappe
 from frappe.model.document import Document
+from frappe.utils import cstr
 
 class VitalSigns(Document):
 	def on_submit(self):
@@ -33,16 +34,16 @@
 def set_subject_field(doc):
 	subject = ""
 	if(doc.temperature):
-		subject += "Temperature: "+ str(doc.temperature)+".\n"
+		subject += "Temperature: \n"+ cstr(doc.temperature)+". "
 	if(doc.pulse):
-		subject += "Pulse: "+ str(doc.pulse)+".\n"
+		subject += "Pulse: \n"+ cstr(doc.pulse)+". "
 	if(doc.respiratory_rate):
-		subject += "Respiratory Rate: "+ str(doc.respiratory_rate)+".\n"
+		subject += "Respiratory Rate: \n"+ cstr(doc.respiratory_rate)+". "
 	if(doc.bp):
-		subject += "BP: "+ str(doc.bp)+".\n"
+		subject += "BP: \n"+ cstr(doc.bp)+". "
 	if(doc.bmi):
-		subject += "BMI: "+ str(doc.bmi)+".\n"
+		subject += "BMI: \n"+ cstr(doc.bmi)+". "
 	if(doc.nutrition_note):
-		subject += "Note: "+ str(doc.nutrition_note)+"."
+		subject += "Note: \n"+ cstr(doc.nutrition_note)+". "
 
 	return subject
diff --git a/erpnext/hooks.py b/erpnext/hooks.py
index 938f7fa..815e2eb 100644
--- a/erpnext/hooks.py
+++ b/erpnext/hooks.py
@@ -238,7 +238,8 @@
 		"erpnext.assets.doctype.asset.asset.make_post_gl_entry"
   ],
 	"monthly": [
-		"erpnext.accounts.doctype.sales_invoice.sales_invoice.booked_deferred_revenue"
+		"erpnext.accounts.doctype.sales_invoice.sales_invoice.booked_deferred_revenue",
+		"erpnext.hr.utils.allocate_earned_leaves"
 	]
 }
 
diff --git a/erpnext/hr/doctype/additional_salary_component/__init__.py b/erpnext/hr/doctype/additional_salary/__init__.py
similarity index 100%
rename from erpnext/hr/doctype/additional_salary_component/__init__.py
rename to erpnext/hr/doctype/additional_salary/__init__.py
diff --git a/erpnext/hr/doctype/additional_salary_component/additional_salary_component.js b/erpnext/hr/doctype/additional_salary/additional_salary.js
similarity index 88%
rename from erpnext/hr/doctype/additional_salary_component/additional_salary_component.js
rename to erpnext/hr/doctype/additional_salary/additional_salary.js
index 5596dd0..94e06ad 100644
--- a/erpnext/hr/doctype/additional_salary_component/additional_salary_component.js
+++ b/erpnext/hr/doctype/additional_salary/additional_salary.js
@@ -1,7 +1,7 @@
 // Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and contributors
 // For license information, please see license.txt
 
-frappe.ui.form.on('Additional Salary Component', {
+frappe.ui.form.on('Additional Salary', {
 	setup: function(frm) {
 		frm.set_query("salary_component", function() {
 			return {
diff --git a/erpnext/hr/doctype/additional_salary_component/additional_salary_component.json b/erpnext/hr/doctype/additional_salary/additional_salary.json
similarity index 87%
rename from erpnext/hr/doctype/additional_salary_component/additional_salary_component.json
rename to erpnext/hr/doctype/additional_salary/additional_salary.json
index 2071dda..420d599 100644
--- a/erpnext/hr/doctype/additional_salary_component/additional_salary_component.json
+++ b/erpnext/hr/doctype/additional_salary/additional_salary.json
@@ -43,7 +43,7 @@
    "reqd": 1, 
    "search_index": 0, 
    "set_only_once": 0, 
-   "translatable": 0,
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -76,7 +76,7 @@
    "reqd": 1, 
    "search_index": 0, 
    "set_only_once": 0, 
-   "translatable": 0,
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -109,7 +109,7 @@
    "reqd": 1, 
    "search_index": 0, 
    "set_only_once": 0, 
-   "translatable": 0,
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -143,7 +143,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
-   "translatable": 0,
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -176,7 +176,7 @@
    "reqd": 1, 
    "search_index": 0, 
    "set_only_once": 0, 
-   "translatable": 0,
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -207,7 +207,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
-   "translatable": 0,
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -239,7 +239,7 @@
    "reqd": 1, 
    "search_index": 0, 
    "set_only_once": 0, 
-   "translatable": 0,
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -271,7 +271,7 @@
    "reqd": 1, 
    "search_index": 0, 
    "set_only_once": 0, 
-   "translatable": 0,
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -303,7 +303,7 @@
    "reqd": 1, 
    "search_index": 0, 
    "set_only_once": 0, 
-   "translatable": 0,
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -313,39 +313,40 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "fetch_from": "employee.department",
-   "fieldname": "department",
-   "fieldtype": "Link",
-   "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": "Department",
-   "length": 0,
-   "no_copy": 0,
-   "options": "Department",
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 1,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
-   "translatable": 0,
+   "fetch_from": "employee.department", 
+   "fieldname": "department", 
+   "fieldtype": "Link", 
+   "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": "Department", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Department", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
+   "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "amended_from", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -358,7 +359,7 @@
    "label": "Amended From", 
    "length": 0, 
    "no_copy": 1, 
-   "options": "Additional Salary Component", 
+   "options": "Additional Salary", 
    "permlevel": 0, 
    "print_hide": 1, 
    "print_hide_if_no_value": 0, 
@@ -368,7 +369,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
-   "translatable": 0,
+   "translatable": 0, 
    "unique": 0
   }
  ], 
@@ -382,10 +383,10 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2018-05-25 12:03:07.399413", 
+ "modified": "2018-05-30 11:44:06.422122", 
  "modified_by": "Administrator", 
  "module": "HR", 
- "name": "Additional Salary Component", 
+ "name": "Additional Salary", 
  "name_case": "", 
  "owner": "Administrator", 
  "permissions": [
diff --git a/erpnext/hr/doctype/additional_salary_component/additional_salary_component.py b/erpnext/hr/doctype/additional_salary/additional_salary.py
similarity index 85%
rename from erpnext/hr/doctype/additional_salary_component/additional_salary_component.py
rename to erpnext/hr/doctype/additional_salary/additional_salary.py
index 7a07ae0..7482c8b 100644
--- a/erpnext/hr/doctype/additional_salary_component/additional_salary_component.py
+++ b/erpnext/hr/doctype/additional_salary/additional_salary.py
@@ -8,7 +8,7 @@
 from frappe import _
 from frappe.utils import getdate, date_diff
 
-class AdditionalSalaryComponent(Document):
+class AdditionalSalary(Document):
 	def validate(self):
 		self.validate_dates()
 		if self.amount <= 0:
@@ -25,6 +25,11 @@
  			frappe.throw(_("To date can not greater than employee's relieving date"))
 
 	def get_amount(self, sal_start_date, sal_end_date):
+		# If additional salary dates in between the salary slip dates
+		# then return complete additional salary amount
+		if getdate(sal_start_date) <= getdate(self.from_date) <= getdate(sal_end_date)\
+			and getdate(sal_end_date) >= getdate(self.to_date) >= getdate(sal_start_date):
+			return self.amount
 		start_date = getdate(sal_start_date)
 		end_date = getdate(sal_end_date)
 		total_days = date_diff(getdate(self.to_date), getdate(self.from_date)) + 1
@@ -42,7 +47,7 @@
 @frappe.whitelist()
 def get_additional_salary_component(employee, start_date, end_date):
 	additional_components = frappe.db.sql("""
-	select name from `tabAdditional Salary Component`
+	select name from `tabAdditional Salary`
 	where employee=%(employee)s
 	and docstatus = 1
 	and (
@@ -60,7 +65,7 @@
 		for additional_component in additional_components:
 			struct_row = {}
 			additional_components_dict = {}
-			additional_component_obj = frappe.get_doc("Additional Salary Component", additional_component[0])
+			additional_component_obj = frappe.get_doc("Additional Salary", additional_component[0])
 			amount = additional_component_obj.get_amount(start_date, end_date)
 			salary_component = frappe.get_doc("Salary Component", additional_component_obj.salary_component)
 			struct_row['depends_on_lwp'] = salary_component.depends_on_lwp
diff --git a/erpnext/hr/doctype/additional_salary_component/test_additional_salary_component.js b/erpnext/hr/doctype/additional_salary/test_additional_salary.js
similarity index 65%
copy from erpnext/hr/doctype/additional_salary_component/test_additional_salary_component.js
copy to erpnext/hr/doctype/additional_salary/test_additional_salary.js
index 118290b..c18e187 100644
--- a/erpnext/hr/doctype/additional_salary_component/test_additional_salary_component.js
+++ b/erpnext/hr/doctype/additional_salary/test_additional_salary.js
@@ -2,15 +2,15 @@
 // rename this file from _test_[name] to test_[name] to activate
 // and remove above this line
 
-QUnit.test("test: Additional Salary Component", function (assert) {
+QUnit.test("test: Additional Salary", function (assert) {
 	let done = assert.async();
 
 	// number of asserts
 	assert.expect(1);
 
 	frappe.run_serially([
-		// insert a new Additional Salary Component
-		() => frappe.tests.make('Additional Salary Component', [
+		// insert a new Additional Salary
+		() => frappe.tests.make('Additional Salary', [
 			// values to be set
 			{key: 'value'}
 		]),
diff --git a/erpnext/hr/doctype/additional_salary_component/test_additional_salary_component.py b/erpnext/hr/doctype/additional_salary/test_additional_salary.py
similarity index 75%
rename from erpnext/hr/doctype/additional_salary_component/test_additional_salary_component.py
rename to erpnext/hr/doctype/additional_salary/test_additional_salary.py
index eda2f79..949ba20 100644
--- a/erpnext/hr/doctype/additional_salary_component/test_additional_salary_component.py
+++ b/erpnext/hr/doctype/additional_salary/test_additional_salary.py
@@ -4,5 +4,5 @@
 from __future__ import unicode_literals
 import unittest
 
-class TestAdditionalSalaryComponent(unittest.TestCase):
+class TestAdditionalSalary(unittest.TestCase):
 	pass
diff --git a/erpnext/hr/doctype/daily_work_summary/daily_work_summary.py b/erpnext/hr/doctype/daily_work_summary/daily_work_summary.py
index c01c5b9..f187286 100644
--- a/erpnext/hr/doctype/daily_work_summary/daily_work_summary.py
+++ b/erpnext/hr/doctype/daily_work_summary/daily_work_summary.py
@@ -112,6 +112,6 @@
 	if isinstance(group_doc, str):
 		group_doc = frappe.get_doc('Daily Work Summary Group', group)
 
-	emails = [d.email for d in group_doc.users if frappe.db.get_value("User", d.email, "enabled")]
+	emails = [d.email for d in group_doc.users if frappe.db.get_value("User", d.user, "enabled")]
 
 	return emails
diff --git a/erpnext/hr/doctype/department/department.py b/erpnext/hr/doctype/department/department.py
index 99a9b85..09cd6d3 100644
--- a/erpnext/hr/doctype/department/department.py
+++ b/erpnext/hr/doctype/department/department.py
@@ -3,8 +3,7 @@
 
 from __future__ import unicode_literals
 import frappe
-from frappe import _
-from frappe.utils.nestedset import NestedSet
+from frappe.utils.nestedset import NestedSet, get_root_of
 from erpnext.utilities.transaction_base import delete_events
 from frappe.model.document import Document
 
@@ -12,16 +11,18 @@
 	nsm_parent_field = 'parent_department'
 
 	def autoname(self):
-		if not self.department_name==_("All Departments"):
+		root = get_root_of("Department")
+		if root and self.department_name != root:
 			abbr = frappe.db.get_value('Company', self.company, 'abbr')
 			self.name = '{0} - {1}'.format(self.department_name, abbr)
 		else:
 			self.name = self.department_name
 
 	def validate(self):
-		if not self.parent_department and self.department_name != _("All Departments") \
-			and frappe.db.exists("Department", _("All Departments")):
-				self.parent_department = _("All Departments")
+		if not self.parent_department:
+			root = get_root_of("Department")
+			if root:
+				self.parent_department = root
 
 	def update_nsm_model(self):
 		frappe.utils.nestedset.update_nsm(self)
@@ -40,7 +41,7 @@
 def get_children(doctype, parent=None, company=None, is_root=False):
 	condition = ''
 	if company == parent:
-		condition = 'name="All Departments"'
+		condition = "name='%s'".format(get_root_of("Department"))
 	elif company:
 		condition = "parent_department='{0}' and company='{1}'".format(parent, company)
 	else:
diff --git a/erpnext/hr/doctype/employee/employee.py b/erpnext/hr/doctype/employee/employee.py
index 824ddf5..8035fc9 100755
--- a/erpnext/hr/doctype/employee/employee.py
+++ b/erpnext/hr/doctype/employee/employee.py
@@ -168,7 +168,7 @@
 
 	def validate_onboarding_process(self):
 		employee_onboarding = frappe.get_all("Employee Onboarding",
-			filters={"job_applicant": self.job_applicant, "docstatus": 1, "status": ("!=", "Completed")})
+			filters={"job_applicant": self.job_applicant, "docstatus": 1, "boarding_status": ("!=", "Completed")})
 		if employee_onboarding:
 			doc = frappe.get_doc("Employee Onboarding", employee_onboarding[0].name)
 			doc.validate_employee_creation()
@@ -318,27 +318,27 @@
 
 @frappe.whitelist()
 def get_children(doctype, parent=None, company=None, is_root=False, is_tree=False):
-	condition = ''
+	filters = [['company', '=', company]]
+	fields = ['name as value', 'employee_name as title']
 
 	if is_root:
-		parent = ""
+		parent = ''
 	if parent and company and parent!=company:
-		condition = ' and reports_to = "{0}"'.format(frappe.db.escape(parent))
+		filters.append(['reports_to', '=', parent])
 	else:
-		condition = ' and ifnull(reports_to, "")=""'
+		filters.append(['reports_to', '=', ''])
 
-	employee = frappe.db.sql("""
-		select
-			name as value, employee_name as title,
-			exists(select name from `tabEmployee` where reports_to=emp.name) as expandable
-		from
-			`tabEmployee` emp
-		where company='{company}' {condition} order by name"""
-		.format(company=company, condition=condition),  as_dict=1)
+	employees = frappe.get_list(doctype, fields=fields,
+		filters=filters, order_by='name')
 
-	# return employee
-	return employee
+	for employee in employees:
+		is_expandable = frappe.get_all(doctype, filters=[
+			['reports_to', '=', employee.get('value')]
+		])
+		employee.expandable = 1 if is_expandable else 0
+
+	return employees
 
 
 def on_doctype_update():
-	frappe.db.add_index("Employee", ["lft", "rgt"])
\ No newline at end of file
+	frappe.db.add_index("Employee", ["lft", "rgt"])
diff --git a/erpnext/hr/doctype/employee_benefit_application_detail/employee_benefit_application_detail.json b/erpnext/hr/doctype/employee_benefit_application_detail/employee_benefit_application_detail.json
index a6e51fb..eba9b19 100644
--- a/erpnext/hr/doctype/employee_benefit_application_detail/employee_benefit_application_detail.json
+++ b/erpnext/hr/doctype/employee_benefit_application_detail/employee_benefit_application_detail.json
@@ -157,7 +157,7 @@
  "issingle": 0, 
  "istable": 1, 
  "max_attachments": 0, 
- "modified": "2018-05-25 12:00:37.588822", 
+ "modified": "2018-05-26 12:00:37.588822", 
  "modified_by": "Administrator", 
  "module": "HR", 
  "name": "Employee Benefit Application Detail", 
diff --git a/erpnext/hr/doctype/employee_benefit_claim/employee_benefit_claim.json b/erpnext/hr/doctype/employee_benefit_claim/employee_benefit_claim.json
index a9dd573..a59aaea 100644
--- a/erpnext/hr/doctype/employee_benefit_claim/employee_benefit_claim.json
+++ b/erpnext/hr/doctype/employee_benefit_claim/employee_benefit_claim.json
@@ -449,7 +449,7 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2018-05-25 11:58:07.140055", 
+ "modified": "2018-05-26 12:43:21.082282",
  "modified_by": "Administrator", 
  "module": "HR", 
  "name": "Employee Benefit Claim", 
diff --git a/erpnext/hr/doctype/leave_allocation/leave_allocation.py b/erpnext/hr/doctype/leave_allocation/leave_allocation.py
index 8432cfe..7cffa4c 100755
--- a/erpnext/hr/doctype/leave_allocation/leave_allocation.py
+++ b/erpnext/hr/doctype/leave_allocation/leave_allocation.py
@@ -43,16 +43,16 @@
 	def on_update_after_submit(self):
 		self.validate_new_leaves_allocated_value()
 		self.set_total_leaves_allocated()
-		
+
 		frappe.db.set(self,'carry_forwarded_leaves', flt(self.carry_forwarded_leaves))
 		frappe.db.set(self,'total_leaves_allocated',flt(self.total_leaves_allocated))
-		
+
 		self.validate_against_leave_applications()
 
 	def validate_period(self):
 		if date_diff(self.to_date, self.from_date) <= 0:
 			frappe.throw(_("To date cannot be before from date"))
-			
+
 	def validate_lwp(self):
 		if frappe.db.get_value("Leave Type", self.leave_type, "is_lwp"):
 			frappe.throw(_("Leave Type {0} cannot be allocated since it is leave without pay").format(self.leave_type))
@@ -66,45 +66,45 @@
 		leave_allocation = frappe.db.sql("""
 			select name from `tabLeave Allocation`
 			where employee=%s and leave_type=%s and docstatus=1
-			and to_date >= %s and from_date <= %s""", 
+			and to_date >= %s and from_date <= %s""",
 			(self.employee, self.leave_type, self.from_date, self.to_date))
 
 		if leave_allocation:
 			frappe.msgprint(_("{0} already allocated for Employee {1} for period {2} to {3}")
 				.format(self.leave_type, self.employee, formatdate(self.from_date), formatdate(self.to_date)))
-			
+
 			frappe.throw(_('Reference') + ': <a href="#Form/Leave Allocation/{0}">{0}</a>'
 				.format(leave_allocation[0][0]), OverlapError)
-				
+
 	def validate_back_dated_allocation(self):
 		future_allocation = frappe.db.sql("""select name, from_date from `tabLeave Allocation`
-			where employee=%s and leave_type=%s and docstatus=1 and from_date > %s 
+			where employee=%s and leave_type=%s and docstatus=1 and from_date > %s
 			and carry_forward=1""", (self.employee, self.leave_type, self.to_date), as_dict=1)
-		
+
 		if future_allocation:
 			frappe.throw(_("Leave cannot be allocated before {0}, as leave balance has already been carry-forwarded in the future leave allocation record {1}")
-				.format(formatdate(future_allocation[0].from_date), future_allocation[0].name), 
+				.format(formatdate(future_allocation[0].from_date), future_allocation[0].name),
 					BackDatedAllocationError)
 
 	def set_total_leaves_allocated(self):
-		self.carry_forwarded_leaves = get_carry_forwarded_leaves(self.employee, 
+		self.carry_forwarded_leaves = get_carry_forwarded_leaves(self.employee,
 			self.leave_type, self.from_date, self.carry_forward)
-			
+
 		self.total_leaves_allocated = flt(self.carry_forwarded_leaves) + flt(self.new_leaves_allocated)
-		
-		if not self.total_leaves_allocated:
-			frappe.throw(_("Total leaves allocated is mandatory"))
+
+		if not self.total_leaves_allocated and not frappe.db.get_value("Leave Type", self.leave_type, "is_earned_leave"):
+			frappe.throw(_("Total leaves allocated is mandatory for Leave Type {0}".format(self.leave_type)))
 
 	def validate_total_leaves_allocated(self):
 		# Adding a day to include To Date in the difference
 		date_difference = date_diff(self.to_date, self.from_date) + 1
 		if date_difference < self.total_leaves_allocated:
 			frappe.throw(_("Total allocated leaves are more than days in the period"), OverAllocationError)
-			
+
 	def validate_against_leave_applications(self):
-		leaves_taken = get_approved_leaves_for_period(self.employee, self.leave_type, 
+		leaves_taken = get_approved_leaves_for_period(self.employee, self.leave_type,
 			self.from_date, self.to_date)
-		
+
 		if flt(leaves_taken) > flt(self.total_leaves_allocated):
 			if frappe.db.get_value("Leave Type", self.leave_type, "allow_negative"):
 				frappe.msgprint(_("Note: Total allocated leaves {0} shouldn't be less than already approved leaves {1} for the period").format(self.total_leaves_allocated, leaves_taken))
@@ -137,10 +137,10 @@
 @frappe.whitelist()
 def get_carry_forwarded_leaves(employee, leave_type, date, carry_forward=None):
 	carry_forwarded_leaves = 0
-	
+
 	if carry_forward:
 		validate_carry_forward(leave_type)
-		
+
 		previous_allocation = frappe.db.sql("""
 			select name, from_date, to_date, total_leaves_allocated
 			from `tabLeave Allocation`
@@ -148,14 +148,13 @@
 			order by to_date desc limit 1
 		""", (employee, leave_type, date), as_dict=1)
 		if previous_allocation:
-			leaves_taken = get_approved_leaves_for_period(employee, leave_type, 
+			leaves_taken = get_approved_leaves_for_period(employee, leave_type,
 				previous_allocation[0].from_date, previous_allocation[0].to_date)
-		
+
 			carry_forwarded_leaves = flt(previous_allocation[0].total_leaves_allocated) - flt(leaves_taken)
-			
+
 	return carry_forwarded_leaves
-		
+
 def validate_carry_forward(leave_type):
 	if not frappe.db.get_value("Leave Type", leave_type, "is_carry_forward"):
 		frappe.throw(_("Leave Type {0} cannot be carry-forwarded").format(leave_type))
-	
diff --git a/erpnext/hr/doctype/leave_application/leave_application.js b/erpnext/hr/doctype/leave_application/leave_application.js
index c6cbb10..a77dd32 100755
--- a/erpnext/hr/doctype/leave_application/leave_application.js
+++ b/erpnext/hr/doctype/leave_application/leave_application.js
@@ -195,7 +195,7 @@
 		if(frm.doc.employee) {
 				// server call is done to include holidays in leave days calculations
 			return frappe.call({
-				method: 'erpnext.hr.doctype.leave_application.leave_application.get_leave_approver_data',
+				method: 'erpnext.hr.doctype.leave_application.leave_application.get_leave_approver',
 				args: {
 					"employee": frm.doc.employee,
 				},
diff --git a/erpnext/hr/doctype/leave_application/leave_application.py b/erpnext/hr/doctype/leave_application/leave_application.py
index 8e2d64b..b3f2068 100755
--- a/erpnext/hr/doctype/leave_application/leave_application.py
+++ b/erpnext/hr/doctype/leave_application/leave_application.py
@@ -127,7 +127,7 @@
 					frappe.db.sql("""update `tabAttendance` set status = %s, leave_type = %s\
 						where name = %s""",(status, self.leave_type, d.name))
 
-			elif self.to_date <= nowdate():
+			elif getdate(self.to_date) <= getdate(nowdate()):
 				for dt in daterange(getdate(self.from_date), getdate(self.to_date)):
 					date = dt.strftime("%Y-%m-%d")
 					if not date == self.half_day_date:
@@ -610,6 +610,7 @@
 
 	return leave_days
 
+@frappe.whitelist()
 def get_leave_approver(employee, department=None):
 	if not department:
 		department = frappe.db.get_value('Employee', employee, 'department')
diff --git a/erpnext/hr/doctype/leave_application/leave_application_dashboard.html b/erpnext/hr/doctype/leave_application/leave_application_dashboard.html
index 95e74a6..2385b6a 100644
--- a/erpnext/hr/doctype/leave_application/leave_application_dashboard.html
+++ b/erpnext/hr/doctype/leave_application/leave_application_dashboard.html
@@ -10,17 +10,16 @@
 			<th style="width: 20%" class="text-right">{{ __("Pending Leaves") }}</th>
 			<th style="width: 20%" class="text-right">{{ __("Available Leaves") }}</th>
 		</tr>
-		<!-- <p> {{data["Sick Leave"][0]["leaves_taken"]}}</p> -->
-		
+
 	</thead>
 	<tbody>
 		{% for(const [key, value] of Object.entries(data)) { %}
 			<tr>
 				<td> {%= key %} </td>
-				<td> {%= value["total_leaves"] %} </td>
-				<td> {%= value["leaves_taken"] %} </td>
-				<td> {%= value["pending_leaves"] %} </td>
-				<td> {%= value["remaining_leaves"] %} </td>
+				<td class="text-right"> {%= value["total_leaves"] %} </td>
+				<td class="text-right"> {%= value["leaves_taken"] %} </td>
+				<td class="text-right"> {%= value["pending_leaves"] %} </td>
+				<td class="text-right"> {%= value["remaining_leaves"] %} </td>
 			</tr>
 		{% } %}
 	</tbody>
diff --git a/erpnext/hr/doctype/leave_application/test_leave_application.py b/erpnext/hr/doctype/leave_application/test_leave_application.py
index b4f4c1c..5506d60 100644
--- a/erpnext/hr/doctype/leave_application/test_leave_application.py
+++ b/erpnext/hr/doctype/leave_application/test_leave_application.py
@@ -7,7 +7,7 @@
 
 from erpnext.hr.doctype.leave_application.leave_application import LeaveDayBlockedError, OverlapError, NotAnOptionalHoliday, get_leave_balance_on
 from frappe.permissions import clear_user_permissions_for_doctype
-from frappe.utils import add_days, nowdate, now_datetime
+from frappe.utils import add_days, nowdate, now_datetime, get_datetime
 
 test_dependencies = ["Leave Allocation", "Leave Block List"]
 
@@ -387,25 +387,32 @@
 
 		self.assertRaises(frappe.ValidationError, leave_application.insert)
 
-	# def test_earned_leave(self):
-	# 	leave_period = get_leave_period()
-	# 	employee = get_employee()
-	#
-	# 	leave_type = frappe.get_doc(dict(
-	# 		leave_type_name = 'Test Earned Leave Type',
-	# 		doctype = 'Leave Type',
-	# 		is_earned_leave = 1,
-	# 		earned_leave_frequency = 'Monthly',
-	# 		rounding = 0.5
-	# 	)).insert()
-	#
-	# 	allocate_leaves(employee, leave_period, leave_type.name, 0, eligible_leaves = 12)
-	#
-	# 	# this method will be called by scheduler
-	# 	allocate_earned_leaves(leave_type.name, leave_period, as_on = half_of_leave_period)
-	#
-	# 	self.assertEqual(get_leave_balance(employee, leave_period, leave_type.name), 6)
+	def test_earned_leave(self):
+		leave_period = get_leave_period()
+		employee = get_employee()
 
+		leave_type = frappe.get_doc(dict(
+			leave_type_name = 'Test Earned Leave Type',
+			doctype = 'Leave Type',
+			is_earned_leave = 1,
+			earned_leave_frequency = 'Monthly',
+			rounding = 0.5,
+			max_leaves_allowed = 6
+		)).insert()
+		leave_policy = frappe.get_doc({
+			"doctype": "Leave Policy",
+			"leave_policy_details": [{"leave_type": leave_type.name, "annual_allocation": 6}]
+		}).insert()
+		frappe.db.set_value("Employee", employee.name, "leave_policy", leave_policy.name)
+
+		allocate_leaves(employee, leave_period, leave_type.name, 0, eligible_leaves = 12)
+
+		from erpnext.hr.utils import allocate_earned_leaves
+		i = 0
+		while(i<14):
+			allocate_earned_leaves()
+			i += 1
+		self.assertEqual(get_leave_balance_on(employee.name, leave_type.name, nowdate()), 6)
 
 def make_allocation_record(employee=None, leave_type=None):
 	frappe.db.sql("delete from `tabLeave Allocation`")
diff --git a/erpnext/hr/doctype/leave_encashment/leave_encashment.json b/erpnext/hr/doctype/leave_encashment/leave_encashment.json
index fff50c4..e9a99fa 100644
--- a/erpnext/hr/doctype/leave_encashment/leave_encashment.json
+++ b/erpnext/hr/doctype/leave_encashment/leave_encashment.json
@@ -15,6 +15,7 @@
  "fields": [
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -42,11 +43,12 @@
    "reqd": 1, 
    "search_index": 0, 
    "set_only_once": 0, 
-   "translatable": 0,
+   "translatable": 0, 
    "unique": 0
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -74,16 +76,17 @@
    "reqd": 1, 
    "search_index": 0, 
    "set_only_once": 0, 
-   "translatable": 0,
+   "translatable": 0, 
    "unique": 0
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "fetch_from": "employee.employee_name",
+   "fetch_from": "employee.employee_name", 
    "fieldname": "employee_name", 
    "fieldtype": "Data", 
    "hidden": 0, 
@@ -107,48 +110,50 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
-   "translatable": 0,
+   "translatable": 0, 
    "unique": 0
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "fetch_from": "employee.department",
-   "fieldname": "department",
-   "fieldtype": "Link",
-   "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": "Department",
-   "length": 0,
-   "no_copy": 0,
-   "options": "Department",
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 1,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
-   "translatable": 0,
+   "fetch_from": "employee.department", 
+   "fieldname": "department", 
+   "fieldtype": "Link", 
+   "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": "Department", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Department", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
+   "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "leave_type", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -172,11 +177,12 @@
    "reqd": 1, 
    "search_index": 0, 
    "set_only_once": 0, 
-   "translatable": 0,
+   "translatable": 0, 
    "unique": 0
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -202,11 +208,12 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
-   "translatable": 0,
+   "translatable": 0, 
    "unique": 0
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -234,11 +241,12 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
-   "translatable": 0,
+   "translatable": 0, 
    "unique": 0
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -265,11 +273,12 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
-   "translatable": 0,
+   "translatable": 0, 
    "unique": 0
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -296,11 +305,12 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
-   "translatable": 0,
+   "translatable": 0, 
    "unique": 0
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -327,11 +337,12 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
-   "translatable": 0,
+   "translatable": 0, 
    "unique": 0
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -358,11 +369,12 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
-   "translatable": 0,
+   "translatable": 0, 
    "unique": 0
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -389,11 +401,12 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
-   "translatable": 0,
+   "translatable": 0, 
    "unique": 0
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -421,16 +434,17 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
-   "translatable": 0,
+   "translatable": 0, 
    "unique": 0
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "fieldname": "additional_component", 
+   "fieldname": "additional_salary", 
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
@@ -439,10 +453,10 @@
    "in_global_search": 0, 
    "in_list_view": 0, 
    "in_standard_filter": 0, 
-   "label": "Additional Salary Component", 
+   "label": "Additional Salary", 
    "length": 0, 
    "no_copy": 1, 
-   "options": "Additional Salary Component", 
+   "options": "Additional Salary", 
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
@@ -453,7 +467,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
-   "translatable": 0,
+   "translatable": 0, 
    "unique": 0
   }
  ], 
@@ -467,7 +481,7 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2018-05-17 10:46:20.719555",
+ "modified": "2018-05-31 11:41:04.053874", 
  "modified_by": "Administrator", 
  "module": "HR", 
  "name": "Leave Encashment", 
diff --git a/erpnext/hr/doctype/leave_encashment/leave_encashment.py b/erpnext/hr/doctype/leave_encashment/leave_encashment.py
index 24096ab..a61210c 100644
--- a/erpnext/hr/doctype/leave_encashment/leave_encashment.py
+++ b/erpnext/hr/doctype/leave_encashment/leave_encashment.py
@@ -26,25 +26,25 @@
 	def on_submit(self):
 		if not self.leave_allocation:
 			self.leave_allocation = self.get_leave_allocation()
-		additional_component = frappe.new_doc("Additional Salary Component")
-		additional_component.company = frappe.get_value("Employee", self.employee, "company")
-		additional_component.employee = self.employee
-		additional_component.salary_component = frappe.get_value("Leave Type", self.leave_type, "earning_component")
-		additional_component.from_date = self.encashment_date
-		additional_component.to_date = self.encashment_date
-		additional_component.amount = self.encashment_amount
-		additional_component.submit()
+		additional_salary = frappe.new_doc("Additional Salary")
+		additional_salary.company = frappe.get_value("Employee", self.employee, "company")
+		additional_salary.employee = self.employee
+		additional_salary.salary_component = frappe.get_value("Leave Type", self.leave_type, "earning_component")
+		additional_salary.from_date = self.encashment_date
+		additional_salary.to_date = self.encashment_date
+		additional_salary.amount = self.encashment_amount
+		additional_salary.submit()
 
-		self.db_set("additional_component", additional_component.name)
+		self.db_set("additional_salary", additional_salary.name)
 
 		# Set encashed leaves in Allocation
 		frappe.db.set_value("Leave Allocation", self.leave_allocation, "total_leaves_encashed",
 				frappe.db.get_value('Leave Allocation', self.leave_allocation, 'total_leaves_encashed') + self.encashable_days)
 
 	def on_cancel(self):
-		if self.additional_component:
-			frappe.get_doc("Additional Salary Component", self.additional_component).cancel()
-			self.db_set("additional_component", "")
+		if self.additional_salary:
+			frappe.get_doc("Additional Salary", self.additional_salary).cancel()
+			self.db_set("additional_salary", "")
 
 		if self.leave_allocation:
 			frappe.db.set_value("Leave Allocation", self.leave_allocation, "total_leaves_encashed",
diff --git a/erpnext/hr/doctype/leave_period/leave_period.py b/erpnext/hr/doctype/leave_period/leave_period.py
index 4097169..39001ee 100644
--- a/erpnext/hr/doctype/leave_period/leave_period.py
+++ b/erpnext/hr/doctype/leave_period/leave_period.py
@@ -71,7 +71,8 @@
 		allocation.leave_type = leave_type
 		allocation.from_date = self.from_date
 		allocation.to_date = self.to_date
-		allocation.new_leaves_allocated = new_leaves_allocated
+		'''Earned Leaves are allocated by scheduler, initially allocate 0'''
+		allocation.new_leaves_allocated = new_leaves_allocated if not frappe.db.get_value("Leave Type", leave_type, "is_earned_leave") else 0
 		allocation.leave_period = self.name
 		if self.carry_forward_leaves:
 			if frappe.db.get_value("Leave Type", leave_type, "is_carry_forward"):
diff --git a/erpnext/hr/doctype/leave_type/leave_type.json b/erpnext/hr/doctype/leave_type/leave_type.json
index ef66a0a..8f7b5a8 100644
--- a/erpnext/hr/doctype/leave_type/leave_type.json
+++ b/erpnext/hr/doctype/leave_type/leave_type.json
@@ -584,7 +584,7 @@
    "default": "0.5",
    "depends_on": "is_earned_leave",
    "fieldname": "rounding",
-   "fieldtype": "Float",
+   "fieldtype": "Select",
    "hidden": 0,
    "ignore_user_permissions": 0,
    "ignore_xss_filter": 0,
@@ -595,6 +595,7 @@
    "label": "Rounding",
    "length": 0,
    "no_copy": 0,
+   "options": "0.5\n1.0",
    "permlevel": 0,
    "precision": "",
    "print_hide": 0,
@@ -620,7 +621,7 @@
  "issingle": 0,
  "istable": 0,
  "max_attachments": 0,
- "modified": "2018-05-08 18:32:51.803472",
+ "modified": "2018-06-03 18:32:51.803472",
  "modified_by": "Administrator",
  "module": "HR",
  "name": "Leave Type",
diff --git a/erpnext/hr/doctype/loan/loan.json b/erpnext/hr/doctype/loan/loan.json
index a073ec4..e305f54 100644
--- a/erpnext/hr/doctype/loan/loan.json
+++ b/erpnext/hr/doctype/loan/loan.json
@@ -400,7 +400,8 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "default": "", 
+   "default": "",
+   "fetch_from": "loan_type.rate_of_interest",  
    "fieldname": "rate_of_interest", 
    "fieldtype": "Percent", 
    "hidden": 0, 
@@ -413,7 +414,7 @@
    "label": "Rate of Interest (%) / Year", 
    "length": 0, 
    "no_copy": 0, 
-   "options": "loan_type.rate_of_interest", 
+   "options": "", 
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
@@ -1072,7 +1073,7 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2018-04-08 15:32:58.948412", 
+ "modified": "2018-05-25 15:32:58.948412", 
  "modified_by": "Administrator", 
  "module": "HR", 
  "name": "Loan", 
diff --git a/erpnext/hr/doctype/loan_application/loan_application.json b/erpnext/hr/doctype/loan_application/loan_application.json
index ea305ef..44490df 100644
--- a/erpnext/hr/doctype/loan_application/loan_application.json
+++ b/erpnext/hr/doctype/loan_application/loan_application.json
@@ -491,6 +491,7 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "fetch_from": "loan_type.rate_of_interest", 
    "fieldname": "rate_of_interest", 
    "fieldtype": "Percent", 
    "hidden": 0, 
@@ -503,7 +504,7 @@
    "label": "Rate of Interest", 
    "length": 0, 
    "no_copy": 0, 
-   "options": "loan_type.rate_of_interest", 
+   "options": "", 
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
@@ -718,7 +719,7 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2018-02-26 08:35:57.606555", 
+ "modified": "2018-05-25 08:35:57.606555", 
  "modified_by": "Administrator", 
  "module": "HR", 
  "name": "Loan Application", 
diff --git a/erpnext/hr/doctype/payroll_entry/payroll_entry.py b/erpnext/hr/doctype/payroll_entry/payroll_entry.py
index aa27e5b..e70a5bd 100644
--- a/erpnext/hr/doctype/payroll_entry/payroll_entry.py
+++ b/erpnext/hr/doctype/payroll_entry/payroll_entry.py
@@ -184,7 +184,7 @@
 			Get loan details from submitted salary slip based on selected criteria
 		"""
 		cond = self.get_filter_condition()
-		return frappe.db.sql(""" select eld.loan_account, eld.loan
+		return frappe.db.sql(""" select eld.loan_account, eld.loan,
 				eld.interest_income_account, eld.principal_amount, eld.interest_amount, eld.total_payment
 			from
 				`tabSalary Slip` t1, `tabSalary Slip Loan` eld
diff --git a/erpnext/hr/doctype/salary_slip/salary_slip.py b/erpnext/hr/doctype/salary_slip/salary_slip.py
index 32fc4b9..bb55756 100644
--- a/erpnext/hr/doctype/salary_slip/salary_slip.py
+++ b/erpnext/hr/doctype/salary_slip/salary_slip.py
@@ -12,7 +12,7 @@
 from erpnext.hr.doctype.employee.employee import get_holiday_list_for_employee
 from erpnext.utilities.transaction_base import TransactionBase
 from frappe.utils.background_jobs import enqueue
-from erpnext.hr.doctype.additional_salary_component.additional_salary_component import get_additional_salary_component
+from erpnext.hr.doctype.additional_salary.additional_salary import get_additional_salary_component
 from erpnext.hr.utils import get_payroll_period
 from erpnext.hr.doctype.employee_benefit_application.employee_benefit_application import get_benefit_component_amount
 from erpnext.hr.doctype.employee_benefit_claim.employee_benefit_claim import get_benefit_claim_amount
diff --git a/erpnext/hr/doctype/salary_slip/test_salary_slip.py b/erpnext/hr/doctype/salary_slip/test_salary_slip.py
index ae58298..1f913aa 100644
--- a/erpnext/hr/doctype/salary_slip/test_salary_slip.py
+++ b/erpnext/hr/doctype/salary_slip/test_salary_slip.py
@@ -270,7 +270,7 @@
 
 def make_salary_structure(sal_struct, payroll_frequency, employee):
 	if not frappe.db.exists('Salary Structure', sal_struct):
-		frappe.get_doc({
+		salary_structure = frappe.get_doc({
 			"doctype": "Salary Structure",
 			"name": sal_struct,
 			"company": "_Test Company",
@@ -280,12 +280,10 @@
 			"payment_account": get_random("Account")
 		}).insert()
 
-		create_salary_structure_assignment(employee, sal_struct)
+		create_salary_structure_assignment(employee, salary_structure)
 
 	elif not frappe.db.get_value("Salary Structure Assignment",{'salary_structure':sal_struct, 'employee':employee},'name'):
-		sal_struct = frappe.get_doc("Salary Structure", sal_struct)
 		create_salary_structure_assignment(employee, sal_struct)
-		sal_struct = sal_struct.name
 	return sal_struct
 
 def create_salary_structure_assignment(employee, salary_structure):
diff --git a/erpnext/hr/doctype/travel_request/travel_request.json b/erpnext/hr/doctype/travel_request/travel_request.json
index 21968fa..6146b49 100644
--- a/erpnext/hr/doctype/travel_request/travel_request.json
+++ b/erpnext/hr/doctype/travel_request/travel_request.json
@@ -461,6 +461,7 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "fetch_from": "employee.date_of_birth", 
    "fieldname": "date_of_birth", 
    "fieldtype": "Date", 
    "hidden": 0, 
@@ -473,7 +474,7 @@
    "label": "Date of Birth", 
    "length": 0, 
    "no_copy": 0, 
-   "options": "employee.date_of_birth", 
+   "options": "", 
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
@@ -875,7 +876,7 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2018-05-16 22:43:34.438949",
+ "modified": "2018-05-25 22:43:34.438949",
  "modified_by": "Administrator", 
  "module": "HR", 
  "name": "Travel Request", 
diff --git a/erpnext/hr/doctype/additional_salary_component/__init__.py b/erpnext/hr/report/department_analytics/__init__.py
similarity index 100%
copy from erpnext/hr/doctype/additional_salary_component/__init__.py
copy to erpnext/hr/report/department_analytics/__init__.py
diff --git a/erpnext/hr/report/department_analytics/department_analytics.js b/erpnext/hr/report/department_analytics/department_analytics.js
new file mode 100644
index 0000000..a0b6fc7
--- /dev/null
+++ b/erpnext/hr/report/department_analytics/department_analytics.js
@@ -0,0 +1,5 @@
+// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
+// For license information, please see license.txt
+
+frappe.query_reports["Department Analytics"] = {
+};
\ No newline at end of file
diff --git a/erpnext/hr/report/department_analytics/department_analytics.json b/erpnext/hr/report/department_analytics/department_analytics.json
new file mode 100644
index 0000000..1e26b33
--- /dev/null
+++ b/erpnext/hr/report/department_analytics/department_analytics.json
@@ -0,0 +1,28 @@
+{
+ "add_total_row": 0, 
+ "creation": "2018-05-15 15:37:20.883263", 
+ "disabled": 0, 
+ "docstatus": 0, 
+ "doctype": "Report", 
+ "idx": 0, 
+ "is_standard": "Yes", 
+ "modified": "2018-05-15 17:19:32.934321", 
+ "modified_by": "Administrator", 
+ "module": "HR", 
+ "name": "Department Analytics", 
+ "owner": "Administrator", 
+ "ref_doctype": "Employee", 
+ "report_name": "Department Analytics", 
+ "report_type": "Script Report", 
+ "roles": [
+  {
+   "role": "Employee"
+  }, 
+  {
+   "role": "HR User"
+  }, 
+  {
+   "role": "HR Manager"
+  }
+ ]
+}
\ No newline at end of file
diff --git a/erpnext/hr/report/department_analytics/department_analytics.py b/erpnext/hr/report/department_analytics/department_analytics.py
new file mode 100644
index 0000000..c4a9030
--- /dev/null
+++ b/erpnext/hr/report/department_analytics/department_analytics.py
@@ -0,0 +1,60 @@
+# Copyright (c) 2013, Frappe Technologies Pvt. Ltd. and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+import frappe
+from frappe import _
+
+def execute(filters=None):
+	if not filters: filters = {}
+	columns = get_columns()
+	employees = get_employees(filters)
+	departments_result = get_department(filters)
+	departments = []
+	if departments_result:
+		for department in departments_result:
+			departments.append(department)
+	chart = get_chart_data(departments,employees)
+	return columns, employees, None, chart
+
+def get_columns():
+	return [
+		_("Employee") + ":Link/Employee:120", _("Name") + ":Data:200", _("Date of Birth")+ ":Date:100",
+		_("Branch") + ":Link/Branch:120", _("Department") + ":Link/Department:120",
+		_("Designation") + ":Link/Designation:120", _("Gender") + "::60", _("Company") + ":Link/Company:120"
+	]
+
+def get_conditions(filters):
+	conditions = ""
+	if filters.get("department"): conditions += " and department = '%s'" % \
+		filters["department"].replace("'", "\\'")
+	return conditions
+
+def get_employees(filters):
+	conditions = get_conditions(filters)
+	return frappe.db.sql("""select name, employee_name, date_of_birth,
+	branch, department, designation,
+	gender, company from `tabEmployee` where status = 'Active' %s""" % conditions, as_list=1)
+
+def get_department(filters):
+	return frappe.db.sql("""select name from `tabDepartment`""" , as_list=1)
+	
+def get_chart_data(departments,employees):
+	if not departments:
+		departments = []
+	datasets = []
+	for department in departments:
+		if department:
+			total_employee = frappe.db.sql("""select count(*) from \
+				`tabEmployee` where \
+				department = %s""" ,(department[0]), as_list=1)
+			datasets.append(total_employee[0][0])
+	chart = {
+		"data": {
+			'labels': departments,
+			'datasets': [{'name': 'Employees','values': datasets}]
+		}
+	}
+	chart["type"] = "bar"
+	return chart
+
diff --git a/erpnext/hr/utils.py b/erpnext/hr/utils.py
index bf37c12..a5819ff 100644
--- a/erpnext/hr/utils.py
+++ b/erpnext/hr/utils.py
@@ -4,7 +4,7 @@
 from __future__ import unicode_literals
 import frappe
 from frappe import _
-from frappe.utils import formatdate, format_datetime, getdate, get_datetime, nowdate
+from frappe.utils import formatdate, format_datetime, getdate, get_datetime, nowdate, flt
 from frappe.model.document import Document
 from frappe.desk.form import assign_to
 
@@ -240,3 +240,52 @@
 		`tabPayroll Period`
 		where start_date<=%s and end_date>= %s and company=%s""", (from_date, to_date, company), as_dict=1)
 	return payroll_period[0] if payroll_period else None
+
+
+def allocate_earned_leaves():
+	'''Allocate earned leaves to Employees'''
+	e_leave_types = frappe.get_all("Leave Type",
+		fields=["name", "max_leaves_allowed", "earned_leave_frequency", "rounding"],
+		filters={'is_earned_leave' : 1})
+	today = getdate()
+	divide_by_frequency = {"Yearly": 1, "Quarterly": 4, "Monthly": 12}
+	if e_leave_types:
+		for e_leave_type in e_leave_types:
+			leave_allocations = frappe.db.sql("""select name, employee, from_date, to_date from `tabLeave Allocation` where '{0}'
+				between from_date and to_date and docstatus=1 and leave_type='{1}'"""
+				.format(today, e_leave_type.name), as_dict=1)
+			for allocation in leave_allocations:
+				leave_policy = get_employee_leave_policy(allocation.employee)
+				if not leave_policy:
+					continue
+				if not e_leave_type.earned_leave_frequency == "Monthly":
+					if not check_frequency_hit(allocation.from_date, today, e_leave_type.earned_leave_frequency):
+						continue
+				annual_allocation = frappe.db.sql("""select annual_allocation from `tabLeave Policy Detail`
+					where parent=%s and leave_type=%s""", (leave_policy.name, e_leave_type.name))
+				if annual_allocation and annual_allocation[0]:
+					earned_leaves = flt(annual_allocation[0][0]) / divide_by_frequency[e_leave_type.earned_leave_frequency]
+					if e_leave_type.rounding == "0.5":
+						earned_leaves = round(earned_leaves * 2) / 2
+					else:
+						earned_leaves = round(earned_leaves)
+
+					allocated_leaves = frappe.db.get_value('Leave Allocation', allocation.name, 'total_leaves_allocated')
+					new_allocation = flt(allocated_leaves) + flt(earned_leaves)
+					new_allocation = new_allocation if new_allocation <= e_leave_type.max_leaves_allowed else e_leave_type.max_leaves_allowed
+					frappe.db.set_value('Leave Allocation', allocation.name, 'total_leaves_allocated', new_allocation)
+
+def check_frequency_hit(from_date, to_date, frequency):
+	'''Return True if current date matches frequency'''
+	from_dt = get_datetime(from_date)
+	to_dt = get_datetime(to_date)
+	from dateutil import relativedelta
+	rd = relativedelta.relativedelta(to_dt, from_dt)
+	months = rd.months
+	if frequency == "Quarterly":
+		if not months % 3:
+			return True
+	elif frequency == "Yearly":
+		if not months % 12:
+			return True
+	return False
diff --git a/erpnext/hub_node/doctype/hub_settings/hub_settings.js b/erpnext/hub_node/doctype/hub_settings/hub_settings.js
index 64d20b8..29d870b 100644
--- a/erpnext/hub_node/doctype/hub_settings/hub_settings.js
+++ b/erpnext/hub_node/doctype/hub_settings/hub_settings.js
@@ -6,8 +6,7 @@
 			}));
 
 		frm.trigger("enabled");
-		frm.add_custom_button(__('View Hub'),
-			() => frappe.set_route('Hub', 'Item'));
+
 		if (frm.doc.enabled) {
 			frm.add_custom_button(__('Sync'),
 				() => frm.call('sync'));
diff --git a/erpnext/manufacturing/doctype/bom/bom.py b/erpnext/manufacturing/doctype/bom/bom.py
index 38346dc..18914eb 100644
--- a/erpnext/manufacturing/doctype/bom/bom.py
+++ b/erpnext/manufacturing/doctype/bom/bom.py
@@ -626,18 +626,28 @@
 		return
 
 	if frappe.form_dict.parent:
-		return frappe.db.sql("""select
-			bom_item.item_code,
-			bom_item.bom_no as value,
-			bom_item.stock_qty,
-			if(ifnull(bom_item.bom_no, "")!="", 1, 0) as expandable,
-			item.image,
-			item.description
-			from `tabBOM Item` bom_item, tabItem item
-			where bom_item.parent=%s
-			and bom_item.item_code = item.name
-			order by bom_item.idx
-			""", frappe.form_dict.parent, as_dict=True)
+		bom_items = frappe.get_list('BOM Item',
+			fields=['item_code', 'bom_no as value', 'stock_qty'],
+			filters=[['parent', '=', frappe.form_dict.parent]],
+			order_by='idx')
+
+		item_names = tuple(d.get('item_code') for d in bom_items)
+
+		items = frappe.get_list('Item',
+			fields=['image', 'description', 'name'],
+			filters=[['name', 'in', item_names]]) # to get only required item dicts
+
+		for bom_item in bom_items:
+			# extend bom_item dict with respective item dict
+			bom_item.update(
+				# returns an item dict from items list which matches with item_code
+				(item for item in items if item.get('name')
+					== bom_item.get('item_code')).next()
+			)
+			bom_item.expandable = 0 if bom_item.value in ('', None)  else 1
+
+		return bom_items
+
 
 def get_boms_in_bottom_up_order(bom_no=None):
 	def _get_parent(bom_no):
diff --git a/erpnext/manufacturing/doctype/manufacturing_settings/manufacturing_settings.json b/erpnext/manufacturing/doctype/manufacturing_settings/manufacturing_settings.json
index 0c0c870..461b9ab 100644
--- a/erpnext/manufacturing/doctype/manufacturing_settings/manufacturing_settings.json
+++ b/erpnext/manufacturing/doctype/manufacturing_settings/manufacturing_settings.json
@@ -1,539 +1,585 @@
 {
- "allow_copy": 0,
- "allow_guest_to_view": 0,
- "allow_import": 0,
- "allow_rename": 0,
- "beta": 0,
- "creation": "2014-11-27 14:12:07.542534",
- "custom": 0,
- "docstatus": 0,
- "doctype": "DocType",
- "document_type": "Document",
- "editable_grid": 0,
- "engine": "InnoDB",
+ "allow_copy": 0, 
+ "allow_guest_to_view": 0, 
+ "allow_import": 0, 
+ "allow_rename": 0, 
+ "beta": 0, 
+ "creation": "2014-11-27 14:12:07.542534", 
+ "custom": 0, 
+ "docstatus": 0, 
+ "doctype": "DocType", 
+ "document_type": "Document", 
+ "editable_grid": 0, 
+ "engine": "InnoDB", 
  "fields": [
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "fieldname": "capacity_planning",
-   "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,
-   "label": "Capacity Planning",
-   "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,
-   "translatable": 0,
+   "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "capacity_planning", 
+   "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, 
+   "label": "Capacity Planning", 
+   "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, 
+   "translatable": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "description": "Disables creation of time logs against Work Orders. Operations shall not be tracked against Work Order",
-   "fieldname": "disable_capacity_planning",
-   "fieldtype": "Check",
-   "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": "Disable Capacity Planning and Time Tracking",
-   "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,
-   "translatable": 0,
+   "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "description": "Disables creation of time logs against Work Orders. Operations shall not be tracked against Work Order", 
+   "fieldname": "disable_capacity_planning", 
+   "fieldtype": "Check", 
+   "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": "Disable Capacity Planning and Time Tracking", 
+   "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, 
+   "translatable": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "description": "Plan time logs outside Workstation Working Hours.",
-   "fieldname": "allow_overtime",
-   "fieldtype": "Check",
-   "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": "Allow Overtime",
-   "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,
-   "translatable": 0,
+   "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "description": "Plan time logs outside Workstation Working Hours.", 
+   "fieldname": "allow_overtime", 
+   "fieldtype": "Check", 
+   "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": "Allow Overtime", 
+   "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, 
+   "translatable": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "default": "",
-   "fieldname": "allow_production_on_holidays",
-   "fieldtype": "Check",
-   "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": "Allow Production on Holidays",
-   "length": 0,
-   "no_copy": 0,
-   "options": "",
-   "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,
-   "translatable": 0,
+   "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "default": "", 
+   "fieldname": "allow_production_on_holidays", 
+   "fieldtype": "Check", 
+   "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": "Allow Production on Holidays", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "", 
+   "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, 
+   "translatable": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "fieldname": "column_break_3",
-   "fieldtype": "Column 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,
-   "translatable": 0,
+   "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "column_break_3", 
+   "fieldtype": "Column 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, 
+   "translatable": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "default": "30",
-   "description": "Try planning operations for X days in advance.",
-   "fieldname": "capacity_planning_for_days",
-   "fieldtype": "Int",
-   "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": "Capacity Planning For (Days)",
-   "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,
-   "translatable": 0,
+   "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "default": "30", 
+   "description": "Try planning operations for X days in advance.", 
+   "fieldname": "capacity_planning_for_days", 
+   "fieldtype": "Int", 
+   "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": "Capacity Planning For (Days)", 
+   "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, 
+   "translatable": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "description": "Default 10 mins",
-   "fieldname": "mins_between_operations",
-   "fieldtype": "Int",
-   "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": "Time Between Operations (in mins)",
-   "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,
-   "translatable": 0,
+   "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "description": "Default 10 mins", 
+   "fieldname": "mins_between_operations", 
+   "fieldtype": "Int", 
+   "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": "Time Between Operations (in mins)", 
+   "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, 
+   "translatable": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "fieldname": "section_break_6",
-   "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,
-   "translatable": 0,
+   "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "section_break_6", 
+   "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, 
+   "translatable": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "fieldname": "over_production_allowance_percentage",
-   "fieldtype": "Percent",
-   "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": "Over Production Allowance Percentage",
-   "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,
-   "translatable": 0,
+   "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "overproduction_percentage_for_sales_order", 
+   "fieldtype": "Percent", 
+   "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": "Overproduction Percentage For Sales Order", 
+   "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, 
+   "translatable": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "default": "BOM",
-   "fieldname": "backflush_raw_materials_based_on",
-   "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": "Backflush Raw Materials Based On",
-   "length": 0,
-   "no_copy": 0,
-   "options": "BOM\nMaterial Transferred for Manufacture",
-   "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,
-   "translatable": 0,
+   "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "overproduction_percentage_for_work_order", 
+   "fieldtype": "Percent", 
+   "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": "Overproduction Percentage For Work Order", 
+   "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, 
+   "translatable": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "description": "Allow multiple Material Consumption against a Work Order",
-   "fieldname": "material_consumption",
-   "fieldtype": "Check",
-   "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": "Allow Multiple Material Consumption",
-   "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,
-   "translatable": 0,
+   "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "default": "BOM", 
+   "fieldname": "backflush_raw_materials_based_on", 
+   "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": "Backflush Raw Materials Based On", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "BOM\nMaterial Transferred for Manufacture", 
+   "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, 
+   "translatable": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "description": "Update BOM cost automatically via Scheduler, based on latest valuation rate / price list rate / last purchase rate of raw materials.",
-   "fieldname": "update_bom_costs_automatically",
-   "fieldtype": "Check",
-   "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": "Update BOM Cost Automatically",
-   "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,
-   "translatable": 0,
+   "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "description": "Allow multiple Material Consumption against a Work Order", 
+   "fieldname": "material_consumption", 
+   "fieldtype": "Check", 
+   "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": "Allow Multiple Material Consumption", 
+   "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, 
+   "translatable": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "fieldname": "column_break_11",
-   "fieldtype": "Column 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,
-   "translatable": 0,
+   "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "description": "Update BOM cost automatically via Scheduler, based on latest valuation rate / price list rate / last purchase rate of raw materials.", 
+   "fieldname": "update_bom_costs_automatically", 
+   "fieldtype": "Check", 
+   "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": "Update BOM Cost Automatically", 
+   "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, 
+   "translatable": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "fieldname": "default_wip_warehouse",
-   "fieldtype": "Link",
-   "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": "Default Work In Progress Warehouse",
-   "length": 0,
-   "no_copy": 0,
-   "options": "Warehouse",
-   "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,
-   "translatable": 0,
+   "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "column_break_11", 
+   "fieldtype": "Column 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, 
+   "translatable": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "fieldname": "default_fg_warehouse",
-   "fieldtype": "Link",
-   "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": "Default Finished Goods Warehouse",
-   "length": 0,
-   "no_copy": 0,
-   "options": "Warehouse",
-   "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,
-   "translatable": 0,
+   "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "default_wip_warehouse", 
+   "fieldtype": "Link", 
+   "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": "Default Work In Progress Warehouse", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Warehouse", 
+   "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, 
+   "translatable": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "default_fg_warehouse", 
+   "fieldtype": "Link", 
+   "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": "Default Finished Goods Warehouse", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Warehouse", 
+   "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, 
+   "translatable": 0, 
    "unique": 0
   }
- ],
- "has_web_view": 0,
- "hide_heading": 0,
- "hide_toolbar": 0,
- "icon": "icon-wrench",
- "idx": 0,
- "image_view": 0,
- "in_create": 0,
- "is_submittable": 0,
- "issingle": 1,
- "istable": 0,
- "max_attachments": 0,
- "menu_index": 0,
- "modified": "2018-03-28 13:56:31.187520",
- "modified_by": "Administrator",
- "module": "Manufacturing",
- "name": "Manufacturing Settings",
- "name_case": "",
- "owner": "Administrator",
+ ], 
+ "has_web_view": 0, 
+ "hide_heading": 0, 
+ "hide_toolbar": 0, 
+ "icon": "icon-wrench", 
+ "idx": 0, 
+ "image_view": 0, 
+ "in_create": 0, 
+ "is_submittable": 0, 
+ "issingle": 1, 
+ "istable": 0, 
+ "max_attachments": 0, 
+ "menu_index": 0, 
+ "modified": "2018-05-28 00:46:25.310621", 
+ "modified_by": "Administrator", 
+ "module": "Manufacturing", 
+ "name": "Manufacturing Settings", 
+ "name_case": "", 
+ "owner": "Administrator", 
  "permissions": [
   {
-   "amend": 0,
-   "apply_user_permissions": 0,
-   "cancel": 0,
-   "create": 1,
-   "delete": 0,
-   "email": 0,
-   "export": 0,
-   "if_owner": 0,
-   "import": 0,
-   "permlevel": 0,
-   "print": 0,
-   "read": 1,
-   "report": 0,
-   "role": "Manufacturing Manager",
-   "set_user_permissions": 0,
-   "share": 1,
-   "submit": 0,
+   "amend": 0, 
+   "cancel": 0, 
+   "create": 1, 
+   "delete": 0, 
+   "email": 0, 
+   "export": 0, 
+   "if_owner": 0, 
+   "import": 0, 
+   "permlevel": 0, 
+   "print": 0, 
+   "read": 1, 
+   "report": 0, 
+   "role": "Manufacturing Manager", 
+   "set_user_permissions": 0, 
+   "share": 1, 
+   "submit": 0, 
    "write": 1
   }
- ],
- "quick_entry": 0,
- "read_only": 0,
- "read_only_onload": 0,
- "show_name_in_global_search": 0,
- "sort_field": "modified",
- "sort_order": "DESC",
- "track_changes": 1,
+ ], 
+ "quick_entry": 0, 
+ "read_only": 0, 
+ "read_only_onload": 0, 
+ "show_name_in_global_search": 0, 
+ "sort_field": "modified", 
+ "sort_order": "DESC", 
+ "track_changes": 1, 
  "track_seen": 0
 }
\ No newline at end of file
diff --git a/erpnext/manufacturing/doctype/work_order/work_order.js b/erpnext/manufacturing/doctype/work_order/work_order.js
index a9c1491..672ec26 100644
--- a/erpnext/manufacturing/doctype/work_order/work_order.js
+++ b/erpnext/manufacturing/doctype/work_order/work_order.js
@@ -158,15 +158,15 @@
 			added_min = 0.5;
 		}
 		message = title;
-
 		// pending qty
 		if(!frm.doc.skip_transfer){
 			var pending_complete = frm.doc.material_transferred_for_manufacturing - frm.doc.produced_qty;
 			if(pending_complete) {
 				var title = __('{0} items in progress', [pending_complete]);
+				var width = ((pending_complete / frm.doc.qty * 100) - added_min);
 				bars.push({
 					'title': title,
-					'width': ((pending_complete / frm.doc.qty * 100) - added_min)  + '%',
+					'width': (width > 100 ? "99.5" : width)  + '%',
 					'progress_class': 'progress-bar-warning'
 				})
 				message = message + '. ' + title;
@@ -356,7 +356,7 @@
 							erpnext.work_order.make_se(frm, 'Manufacture');
 						});
 
-						if(doc.material_transferred_for_manufacturing==doc.qty) {
+						if(doc.material_transferred_for_manufacturing>=doc.qty) {
 							// all materials transferred for manufacturing, make this primary
 							finish_btn.addClass('btn-primary');
 						}
diff --git a/erpnext/manufacturing/doctype/work_order/work_order.py b/erpnext/manufacturing/doctype/work_order/work_order.py
index 1cb215a..d10fd21 100644
--- a/erpnext/manufacturing/doctype/work_order/work_order.py
+++ b/erpnext/manufacturing/doctype/work_order/work_order.py
@@ -133,7 +133,7 @@
 		so_qty = flt(so_item_qty) + flt(dnpi_qty)
 
 		allowance_percentage = flt(frappe.db.get_single_value("Manufacturing Settings",
-			"over_production_allowance_percentage"))
+			"overproduction_percentage_for_sales_order"))
 
 		if total_qty > so_qty + (allowance_percentage/100 * so_qty):
 			frappe.throw(_("Cannot produce more Item {0} than Sales Order quantity {1}")
@@ -168,7 +168,7 @@
 				if stock_entries:
 					status = "In Process"
 					produced_qty = stock_entries.get("Manufacture")
-					if flt(produced_qty) == flt(self.qty):
+					if flt(produced_qty) >= flt(self.qty):
 						status = "Completed"
 		else:
 			status = 'Cancelled'
@@ -179,15 +179,20 @@
 		"""Update **Manufactured Qty** and **Material Transferred for Qty** in Work Order
 			based on Stock Entry"""
 
+		allowance_percentage = flt(frappe.db.get_single_value("Manufacturing Settings",
+			"overproduction_percentage_for_work_order"))
+
 		for purpose, fieldname in (("Manufacture", "produced_qty"),
 			("Material Transfer for Manufacture", "material_transferred_for_manufacturing")):
+
 			qty = flt(frappe.db.sql("""select sum(fg_completed_qty)
 				from `tabStock Entry` where work_order=%s and docstatus=1
 				and purpose=%s""", (self.name, purpose))[0][0])
 
-			if qty > self.qty:
+			completed_qty = self.qty + (allowance_percentage/100 * self.qty)
+			if qty > completed_qty:
 				frappe.throw(_("{0} ({1}) cannot be greater than planned quantity ({2}) in Work Order {3}").format(\
-					self.meta.get_label(fieldname), qty, self.qty, self.name), StockOverProductionError)
+					self.meta.get_label(fieldname), qty, completed_qty, self.name), StockOverProductionError)
 
 			self.db_set(fieldname, qty)
 
diff --git a/erpnext/hr/doctype/additional_salary_component/__init__.py b/erpnext/manufacturing/report/bom_variance_report/__init__.py
similarity index 100%
copy from erpnext/hr/doctype/additional_salary_component/__init__.py
copy to erpnext/manufacturing/report/bom_variance_report/__init__.py
diff --git a/erpnext/manufacturing/report/bom_variance_report/bom_variance_report.js b/erpnext/manufacturing/report/bom_variance_report/bom_variance_report.js
new file mode 100644
index 0000000..97ba7b9
--- /dev/null
+++ b/erpnext/manufacturing/report/bom_variance_report/bom_variance_report.js
@@ -0,0 +1,29 @@
+// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
+// For license information, please see license.txt
+/* eslint-disable */
+
+frappe.query_reports["BOM Variance Report"] = {
+	"filters": [
+		{
+			"fieldname":"bom_no",
+			"label": __("BOM No"),
+			"fieldtype": "Link",
+			"options": "BOM"
+		},
+		{
+			"fieldname":"work_order",
+			"label": __("Work Order"),
+			"fieldtype": "Link",
+			"options": "Work Order",
+			"get_query": function() {
+				var bom_no = frappe.query_report_filters_by_name.bom_no.get_value();
+				return{
+					query: "erpnext.manufacturing.report.bom_variance_report.bom_variance_report.get_work_orders",
+					filters: {
+						'bom_no': bom_no
+					}
+				}
+			}
+		},
+	]
+}
diff --git a/erpnext/manufacturing/report/bom_variance_report/bom_variance_report.json b/erpnext/manufacturing/report/bom_variance_report/bom_variance_report.json
new file mode 100644
index 0000000..91ed11e
--- /dev/null
+++ b/erpnext/manufacturing/report/bom_variance_report/bom_variance_report.json
@@ -0,0 +1,32 @@
+{
+ "add_total_row": 0, 
+ "creation": "2018-05-28 16:22:24.040106", 
+ "disabled": 0, 
+ "docstatus": 0, 
+ "doctype": "Report", 
+ "idx": 0, 
+ "is_standard": "Yes", 
+ "letter_head": "Gadgets International", 
+ "modified": "2018-05-28 16:22:24.040106", 
+ "modified_by": "Administrator", 
+ "module": "Manufacturing", 
+ "name": "BOM Variance Report", 
+ "owner": "Administrator", 
+ "ref_doctype": "Stock Entry", 
+ "report_name": "BOM Variance Report", 
+ "report_type": "Script Report", 
+ "roles": [
+  {
+   "role": "Manufacturing Manager"
+  }, 
+  {
+   "role": "Stock Manager"
+  }, 
+  {
+   "role": "Stock User"
+  }, 
+  {
+   "role": "Manufacturing User"
+  }
+ ]
+}
\ No newline at end of file
diff --git a/erpnext/manufacturing/report/bom_variance_report/bom_variance_report.py b/erpnext/manufacturing/report/bom_variance_report/bom_variance_report.py
new file mode 100644
index 0000000..c5627e0
--- /dev/null
+++ b/erpnext/manufacturing/report/bom_variance_report/bom_variance_report.py
@@ -0,0 +1,107 @@
+# Copyright (c) 2013, Frappe Technologies Pvt. Ltd. and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+import frappe
+from frappe import _
+
+def execute(filters=None):
+	columns, data = [], []
+	columns = get_columns(filters)
+	data = get_data(filters)
+	return columns, data
+
+def get_columns(filters):
+	columns = [{
+			"label": _("Work Order"),
+			"fieldname": "work_order",
+			"fieldtype": "Link",
+			"options": "Work Order",
+			"width": 120
+		}]
+	
+	if not filters.get('bom_no'):
+		columns.extend([
+			{
+				"label": _("BOM No"),
+				"fieldname": "bom_no",
+				"fieldtype": "Link",
+				"options": "BOM",
+				"width": 180
+			}
+		])
+	
+	columns.extend([
+		{
+			"label": _("Finished Good"),
+			"fieldname": "production_item",
+			"fieldtype": "Link",
+			"options": "Item",
+			"width": 120
+		},
+		{
+			"label": _("Ordered Qty"),
+			"fieldname": "qty",
+			"fieldtype": "Float",
+			"width": 120
+		},
+		{
+			"label": _("Produced Qty"),
+			"fieldname": "produced_qty",
+			"fieldtype": "Float",
+			"width": 120
+		},
+		{
+			"label": _("Raw Material"),
+			"fieldname": "raw_material_code",
+			"fieldtype": "Link",
+			"options": "Item",
+			"width": 120
+		},
+		{
+			"label": _("Required Qty"),
+			"fieldname": "required_qty",
+			"fieldtype": "Float",
+			"width": 120
+		},
+		{
+			"label": _("Consumed Qty"),
+			"fieldname": "consumed_qty",
+			"fieldtype": "Float",
+			"width": 120
+		}
+	])
+
+	return columns
+	
+def get_data(filters):
+	cond = "1=1"
+
+	if filters.get('bom_no') and not filters.get('work_order'):
+		cond += " and bom_no = '%s'" % filters.get('bom_no')
+
+	if filters.get('work_order'):
+		cond += " and name = '%s'" % filters.get('work_order')
+
+	results = []
+	for d in frappe.db.sql(""" select name as work_order, qty, produced_qty, production_item, bom_no
+		from `tabWork Order` where produced_qty > qty and docstatus = 1 and {0}""".format(cond), as_dict=1):
+		results.append(d)
+
+		for data in frappe.get_all('Work Order Item', fields=["item_code as raw_material_code",
+			"required_qty", "consumed_qty"], filters={'parent': d.work_order, 'parenttype': 'Work Order'}):
+			results.append(data)
+
+	return results
+
+@frappe.whitelist()
+def get_work_orders(doctype, txt, searchfield, start, page_len, filters):
+	cond = "1=1"
+	if filters.get('bom_no'):
+		cond += " and bom_no = '%s'" % filters.get('bom_no')
+
+	return frappe.db.sql("""select name from `tabWork Order`
+		where name like %(name)s and {0} and produced_qty > qty and docstatus = 1
+		order by name limit {1}, {2}""".format(cond, start, page_len),{
+			'name': "%%%s%%" % txt
+		}, as_list=1)
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index 97c6dd6..06ff4b5 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -542,3 +542,5 @@
 erpnext.patches.v11_0.check_buying_selling_in_currency_exchange
 erpnext.patches.v11_0.refactor_erpnext_shopify
 erpnext.patches.v11_0.move_item_defaults_to_child_table_for_multicompany
+erpnext.patches.v11_0.rename_overproduction_percent_field
+erpnext.patches.v10_0.update_status_in_purchase_receipt
diff --git a/erpnext/patches/v10_0/update_status_in_purchase_receipt.py b/erpnext/patches/v10_0/update_status_in_purchase_receipt.py
new file mode 100644
index 0000000..69e2bb8
--- /dev/null
+++ b/erpnext/patches/v10_0/update_status_in_purchase_receipt.py
@@ -0,0 +1,7 @@
+import frappe
+
+def execute():
+	frappe.reload_doc("stock", "doctype", "purchase_receipt")
+	frappe.db.sql('''
+		UPDATE `tabPurchase Receipt` SET status = "Completed" WHERE per_billed = 100 AND docstatus = 1
+	''')
\ No newline at end of file
diff --git a/erpnext/patches/v11_0/create_department_records_for_each_company.py b/erpnext/patches/v11_0/create_department_records_for_each_company.py
index 4210c01..a5b76e9 100644
--- a/erpnext/patches/v11_0/create_department_records_for_each_company.py
+++ b/erpnext/patches/v11_0/create_department_records_for_each_company.py
@@ -1,4 +1,5 @@
 import frappe
+from frappe import _
 from frappe.utils.nestedset import rebuild_tree
 
 def execute():
@@ -15,7 +16,7 @@
 
 	for department in departments:
 		# skip root node
-		if department.name == "All Departments":
+		if department.name == _("All Departments"):
 			continue
 
 		# for each company, create a copy of the doc
diff --git a/erpnext/patches/v11_0/create_salary_structure_assignments.py b/erpnext/patches/v11_0/create_salary_structure_assignments.py
index 12b477b..b5ee6c6 100644
--- a/erpnext/patches/v11_0/create_salary_structure_assignments.py
+++ b/erpnext/patches/v11_0/create_salary_structure_assignments.py
@@ -25,6 +25,7 @@
 			# to migrate the data of the old employees
 			s.flags.old_employee = True
 			s.save()
+			s.submit()
 		except DuplicateAssignment:
 			pass
 
diff --git a/erpnext/patches/v11_0/make_asset_finance_book_against_old_entries.py b/erpnext/patches/v11_0/make_asset_finance_book_against_old_entries.py
index 4adae49..1c8bd68 100644
--- a/erpnext/patches/v11_0/make_asset_finance_book_against_old_entries.py
+++ b/erpnext/patches/v11_0/make_asset_finance_book_against_old_entries.py
@@ -13,36 +13,37 @@
 	frappe.reload_doc('assets', 'doctype', 'asset_movement')
 	frappe.reload_doc('assets', 'doctype', 'asset_category_account')
 
-	frappe.db.sql(""" update `tabAsset` ast, `tabWarehouse` wh
-		set ast.location = wh.warehouse_name where ast.warehouse = wh.name""")
+	if frappe.db.has_column("Asset", "warehouse"):
+		frappe.db.sql(""" update `tabAsset` ast, `tabWarehouse` wh
+			set ast.location = wh.warehouse_name where ast.warehouse = wh.name""")
 
-	frappe.db.sql(""" update `tabAsset Movement` ast_mv
-		set ast_mv.source_location = (select warehouse_name from `tabWarehouse` where name = ast_mv.source_warehouse),
-		ast_mv.target_location = (select warehouse_name from `tabWarehouse` where name = ast_mv.target_warehouse)""")
+		frappe.db.sql(""" update `tabAsset Movement` ast_mv
+			set ast_mv.source_location = (select warehouse_name from `tabWarehouse` where name = ast_mv.source_warehouse),
+			ast_mv.target_location = (select warehouse_name from `tabWarehouse` where name = ast_mv.target_warehouse)""")
 
-	for d in frappe.get_all('Asset'):
-		doc = frappe.get_doc('Asset', d.name)
-		if doc.calculate_depreciation:
-			fb = doc.append('finance_books', {
-				'depreciation_method': doc.depreciation_method,
-				'total_number_of_depreciations': doc.total_number_of_depreciations,
-				'frequency_of_depreciation': doc.frequency_of_depreciation,
-				'depreciation_start_date': doc.next_depreciation_date,
-				'expected_value_after_useful_life': doc.expected_value_after_useful_life,
-				'value_after_depreciation': doc.value_after_depreciation
+		for d in frappe.get_all('Asset'):
+			doc = frappe.get_doc('Asset', d.name)
+			if doc.calculate_depreciation:
+				fb = doc.append('finance_books', {
+					'depreciation_method': doc.depreciation_method,
+					'total_number_of_depreciations': doc.total_number_of_depreciations,
+					'frequency_of_depreciation': doc.frequency_of_depreciation,
+					'depreciation_start_date': doc.next_depreciation_date,
+					'expected_value_after_useful_life': doc.expected_value_after_useful_life,
+					'value_after_depreciation': doc.value_after_depreciation
+				})
+
+				fb.db_update()
+
+		frappe.db.sql(""" update `tabDepreciation Schedule` ds, `tabAsset` ast
+			set ds.depreciation_method = ast.depreciation_method, ds.finance_book_id = 1 where ds.parent = ast.name """)
+
+		for category in frappe.get_all('Asset Category'):
+			asset_category_doc = frappe.get_doc("Asset Category", category)
+			row = asset_category_doc.append('finance_books', {
+				'depreciation_method': asset_category_doc.depreciation_method,
+				'total_number_of_depreciations': asset_category_doc.total_number_of_depreciations,
+				'frequency_of_depreciation': asset_category_doc.frequency_of_depreciation
 			})
 
-			fb.db_update()
-
-	frappe.db.sql(""" update `tabDepreciation Schedule` ds, `tabAsset` ast 
-		set ds.depreciation_method = ast.depreciation_method, ds.finance_book_id = 1 where ds.parent = ast.name """)
-
-	for category in frappe.get_all('Asset Category'):
-		asset_category_doc = frappe.get_doc("Asset Category", category)
-		row = asset_category_doc.append('finance_books', {
-			'depreciation_method': asset_category_doc.depreciation_method,
-			'total_number_of_depreciations': asset_category_doc.total_number_of_depreciations,
-			'frequency_of_depreciation': asset_category_doc.frequency_of_depreciation
-		})
-
-		row.db_update()
\ No newline at end of file
+			row.db_update()
\ No newline at end of file
diff --git a/erpnext/patches/v11_0/rename_overproduction_percent_field.py b/erpnext/patches/v11_0/rename_overproduction_percent_field.py
new file mode 100644
index 0000000..077829f
--- /dev/null
+++ b/erpnext/patches/v11_0/rename_overproduction_percent_field.py
@@ -0,0 +1,10 @@
+# Copyright (c) 2018, Frappe and Contributors
+# License: GNU General Public License v3. See license.txt
+
+from __future__ import unicode_literals
+from frappe.model.utils.rename_field import rename_field
+import frappe
+
+def execute():
+	frappe.reload_doc('manufacturing', 'doctype', 'manufacturing_settings')
+	rename_field('Manufacturing Settings', 'over_production_allowance_percentage', 'overproduction_percentage_for_sales_order')
\ No newline at end of file
diff --git a/erpnext/patches/v11_0/rename_supplier_type_to_supplier_group.py b/erpnext/patches/v11_0/rename_supplier_type_to_supplier_group.py
index f0907af..1735c12 100644
--- a/erpnext/patches/v11_0/rename_supplier_type_to_supplier_group.py
+++ b/erpnext/patches/v11_0/rename_supplier_type_to_supplier_group.py
@@ -28,7 +28,8 @@
 		frappe.get_doc({
 			'doctype': 'Supplier Group',
 			'supplier_group_name': _('All Supplier Groups'),
-			'is_group': 1
+			'is_group': 1,
+			'parent_supplier_group': ''
 		}).insert(ignore_permissions=True)
 
 	rebuild_tree("Supplier Group", "parent_supplier_group")
diff --git a/erpnext/patches/v11_0/update_department_lft_rgt.py b/erpnext/patches/v11_0/update_department_lft_rgt.py
index 9bb1772..0cb9aec 100644
--- a/erpnext/patches/v11_0/update_department_lft_rgt.py
+++ b/erpnext/patches/v11_0/update_department_lft_rgt.py
@@ -5,7 +5,6 @@
 def execute():
 	""" assign lft and rgt appropriately """
 	frappe.reload_doc("hr", "doctype", "department")
-
 	if not frappe.db.exists("Department", _('All Departments')):
 		frappe.get_doc({
 			'doctype': 'Department',
diff --git a/erpnext/patches/v11_0/update_total_qty_field.py b/erpnext/patches/v11_0/update_total_qty_field.py
new file mode 100644
index 0000000..e618593
--- /dev/null
+++ b/erpnext/patches/v11_0/update_total_qty_field.py
@@ -0,0 +1,27 @@
+import frappe
+
+def execute():
+	frappe.reload_doc('buying', 'doctype', 'purchase_order')
+	frappe.reload_doc('buying', 'doctype', 'supplier_quotation')
+	frappe.reload_doc('selling', 'doctype', 'sales_order')
+	frappe.reload_doc('selling', 'doctype', 'quotation')
+	frappe.reload_doc('stock', 'doctype', 'delivery_note')
+	frappe.reload_doc('stock', 'doctype', 'purchase_receipt')
+	frappe.reload_doc('accounts', 'doctype', 'sales_invoice')
+	frappe.reload_doc('accounts', 'doctype', 'purchase_invoice')
+
+	doctypes = ["Sales Order", "Sales Invoice", "Delivery Note",\
+		"Purchase Order", "Purchase Invoice", "Purchase Receipt", "Quotation", "Supplier Quotation"]
+
+	for doctype in doctypes:
+		frappe.db.sql('''
+			UPDATE
+				`tab%s` dt SET dt.total_qty =
+			(
+				SELECT SUM(dt_item.qty)
+				FROM
+					`tab%s Item` dt_item
+				WHERE
+					dt_item.parent=dt.name
+			)
+		''' % (doctype, doctype))
diff --git a/erpnext/projects/doctype/task/task.py b/erpnext/projects/doctype/task/task.py
index fcaa344..d289b82 100644
--- a/erpnext/projects/doctype/task/task.py
+++ b/erpnext/projects/doctype/task/task.py
@@ -186,27 +186,25 @@
 
 @frappe.whitelist()
 def get_children(doctype, parent, task=None, project=None, is_root=False):
-	conditions = ''
+
+	filters = [['docstatus', '<', '2']]
 
 	if task:
-		# via filters
-		conditions += ' and parent_task = "{0}"'.format(frappe.db.escape(task))
+		filters.append(['parent_task', '=', task])
 	elif parent and not is_root:
 		# via expand child
-		conditions += ' and parent_task = "{0}"'.format(frappe.db.escape(parent))
+		filters.append(['parent_task', '=', parent])
 	else:
-		conditions += ' and ifnull(parent_task, "")=""'
+		filters.append(['ifnull(`parent_task`, "")', '=', ''])
 
 	if project:
-		conditions += ' and project = "{0}"'.format(frappe.db.escape(project))
+		filters.append(['project', '=', project])
 
-	tasks = frappe.db.sql("""select name as value,
-		subject as title,
-		is_group as expandable
-		from `tabTask`
-		where docstatus < 2
-		{conditions}
-		order by name""".format(conditions=conditions), as_dict=1)
+	tasks = frappe.get_list(doctype, fields=[
+		'name as value',
+		'subject as title',
+		'is_group as expandable'
+	], filters=filters, order_by='name')
 
 	# return tasks
 	return tasks
diff --git a/erpnext/projects/doctype/timesheet/test_timesheet.py b/erpnext/projects/doctype/timesheet/test_timesheet.py
index d2017c5..c26da92 100644
--- a/erpnext/projects/doctype/timesheet/test_timesheet.py
+++ b/erpnext/projects/doctype/timesheet/test_timesheet.py
@@ -159,6 +159,7 @@
 	update_activity_type(activity_type)
 	timesheet = frappe.new_doc("Timesheet")
 	timesheet.employee = employee
+	timesheet.company = company or '_Test Company'
 	timesheet_detail = timesheet.append('time_logs', {})
 	timesheet_detail.billable = billable
 	timesheet_detail.activity_type = activity_type
@@ -167,7 +168,6 @@
 	timesheet_detail.to_time = timesheet_detail.from_time + datetime.timedelta(hours= timesheet_detail.hours)
 	timesheet_detail.project = project
 	timesheet_detail.task = task
-	timesheet_detail.company = company or '_Test Company'
 
 	for data in timesheet.get('time_logs'):
 		if simulate:
diff --git a/erpnext/projects/doctype/timesheet/timesheet.py b/erpnext/projects/doctype/timesheet/timesheet.py
index c358a54..a5b7de1 100644
--- a/erpnext/projects/doctype/timesheet/timesheet.py
+++ b/erpnext/projects/doctype/timesheet/timesheet.py
@@ -343,6 +343,7 @@
 	billing_amount = flt(timesheet.total_billable_amount) - flt(timesheet.total_billed_amount)
 	billing_rate = billing_amount / hours
 
+	target.company = timesheet.company
 	if customer:
 		target.customer = customer
 
diff --git a/erpnext/public/images/hub_logo.svg b/erpnext/public/images/hub_logo.svg
index 1612c6d..4af4821 100644
--- a/erpnext/public/images/hub_logo.svg
+++ b/erpnext/public/images/hub_logo.svg
@@ -1,37 +1,112 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
 <svg
-   viewBox="0 0 87.312496 91.397155"
-   class="hub-icon"
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   width="330"
    height="345.43808"
-   width="330">
+   viewBox="0 0 87.312496 91.397155"
+   version="1.1"
+   id="svg4635"
+   inkscape:version="0.92.2 5c3e80d, 2017-08-06"
+   sodipodi:docname="hub-logo.svg"
+   inkscape:export-filename="/home/raghu/Desktop/hub-logo.png"
+   inkscape:export-xdpi="95.878258"
+   inkscape:export-ydpi="95.878258">
+  <defs
+     id="defs4629" />
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     inkscape:pageopacity="0.0"
+     inkscape:pageshadow="2"
+     inkscape:zoom="0.7"
+     inkscape:cx="234.27717"
+     inkscape:cy="167.57445"
+     inkscape:document-units="px"
+     inkscape:current-layer="layer1"
+     showgrid="false"
+     units="px"
+     inkscape:window-width="1920"
+     inkscape:window-height="1149"
+     inkscape:window-x="0"
+     inkscape:window-y="24"
+     inkscape:window-maximized="1" />
+  <metadata
+     id="metadata4632">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <dc:title />
+        <cc:license
+           rdf:resource="http://creativecommons.org/licenses/by-sa/4.0/" />
+      </cc:Work>
+      <cc:License
+         rdf:about="http://creativecommons.org/licenses/by-sa/4.0/">
+        <cc:permits
+           rdf:resource="http://creativecommons.org/ns#Reproduction" />
+        <cc:permits
+           rdf:resource="http://creativecommons.org/ns#Distribution" />
+        <cc:requires
+           rdf:resource="http://creativecommons.org/ns#Notice" />
+        <cc:requires
+           rdf:resource="http://creativecommons.org/ns#Attribution" />
+        <cc:permits
+           rdf:resource="http://creativecommons.org/ns#DerivativeWorks" />
+        <cc:requires
+           rdf:resource="http://creativecommons.org/ns#ShareAlike" />
+      </cc:License>
+    </rdf:RDF>
+  </metadata>
   <g
-     transform="translate(121.51931,-138.66452)"
-     id="layer1">
+     inkscape:label="Layer 1"
+     inkscape:groupmode="layer"
+     id="layer1"
+     transform="translate(121.51931,-138.66452)">
     <rect
-       ry="13.229166"
-       y="142.74918"
-       x="-121.51931"
-       height="87.3125"
-       width="87.3125"
-       id="rect828"
+       rx="13.229166"
+       inkscape:export-ydpi="96"
+       inkscape:export-xdpi="96"
+       inkscape:export-filename="/home/raghu/Desktop/send/hub-02.png"
        style="opacity:1;vector-effect:none;fill:#89da29;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal"
-       rx="13.229166" />
+       id="rect828"
+       width="87.3125"
+       height="87.3125"
+       x="-121.51931"
+       y="142.74918"
+       ry="13.229166" />
     <path
-       id="path830"
+       style="opacity:1;vector-effect:none;fill:#63c923;fill-opacity:1;stroke:none;stroke-width:3.96875;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal"
+       clip-path="none"
        d="m -121.51931,202.96343 v 13.86892 c 0,7.32897 5.90017,13.22917 13.22916,13.22917 h 60.854162 c 6.610072,0 12.056133,-4.80013 13.061216,-11.1187 -43.339761,0.1608 -54.359752,-16.03276 -87.144538,-15.97939 z"
-       clip-path="none"
-       style="opacity:1;vector-effect:none;fill:#63c923;fill-opacity:1;stroke:none;stroke-width:3.96875;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal" />
+       id="path830"
+       inkscape:connector-curvature="0" />
     <path
-       id="path832"
+       style="opacity:1;vector-effect:none;fill:#59b81c;fill-opacity:1;stroke:none;stroke-width:3.96875;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal"
+       clip-path="none"
        d="m -34.20681,202.96343 c -32.784694,-0.0533 -43.804846,16.14019 -87.14455,15.97939 1.00509,6.31857 6.45115,11.1187 13.06122,11.1187 h 60.854164 c 7.328992,0 13.229166,-5.9002 13.229166,-13.22917 z"
-       clip-path="none"
-       style="opacity:1;vector-effect:none;fill:#59b81c;fill-opacity:1;stroke:none;stroke-width:3.96875;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal" />
+       id="path832"
+       inkscape:connector-curvature="0" />
     <path
-       style="opacity:1;vector-effect:none;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.79375005;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal"
+       id="path834"
        d="m -84.351263,175.75725 c -1.30945,0 -2.376091,1.06665 -2.376091,2.37608 v 10.02885 0.001 c 0.06583,4.83083 4.01156,8.73477 8.857351,8.73486 4.8718,5e-5 8.846821,-3.94421 8.871295,-8.81134 v -0.001 -9.95288 c 0,-1.30943 -1.066113,-2.37557 -2.375589,-2.37557 -1.309396,0 -2.376064,1.06614 -2.376064,2.37557 v 9.8888 c 0,2.26045 -1.858169,4.10983 -4.119642,4.10983 -2.263616,0 -4.105699,-1.82766 -4.105699,-4.08968 v -9.90844 c 0,-1.30943 -1.066138,-2.37608 -2.375561,-2.37608 z m -20.887107,0.0925 c -1.30943,0 -2.37609,1.06717 -2.37609,2.3766 v 16.45119 c 0,1.30944 1.06666,2.37609 2.37609,2.37609 1.30945,0 2.37556,-1.06665 2.37556,-2.37609 v -5.97327 h 8.22534 v 5.97327 c 0,1.30944 1.066641,2.37609 2.376091,2.37609 1.309423,0 2.375561,-1.06665 2.375561,-2.37609 v -16.45119 c 0,-1.30943 -1.066138,-2.3766 -2.375561,-2.3766 -1.30945,0 -2.376091,1.06717 -2.376091,2.3766 v 5.72627 h -8.22534 v -5.72627 c 0,-1.30943 -1.06611,-2.3766 -2.37556,-2.3766 z m 41.77419,0 c -0.654712,0 -1.248675,0.26711 -1.678967,0.69764 -0.05368,0.0537 -0.105119,0.10983 -0.153458,0.16846 v 5.3e-4 c -0.04839,0.0586 -0.09427,0.11929 -0.136949,0.18242 v 5.3e-4 c -0.256381,0.37936 -0.406691,0.83617 -0.406691,1.32705 v 16.45119 c 0,0.1635 0.01693,0.3242 0.04858,0.47852 0.09512,0.46331 0.32594,0.87828 0.64852,1.20096 0.161369,0.16136 0.345308,0.29938 0.547264,0.40928 v 0 c 0.134567,0.0732 0.276781,0.13403 0.425318,0.18035 v 0 c 0.148537,0.0463 0.303186,0.0783 0.462518,0.0946 v 0 c 0.07959,0.008 0.160708,0.0124 0.242358,0.0124 h 8.33181 c 0.08747,0 0.167931,-0.0145 0.251142,-0.0238 l 0.09509,0.005 c 0.06019,0.003 0.119407,0.005 0.178779,0.006 h 0.0037 0.0048 c 3.578305,-2e-5 6.487954,-2.90916 6.487981,-6.48747 v -0.001 c -0.0026,-1.51334 -0.578009,-2.9475 -1.540484,-4.10673 0.962448,-1.15892 1.537785,-2.59314 1.540484,-4.10621 v -0.001 c -2.7e-5,-3.57831 -2.909676,-6.48744 -6.487981,-6.48746 h -0.533294 z m 8.865103,4.75062 c 0.96393,0 1.736831,0.77394 1.736831,1.73788 0,0.96394 -0.772901,1.73684 -1.736831,1.73684 v 0 h -0.532792 -5.955718 v -3.47317 h 5.956248 z m 0,8.21552 v 0 c 0.963507,5.3e-4 1.735799,0.77373 1.735799,1.73736 0,0.96394 -0.772901,1.73684 -1.736831,1.73684 h -0.0048 l -0.533294,0.0119 h -5.951591 v -3.4742 h 5.959846 z"
-       id="path834" />
+       style="opacity:1;vector-effect:none;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.79375005;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal"
+       inkscape:connector-curvature="0" />
     <path
-       id="path838"
+       style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#63c923;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:7.93750048;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
        d="m -77.859375,138.66406 c -9.653316,0 -18.439915,3.93483 -24.767575,10.28125 a 3.9691471,3.9691471 0 1 0 5.621091,5.60352 c 4.899576,-4.9141 11.6422,-7.94727 19.146484,-7.94727 7.501101,0 14.241542,3.03098 19.140625,7.94141 a 3.9691471,3.9691471 0 1 0 5.619141,-5.60547 c -6.327038,-6.34169 -15.110547,-10.27344 -24.759766,-10.27344 z"
-       style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#63c923;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:7.93750048;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate" />
+       id="path838"
+       inkscape:connector-curvature="0" />
   </g>
 </svg>
diff --git a/erpnext/public/js/controllers/taxes_and_totals.js b/erpnext/public/js/controllers/taxes_and_totals.js
index f00b84f..71c098f 100644
--- a/erpnext/public/js/controllers/taxes_and_totals.js
+++ b/erpnext/public/js/controllers/taxes_and_totals.js
@@ -84,7 +84,6 @@
 
 	calculate_item_values: function() {
 		var me = this;
-
 		if (!this.discount_amount_applied) {
 			$.each(this.frm.doc["items"] || [], function(i, item) {
 				frappe.model.round_floats_in(item);
@@ -200,16 +199,16 @@
 
 	calculate_net_total: function() {
 		var me = this;
-		this.frm.doc.total = this.frm.doc.base_total = this.frm.doc.net_total = this.frm.doc.base_net_total = 0.0;
+		this.frm.doc.total_qty = this.frm.doc.total = this.frm.doc.base_total = this.frm.doc.net_total = this.frm.doc.base_net_total = 0.0;
 
 		$.each(this.frm.doc["items"] || [], function(i, item) {
 			me.frm.doc.total += item.amount;
+			me.frm.doc.total_qty += item.qty;
 			me.frm.doc.base_total += item.base_amount;
 			me.frm.doc.net_total += item.net_amount;
 			me.frm.doc.base_net_total += item.base_net_amount;
 			});
 
-
 		frappe.model.round_floats_in(this.frm.doc, ["total", "base_total", "net_total", "base_net_total"]);
 	},
 
diff --git a/erpnext/public/js/hub/hub_factory.js b/erpnext/public/js/hub/hub_factory.js
index 01f55a3..6451e1d 100644
--- a/erpnext/public/js/hub/hub_factory.js
+++ b/erpnext/public/js/hub/hub_factory.js
@@ -35,7 +35,7 @@
 							});
 						}
 					});
-				} else {
+				} else if (!route[3]){
 					frappe.require(assets['Form'], () => {
 						erpnext.hub.pages[page_name] = new erpnext.hub[page+'Page']({
 							unique_id: route[2],
@@ -44,6 +44,15 @@
 							hub_settings: this.hub_settings
 						});
 					});
+				} else {
+					frappe.require(assets['List'], () => {
+						frappe.route_options = {};
+						frappe.route_options["company_name"] = route[2]
+						erpnext.hub.pages[page_name] = new erpnext.hub['ItemListing']({
+							parent: this.make_page(true, page_name),
+							hub_settings: this.hub_settings
+						});
+					});
 				}
 				window.hub_page = erpnext.hub.pages[page_name];
 			} else {
diff --git a/erpnext/public/js/hub/hub_listing.js b/erpnext/public/js/hub/hub_listing.js
index a979d28..0ff7970 100644
--- a/erpnext/public/js/hub/hub_listing.js
+++ b/erpnext/public/js/hub/hub_listing.js
@@ -58,12 +58,7 @@
 				label: __('Favourites'),
 				action: () => frappe.set_route('Hub', 'Favourites'),
 				standard: true
-			},
-			// {
-			// 	label: __('Toggle Sidebar'),
-			// 	action: () => this.toggle_side_bar(),
-			// 	standard: true
-			// }
+			}
 		];
 
 		return items;
@@ -85,7 +80,15 @@
 		});
 	}
 
-	setup_view() { }
+	setup_view() {
+		if(frappe.route_options){
+			const filters = [];
+			for (let field in frappe.route_options) {
+				var value = frappe.route_options[field];
+				this.page.fields_dict[field].set_value(value);
+			}
+		}
+	}
 
 	get_args() {
 		return {
@@ -110,18 +113,7 @@
 		this.data_dict = {};
 	}
 
-	freeze(toggle) {
-		// if(!this.$freeze) return;
-		// this.$freeze.toggle(toggle);
-		// if (this.$freeze.find('.image-view-container').length) return;
-
-		// const html = Array.from(new Array(4)).map(d => this.card_html({
-		// 	name: 'Loading...',
-		// 	item_name: 'Loading...'
-		// })).join('');
-
-		// this.$freeze.html(`<div class="image-view-container border-top">${html}</div>`);
-	}
+	freeze(toggle) { }
 
 	render() {
 		this.data_dict = {};
@@ -360,7 +352,7 @@
 	setup_defaults() {
 		super.setup_defaults();
 		this.doctype = 'Hub Item';
-		this.page_title = __('Products');
+		this.page_title = __('Marketplace');
 		this.fields = ['name', 'hub_item_code', 'image', 'item_name', 'item_code', 'company_name', 'description', 'country'];
 		this.filters = [];
 	}
@@ -529,7 +521,7 @@
 						(${reviewLength})
 					</div>
 					<div class="list-row-col">
-						<a href="${'#Hub/Company/'+company_name}"><p>${ company_name }</p></a>
+						<a href="${'#Hub/Company/'+company_name+'/Items'}"><p>${ company_name }</p></a>
 					</div>
 				</div>
 				<div class="image-view-body">
diff --git a/erpnext/public/js/utils/serial_no_batch_selector.js b/erpnext/public/js/utils/serial_no_batch_selector.js
index 78def26..eabb81e 100644
--- a/erpnext/public/js/utils/serial_no_batch_selector.js
+++ b/erpnext/public/js/utils/serial_no_batch_selector.js
@@ -55,11 +55,13 @@
 				},
 				get_query: function() {
 					return {
-						filters: {
-							is_group: 0,
-							company: me.frm.doc.company
-						}
-					};
+						query: "erpnext.controllers.queries.warehouse_query",
+						filters: [
+							["Bin", "item_code", "=", me.item_code],
+							["Warehouse", "is_group", "=", 0],
+							["Warehouse", "company", "=", me.frm.doc.company]
+						]
+					}
 				}
 			},
 			{fieldtype:'Column Break'},
diff --git a/erpnext/regional/report/gstr_1/gstr_1.js b/erpnext/regional/report/gstr_1/gstr_1.js
index 3a63527..b2c8aed 100644
--- a/erpnext/regional/report/gstr_1/gstr_1.js
+++ b/erpnext/regional/report/gstr_1/gstr_1.js
@@ -12,6 +12,21 @@
 			"default": frappe.defaults.get_user_default("Company")
 		},
 		{
+			"fieldname":"company_address",
+			"label": __("Address"),
+			"fieldtype": "Link",
+			"options": "Address",
+			"get_query": function() {
+				var company = frappe.query_report_filters_by_name.company.get_value();
+				if (company) {
+					return {
+						"query": 'frappe.contacts.doctype.address.address.address_query',
+						"filters": { link_doctype: 'Company', link_name: company}
+					};
+				}
+			}
+		},
+		{
 			"fieldname":"from_date",
 			"label": __("From Date"),
 			"fieldtype": "Date",
diff --git a/erpnext/regional/report/gstr_1/gstr_1.py b/erpnext/regional/report/gstr_1/gstr_1.py
index 2c128e7..690fbbc 100644
--- a/erpnext/regional/report/gstr_1/gstr_1.py
+++ b/erpnext/regional/report/gstr_1/gstr_1.py
@@ -102,7 +102,8 @@
 
 		for opts in (("company", " and company=%(company)s"),
 			("from_date", " and posting_date>=%(from_date)s"),
-			("to_date", " and posting_date<=%(to_date)s")):
+			("to_date", " and posting_date<=%(to_date)s"),
+			("company_address", " and company_address=%(company_address)s")):
 				if self.filters.get(opts[0]):
 					conditions += opts[1]
 
diff --git a/erpnext/selling/doctype/quotation/quotation.json b/erpnext/selling/doctype/quotation/quotation.json
index f589abf..6dc2c00 100644
--- a/erpnext/selling/doctype/quotation/quotation.json
+++ b/erpnext/selling/doctype/quotation/quotation.json
@@ -1179,6 +1179,37 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "fieldname": "total_qty", 
+   "fieldtype": "Float", 
+   "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": "Total Quantity", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "translatable": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "base_total", 
    "fieldtype": "Currency", 
    "hidden": 0, 
@@ -2518,8 +2549,8 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "fieldname": "select_print_heading", 
-   "fieldtype": "Link", 
+   "fieldname": "group_same_items",
+   "fieldtype": "Check",
    "hidden": 0, 
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
@@ -2527,18 +2558,16 @@
    "in_global_search": 0, 
    "in_list_view": 0, 
    "in_standard_filter": 0, 
-   "label": "Print Heading", 
+   "label": "Group same items",
    "length": 0, 
-   "no_copy": 1, 
-   "oldfieldname": "select_print_heading", 
-   "oldfieldtype": "Link", 
-   "options": "Print Heading", 
+   "no_copy": 0,
    "permlevel": 0, 
+   "precision": "",
    "print_hide": 1, 
    "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "remember_last_selected_value": 0, 
-   "report_hide": 1, 
+   "report_hide": 0,
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
@@ -2577,6 +2606,38 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_on_submit": 1,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fieldname": "select_print_heading",
+   "fieldtype": "Link",
+   "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": "Print Heading",
+   "length": 0,
+   "no_copy": 1,
+   "oldfieldname": "select_print_heading",
+   "oldfieldtype": "Link",
+   "options": "Print Heading",
+   "permlevel": 0,
+   "print_hide": 1,
+   "print_hide_if_no_value": 0,
+   "read_only": 0,
+   "remember_last_selected_value": 0,
+   "report_hide": 1,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
+   "unique": 0
+  },
+  {
+   "allow_bulk_edit": 0,
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -2974,8 +3035,8 @@
  "istable": 0, 
  "max_attachments": 1, 
  "menu_index": 0, 
- "modified": "2018-05-16 22:43:05.674515",
- "modified_by": "Administrator", 
+ "modified": "2018-05-28 03:23:15.354674",
+ "modified_by": "Administrator",
  "module": "Selling", 
  "name": "Quotation", 
  "owner": "Administrator", 
diff --git a/erpnext/selling/doctype/sales_order/sales_order.json b/erpnext/selling/doctype/sales_order/sales_order.json
index 627e824..91eafee 100644
--- a/erpnext/selling/doctype/sales_order/sales_order.json
+++ b/erpnext/selling/doctype/sales_order/sales_order.json
@@ -1264,6 +1264,37 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "fieldname": "total_qty", 
+   "fieldtype": "Float", 
+   "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": "Total Quantity", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "translatable": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "base_total", 
    "fieldtype": "Currency", 
    "hidden": 0, 
@@ -2826,7 +2857,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
-   "translatable": 0,
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -3643,7 +3674,7 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2018-05-16 22:42:49.827046",
+ "modified": "2018-05-17 12:32:28.126624", 
  "modified_by": "Administrator", 
  "module": "Selling", 
  "name": "Sales Order", 
diff --git a/erpnext/selling/doctype/sales_order/sales_order.py b/erpnext/selling/doctype/sales_order/sales_order.py
index 7fe61c9..46303b5 100755
--- a/erpnext/selling/doctype/sales_order/sales_order.py
+++ b/erpnext/selling/doctype/sales_order/sales_order.py
@@ -589,10 +589,6 @@
 		"Sales Team": {
 			"doctype": "Sales Team",
 			"add_if_empty": True
-		},
-		"Payment Schedule": {
-			"doctype": "Payment Schedule",
-			"add_if_empty": True
 		}
 	}, target_doc, postprocess, ignore_permissions=ignore_permissions)
 
diff --git a/erpnext/selling/report/sales_person_target_variance_item_group_wise/sales_person_target_variance_item_group_wise.py b/erpnext/selling/report/sales_person_target_variance_item_group_wise/sales_person_target_variance_item_group_wise.py
index e7bb5b4..fd5bc4e 100644
--- a/erpnext/selling/report/sales_person_target_variance_item_group_wise/sales_person_target_variance_item_group_wise.py
+++ b/erpnext/selling/report/sales_person_target_variance_item_group_wise/sales_person_target_variance_item_group_wise.py
@@ -98,7 +98,7 @@
 		END as qty,
 		CASE
 			WHEN so.status = "Closed" THEN sum(soi.delivered_qty * soi.conversion_factor * soi.base_net_rate * (st.allocated_percentage/100))
-			ELSE soi.base_net_amount * (st.allocated_percentage/100))
+			ELSE sum(soi.base_net_amount * (st.allocated_percentage/100))
 		END as amount
 		from
 			`tabSales Order Item` soi, `tabSales Order` so, `tabSales Team` st
diff --git a/erpnext/stock/doctype/batch/batch.py b/erpnext/stock/doctype/batch/batch.py
index 5b4f4b5..9d13657 100644
--- a/erpnext/stock/doctype/batch/batch.py
+++ b/erpnext/stock/doctype/batch/batch.py
@@ -86,8 +86,13 @@
 	def autoname(self):
 		"""Generate random ID for batch if not specified"""
 		if not self.batch_id:
-			if frappe.db.get_value('Item', self.item, 'create_new_batch'):
-				if batch_uses_naming_series():
+			create_new_batch, batch_number_series = frappe.db.get_value('Item', self.item, 
+				['create_new_batch', 'batch_number_series'])
+
+			if create_new_batch:
+				if batch_number_series:
+					self.batch_id = make_autoname(batch_number_series)
+				elif batch_uses_naming_series():
 					self.batch_id = self.get_name_from_naming_series()
 				else:
 					self.batch_id = get_name_from_hash()
diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.json b/erpnext/stock/doctype/delivery_note/delivery_note.json
index 9395083..12e5b39 100644
--- a/erpnext/stock/doctype/delivery_note/delivery_note.json
+++ b/erpnext/stock/doctype/delivery_note/delivery_note.json
@@ -1457,6 +1457,37 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "fieldname": "total_qty", 
+   "fieldtype": "Float", 
+   "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": "Total Quantity", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "translatable": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "base_total", 
    "fieldtype": "Currency", 
    "hidden": 0, 
@@ -3259,6 +3290,36 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_on_submit": 1,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fieldname": "group_same_items",
+   "fieldtype": "Check",
+   "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": "Group same items",
+   "length": 0,
+   "no_copy": 0,
+   "permlevel": 0,
+   "precision": "",
+   "print_hide": 1,
+   "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_bulk_edit": 0,
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 1, 
@@ -3820,7 +3881,7 @@
  "istable": 0, 
  "max_attachments": 0, 
  "menu_index": 0, 
- "modified": "2018-05-16 22:42:47.673449",
+ "modified": "2018-05-28 03:03:35.035396",
  "modified_by": "Administrator", 
  "module": "Stock", 
  "name": "Delivery Note", 
diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.py b/erpnext/stock/doctype/delivery_note/delivery_note.py
index 8886f33..1df07a2 100644
--- a/erpnext/stock/doctype/delivery_note/delivery_note.py
+++ b/erpnext/stock/doctype/delivery_note/delivery_note.py
@@ -82,6 +82,8 @@
 			for f in fieldname:
 				toggle_print_hide(self.meta if key == "parent" else item_meta, f)
 
+		super(DeliveryNote, self).before_print()
+
 	def set_actual_qty(self):
 		for d in self.get('items'):
 			if d.item_code and d.warehouse:
diff --git a/erpnext/stock/doctype/item/item.json b/erpnext/stock/doctype/item/item.json
index c4a3fc1..b7c90d0 100644
--- a/erpnext/stock/doctype/item/item.json
+++ b/erpnext/stock/doctype/item/item.json
@@ -17,6 +17,7 @@
  "fields": [
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -49,6 +50,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -80,6 +82,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 1, 
    "collapsible": 0, 
@@ -113,6 +116,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -147,6 +151,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 1, 
    "collapsible": 0, 
@@ -179,6 +184,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -209,6 +215,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -243,6 +250,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -274,6 +282,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -308,6 +317,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -337,6 +347,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -368,6 +379,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -399,6 +411,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 1, 
    "collapsible": 0, 
@@ -434,6 +447,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -465,6 +479,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -498,6 +513,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -530,6 +546,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -564,6 +581,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -596,6 +614,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 1, 
@@ -627,6 +646,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -660,6 +680,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -692,6 +713,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -723,6 +745,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -755,6 +778,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 1, 
@@ -789,6 +813,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -820,6 +845,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -854,6 +880,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -887,6 +914,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -919,6 +947,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -951,6 +980,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -984,6 +1014,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -1016,6 +1047,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -1048,6 +1080,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 1, 
@@ -1081,6 +1114,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -1114,6 +1148,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 1, 
@@ -1146,6 +1181,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -1181,6 +1217,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 1, 
@@ -1214,6 +1251,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -1249,6 +1287,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -1282,6 +1321,41 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "depends_on": "eval:doc.has_batch_no==1 && doc.create_new_batch==1", 
+   "description": "Example: ABCD.#####. If series is set and Batch No is not mentioned in transactions, then automatic batch number will be created based on this series. If you always want to explicitly mention Batch No for this item, leave this blank. Note: this setting will take priority over the Naming Series Prefix in Stock Settings.", 
+   "fieldname": "batch_number_series", 
+   "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": "Batch Number Series", 
+   "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, 
+   "translatable": 1, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -1314,6 +1388,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -1346,6 +1421,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -1379,6 +1455,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -1409,6 +1486,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -1445,6 +1523,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -1477,6 +1556,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 1, 
@@ -1510,6 +1590,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -1545,6 +1626,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -1579,6 +1661,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -1612,6 +1695,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 1, 
@@ -1643,6 +1727,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -1675,6 +1760,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 1, 
@@ -1707,6 +1793,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -1739,6 +1826,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -1771,6 +1859,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -1806,6 +1895,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -1837,6 +1927,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -1868,6 +1959,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -1902,6 +1994,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -1935,6 +2028,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 1, 
@@ -1967,6 +2061,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -1998,6 +2093,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -2030,6 +2126,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -2061,6 +2158,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -2094,6 +2192,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -2126,6 +2225,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 1, 
@@ -2157,6 +2257,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -2189,6 +2290,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -2219,6 +2321,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -2251,6 +2354,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 1, 
@@ -2283,6 +2387,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -2315,6 +2420,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -2347,6 +2453,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -2380,6 +2487,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -2413,6 +2521,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 1, 
@@ -2444,6 +2553,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -2475,6 +2585,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -2508,6 +2619,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -2538,6 +2650,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -2570,6 +2683,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 1, 
@@ -2601,6 +2715,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -2634,6 +2749,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 1, 
@@ -2666,6 +2782,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -2700,6 +2817,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 1, 
@@ -2732,6 +2850,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -2766,6 +2885,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -2797,6 +2917,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -2830,6 +2951,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 1, 
@@ -2863,6 +2985,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -2897,6 +3020,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -2932,6 +3056,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -2962,6 +3087,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -2992,6 +3118,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 1, 
@@ -3023,6 +3150,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -3054,6 +3182,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -3086,6 +3215,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -3118,6 +3248,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -3150,6 +3281,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -3183,6 +3315,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -3216,6 +3349,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -3247,6 +3381,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -3276,6 +3411,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -3309,6 +3445,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -3342,6 +3479,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 1, 
@@ -3374,6 +3512,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -3405,6 +3544,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -3437,6 +3577,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -3468,6 +3609,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -3499,6 +3641,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -3531,6 +3674,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -3564,6 +3708,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 1, 
    "collapsible": 0, 
@@ -3596,6 +3741,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -3628,6 +3774,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 1, 
    "collapsible": 0, 
@@ -3660,6 +3807,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -3692,6 +3840,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -3725,6 +3874,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -3768,7 +3918,7 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 1, 
- "modified": "2018-05-16 16:35:09.518294", 
+ "modified": "2018-05-28 14:18:03.234070", 
  "modified_by": "Administrator", 
  "module": "Stock", 
  "name": "Item", 
diff --git a/erpnext/stock/doctype/item/test_records.json b/erpnext/stock/doctype/item/test_records.json
index fdf8f6b..fc44fa7 100644
--- a/erpnext/stock/doctype/item/test_records.json
+++ b/erpnext/stock/doctype/item/test_records.json
@@ -4,7 +4,6 @@
   "doctype": "Item",
   "has_batch_no": 0,
   "has_serial_no": 0,
-  
   "inspection_required": 0,
   "is_stock_item": 1,
   "is_sub_contracted_item": 0,
@@ -20,7 +19,7 @@
     "expense_account": "_Test Account Cost for Goods Sold - _TC",
     "buying_cost_center": "_Test Cost Center - _TC",
     "selling_cost_center": "_Test Cost Center - _TC",
-    "income_account": "Sales - _TC",
+    "income_account": "Sales - _TC"
   }],
   "reorder_levels": [
    {
@@ -64,9 +63,8 @@
     "expense_account": "_Test Account Cost for Goods Sold - _TC",
     "buying_cost_center": "_Test Cost Center - _TC",
     "selling_cost_center": "_Test Cost Center - _TC",
-    "income_account": "Sales - _TC",
-  }],
-  
+    "income_account": "Sales - _TC"
+  }]
  },
  {
   "description": "_Test Item Home Desktop 100 3",
@@ -86,9 +84,8 @@
     "expense_account": "_Test Account Cost for Goods Sold - _TC",
     "buying_cost_center": "_Test Cost Center - _TC",
     "selling_cost_center": "_Test Cost Center - _TC",
-    "income_account": "Sales - _TC",
+    "income_account": "Sales - _TC"
   }],
-  
   "taxes": [
    {
     "doctype": "Item Tax",
@@ -116,7 +113,7 @@
     "expense_account": "_Test Account Cost for Goods Sold - _TC",
     "buying_cost_center": "_Test Cost Center - _TC",
     "selling_cost_center": "_Test Cost Center - _TC",
-    "income_account": "Sales - _TC",
+    "income_account": "Sales - _TC"
   }]
  },
  {
@@ -137,7 +134,7 @@
     "expense_account": "_Test Account Cost for Goods Sold - _TC",
     "buying_cost_center": "_Test Cost Center - _TC",
     "selling_cost_center": "_Test Cost Center - _TC",
-    "income_account": "Sales - _TC",
+    "income_account": "Sales - _TC"
   }]
  },
  {
@@ -158,7 +155,7 @@
     "expense_account": "_Test Account Cost for Goods Sold - _TC",
     "buying_cost_center": "_Test Cost Center - _TC",
     "selling_cost_center": "_Test Cost Center - _TC",
-    "income_account": "Sales - _TC",
+    "income_account": "Sales - _TC"
   }]
  },
  {
@@ -192,7 +189,7 @@
     "expense_account": "_Test Account Cost for Goods Sold - _TC",
     "buying_cost_center": "_Test Cost Center - _TC",
     "selling_cost_center": "_Test Cost Center - _TC",
-    "income_account": "Sales - _TC",
+    "income_account": "Sales - _TC"
   }]
  },
  {
@@ -214,7 +211,7 @@
     "expense_account": "_Test Account Cost for Goods Sold - _TC",
     "buying_cost_center": "_Test Cost Center - _TC",
     "selling_cost_center": "_Test Cost Center - _TC",
-    "income_account": "Sales - _TC",
+    "income_account": "Sales - _TC"
   }]
  },
  {
@@ -235,7 +232,7 @@
     "expense_account": "_Test Account Cost for Goods Sold - _TC",
     "buying_cost_center": "_Test Cost Center - _TC",
     "selling_cost_center": "_Test Cost Center - _TC",
-    "income_account": "Sales - _TC",
+    "income_account": "Sales - _TC"
   }]
  },
  {
@@ -256,7 +253,7 @@
     "expense_account": "_Test Account Cost for Goods Sold - _TC",
     "buying_cost_center": "_Test Cost Center - _TC",
     "selling_cost_center": "_Test Cost Center - _TC",
-    "income_account": "Sales - _TC",
+    "income_account": "Sales - _TC"
   }]
  },
  {
@@ -278,7 +275,7 @@
     "expense_account": "_Test Account Cost for Goods Sold - _TC",
     "buying_cost_center": "_Test Cost Center - _TC",
     "selling_cost_center": "_Test Cost Center - _TC",
-    "income_account": "Sales - _TC",
+    "income_account": "Sales - _TC"
   }],
   "attributes": [
 	  {
@@ -313,7 +310,7 @@
     "expense_account": "_Test Account Cost for Goods Sold - _TC",
     "buying_cost_center": "_Test Cost Center - _TC",
     "selling_cost_center": "_Test Cost Center - _TC",
-    "income_account": "Sales - _TC",
+    "income_account": "Sales - _TC"
   }],
   "reorder_levels": [
    {
diff --git a/erpnext/stock/doctype/packed_item/packed_item.py b/erpnext/stock/doctype/packed_item/packed_item.py
index 5649b3d..fc53794 100644
--- a/erpnext/stock/doctype/packed_item/packed_item.py
+++ b/erpnext/stock/doctype/packed_item/packed_item.py
@@ -53,7 +53,8 @@
 	pi.qty = flt(qty)
 	pi.description = description
 	if not pi.warehouse:
-		pi.warehouse = item.default_warehouse or main_item_row.warehouse
+		pi.warehouse = (main_item_row.warehouse
+			if (doc.get('is_pos') or not item.default_warehouse) else item.default_warehouse)
 	if not pi.batch_no:
 		pi.batch_no = cstr(main_item_row.get("batch_no"))
 	if not pi.target_warehouse:
diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.json b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.json
index 7ab8974..f94e5a5 100755
--- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.json
+++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.json
@@ -1172,6 +1172,37 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "fieldname": "total_qty", 
+   "fieldtype": "Float", 
+   "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": "Total Quantity", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "translatable": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "base_total", 
    "fieldtype": "Currency", 
    "hidden": 0, 
@@ -3074,10 +3105,69 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_on_submit": 1,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fieldname": "group_same_items",
+   "fieldtype": "Check",
+   "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": "Group same items",
+   "length": 0,
+   "no_copy": 0,
+   "permlevel": 0,
+   "precision": "",
+   "print_hide": 1,
+   "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_bulk_edit": 0,
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "fieldname": "column_break_97",
+   "fieldtype": "Column 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_bulk_edit": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
    "fieldname": "other_details", 
    "fieldtype": "HTML", 
    "hidden": 1, 
@@ -3346,7 +3436,7 @@
  "istable": 0, 
  "max_attachments": 0, 
  "menu_index": 0, 
- "modified": "2018-05-16 22:43:17.541460",
+ "modified": "2018-05-28 02:59:59.609643",
  "modified_by": "Administrator", 
  "module": "Stock", 
  "name": "Purchase Receipt", 
diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
index 17afba0..fa441b5 100644
--- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
+++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
@@ -122,6 +122,8 @@
 		self.update_prevdoc_status()
 		if self.per_billed < 100:
 			self.update_billing_status()
+		else:
+			self.status = "Completed"
 
 		
 		# Updating stock ledger should always be called after updating prevdoc status,
diff --git a/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json b/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json
index 87c9a75..9607fb9 100755
--- a/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json
+++ b/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json
@@ -632,6 +632,7 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "fetch_from": "item_code.retain_sample", 
    "fieldname": "retain_sample", 
    "fieldtype": "Check", 
    "hidden": 0, 
@@ -644,7 +645,7 @@
    "label": "Retain Sample", 
    "length": 0, 
    "no_copy": 0, 
-   "options": "item_code.retain_sample", 
+   "options": "", 
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
@@ -665,6 +666,7 @@
    "collapsible": 0, 
    "columns": 0, 
    "depends_on": "retain_sample", 
+   "fetch_from": "item_code.sample_quantity", 
    "fieldname": "sample_quantity", 
    "fieldtype": "Int", 
    "hidden": 0, 
@@ -677,7 +679,7 @@
    "label": "Sample Quantity", 
    "length": 0, 
    "no_copy": 0, 
-   "options": "item_code.sample_quantity", 
+   "options": "", 
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
@@ -2492,7 +2494,7 @@
  "issingle": 0, 
  "istable": 1, 
  "max_attachments": 0, 
- "modified": "2018-05-07 13:42:05.061386", 
+ "modified": "2018-05-25 13:42:05.061386", 
  "modified_by": "Administrator", 
  "module": "Stock", 
  "name": "Purchase Receipt Item", 
diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.js b/erpnext/stock/doctype/stock_entry/stock_entry.js
index 7452da8..359d834 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.js
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.js
@@ -156,6 +156,29 @@
 				})
 			}, __("Get items from"));
 		}
+		if (frm.doc.docstatus===0 && frm.doc.purpose == "Material Issue") {
+			frm.add_custom_button(__('Expired Batches'), function() {
+				frappe.call({
+					method: "erpnext.stock.doctype.stock_entry.stock_entry.get_expired_batch_items",
+					callback: function(r) {
+						if (!r.exc && r.message) {
+							frm.set_value("items", []);
+							r.message.forEach(function(element) {
+								let d = frm.add_child("items");
+								d.item_code = element.item;
+								d.s_warehouse = element.warehouse;
+								d.qty = element.qty;
+								d.uom = element.stock_uom;
+								d.conversion_factor = 1;
+								d.batch_no = element.batch_no;
+								d.transfer_qty = element.qty;
+								frm.refresh_fields();
+							});
+						}
+					}
+				});
+			}, __("Get items from"));
+		}
 
 		if (frm.doc.company) {
 			frm.trigger("toggle_display_account_head");
@@ -350,7 +373,7 @@
 
 	target_warehouse_address: function(frm) {
 		erpnext.utils.get_address_display(frm, 'target_warehouse_address', 'target_address_display', false);
-	},
+	}
 })
 
 frappe.ui.form.on('Stock Entry Detail', {
diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py
index 3862854..412331e 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.py
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.py
@@ -252,10 +252,13 @@
 	def check_if_operations_completed(self):
 		"""Check if Time Sheets are completed against before manufacturing to capture operating costs."""
 		prod_order = frappe.get_doc("Work Order", self.work_order)
+		allowance_percentage = flt(frappe.db.get_single_value("Manufacturing Settings",
+			"overproduction_percentage_for_work_order"))
 
 		for d in prod_order.get("operations"):
 			total_completed_qty = flt(self.fg_completed_qty) + flt(prod_order.produced_qty)
-			if total_completed_qty > flt(d.completed_qty):
+			completed_qty = d.completed_qty + (allowance_percentage/100 * d.completed_qty)
+			if total_completed_qty > flt(completed_qty):
 				frappe.throw(_("Row #{0}: Operation {1} is not completed for {2} qty of finished goods in Work Order # {3}. Please update operation status via Time Logs")
 					.format(d.idx, d.operation, total_completed_qty, self.work_order), OperationsNotCompleteError)
 
@@ -469,8 +472,11 @@
 	def validate_finished_goods(self):
 		"""validation: finished good quantity should be same as manufacturing quantity"""
 		items_with_target_warehouse = []
+		allowance_percentage = flt(frappe.db.get_single_value("Manufacturing Settings",
+			"overproduction_percentage_for_work_order"))
+
 		for d in self.get('items'):
-			if self.purpose != "Subcontract" and d.bom_no and flt(d.transfer_qty) != flt(self.fg_completed_qty) and (d.t_warehouse != getattr(self, "pro_doc", frappe._dict()).scrap_warehouse):
+			if self.purpose != "Subcontract" and d.bom_no and flt(d.transfer_qty) > flt(self.fg_completed_qty) and (d.t_warehouse != getattr(self, "pro_doc", frappe._dict()).scrap_warehouse):
 				frappe.throw(_("Quantity in row {0} ({1}) must be same as manufactured quantity {2}"). \
 					format(d.idx, d.transfer_qty, self.fg_completed_qty))
 
@@ -478,8 +484,14 @@
 				items_with_target_warehouse.append(d.item_code)
 
 		if self.work_order and self.purpose == "Manufacture":
-			production_item = frappe.db.get_value("Work Order",
-				self.work_order, "production_item")
+			production_item, wo_qty = frappe.db.get_value("Work Order",
+				self.work_order, ["production_item", "qty"])
+
+			allowed_qty = wo_qty + (allowance_percentage/100 * wo_qty)
+			if self.fg_completed_qty > allowed_qty:
+				frappe.throw(_("For quantity {0} should not be grater than work order quantity {1}")
+					.format(flt(self.fg_completed_qty), wo_qty))
+
 			if production_item not in items_with_target_warehouse:
 				frappe.throw(_("Finished Item {0} must be entered for Manufacture type entry")
 					.format(production_item))
@@ -1154,6 +1166,15 @@
 	return ret
 
 @frappe.whitelist()
+def get_expired_batch_items():
+	return frappe.db.sql("""select b.item, sum(sle.actual_qty) as qty, sle.batch_no, sle.warehouse, sle.stock_uom\
+	from `tabBatch` b, `tabStock Ledger Entry` sle
+	where b.expiry_date <= %s
+	and b.expiry_date is not NULL
+	and b.batch_id = sle.batch_no
+	group by sle.warehouse, sle.item_code, sle.batch_no""",(nowdate()), as_dict=1)
+
+@frappe.whitelist()
 def get_warehouse_details(args):
 	if isinstance(args, string_types):
 		args = json.loads(args)
diff --git a/erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.json b/erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.json
index 5fdab6f..6176bf9 100644
--- a/erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.json
+++ b/erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.json
@@ -837,6 +837,7 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "fetch_from": "item_code.retain_sample", 
    "fieldname": "retain_sample", 
    "fieldtype": "Check", 
    "hidden": 0, 
@@ -849,7 +850,7 @@
    "label": "Retain Sample", 
    "length": 0, 
    "no_copy": 0, 
-   "options": "item_code.retain_sample", 
+   "options": "", 
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
@@ -1469,7 +1470,7 @@
  "issingle": 0, 
  "istable": 1, 
  "max_attachments": 0, 
- "modified": "2018-03-05 13:09:25.849700", 
+ "modified": "2018-05-25 13:09:25.849700", 
  "modified_by": "Administrator", 
  "module": "Stock", 
  "name": "Stock Entry Detail", 
diff --git a/erpnext/stock/doctype/warehouse/warehouse.py b/erpnext/stock/doctype/warehouse/warehouse.py
index 9c47f98..ec60e84 100644
--- a/erpnext/stock/doctype/warehouse/warehouse.py
+++ b/erpnext/stock/doctype/warehouse/warehouse.py
@@ -144,17 +144,19 @@
 	if is_root:
 		parent = ""
 
-	warehouses = frappe.db.sql("""select name as value,
-		is_group as expandable
-		from `tabWarehouse`
-		where docstatus < 2
-		and ifnull(`parent_warehouse`,'') = %s
-		and (`company` = %s or company is null or company = '')
-		order by name""", (parent, company), as_dict=1)
+	fields = ['name as value', 'is_group as expandable']
+	filters = [
+		['docstatus', '<', '2'],
+		['ifnull(`parent_warehouse`, "")', '=', parent],
+		['company', 'in', (company, None,'')]
+	]
+
+	warehouses = frappe.get_list(doctype, fields=fields, filters=filters, order_by='name')
 
 	# return warehouses
 	for wh in warehouses:
 		wh["balance"] = get_stock_value_on(warehouse=wh.value)
+
 	return warehouses
 
 @frappe.whitelist()
diff --git a/erpnext/stock/get_item_details.py b/erpnext/stock/get_item_details.py
index 68936ac..59f43a6 100644
--- a/erpnext/stock/get_item_details.py
+++ b/erpnext/stock/get_item_details.py
@@ -289,8 +289,7 @@
 		["Account", "expense_account", "default_expense_account"],
 		["Cost Center", "cost_center", "cost_center"],
 		["Warehouse", "warehouse", ""]]:
-			company = frappe.db.get_value(d[0], out.get(d[1]), "company")
-			if not out[d[1]] or (company and args.company != company):
+			if not out[d[1]]:
 				out[d[1]] = frappe.db.get_value("Company", args.company, d[2]) if d[2] else None
 
 	for fieldname in ("item_name", "item_group", "barcodes", "brand", "stock_uom"):
diff --git a/erpnext/stock/report/stock_ledger/stock_ledger.py b/erpnext/stock/report/stock_ledger/stock_ledger.py
index 1a91ab4..ec95561 100644
--- a/erpnext/stock/report/stock_ledger/stock_ledger.py
+++ b/erpnext/stock/report/stock_ledger/stock_ledger.py
@@ -56,7 +56,7 @@
 	item_conditions_sql = ''
 	if items:
 		item_conditions_sql = 'and sle.item_code in ({})'\
-			.format(', '.join(['"' + frappe.db.escape(i,percent=False) + '"' for i in items]))
+			.format(', '.join(['"' + frappe.db.escape(i) + '"' for i in items]))
 
 	return frappe.db.sql("""select concat_ws(" ", posting_date, posting_time) as date,
 			item_code, warehouse, actual_qty, qty_after_transaction, incoming_rate, valuation_rate,
diff --git a/erpnext/templates/pages/help.html b/erpnext/templates/pages/help.html
index f7568d5..a49268a 100644
--- a/erpnext/templates/pages/help.html
+++ b/erpnext/templates/pages/help.html
@@ -55,7 +55,7 @@
 	<p><a href="/issues">{{ _("See all open tickets") }}</a></p>
 </div>
 
-<a href="/issues?new=1" class="btn btn-primary btn-new btn-sm">
+<a href="/issues?new=1" class="btn btn-default btn-new btn-sm">
 	{{ _("Open a new ticket") }}
 </a>
 
diff --git a/erpnext/templates/pages/help.py b/erpnext/templates/pages/help.py
index 754a09c..c484d25 100644
--- a/erpnext/templates/pages/help.py
+++ b/erpnext/templates/pages/help.py
@@ -19,7 +19,7 @@
 	context.topics = topics_data[:3]
 
 	# Issues
-	context.issues = frappe.get_list("Issue")[:3]
+	context.issues = frappe.get_list("Issue", fields=["name", "status", "subject", "modified"])[:3]
 
 def get_forum_posts(s):
 	response = requests.get(s.forum_url + '/' + s.get_latest_query)
diff --git a/erpnext/utilities/page/leaderboard/leaderboard.js b/erpnext/utilities/page/leaderboard/leaderboard.js
index 6e4db1b..5563fb0 100644
--- a/erpnext/utilities/page/leaderboard/leaderboard.js
+++ b/erpnext/utilities/page/leaderboard/leaderboard.js
@@ -85,7 +85,7 @@
 
 		this.$sidebar_list.on('click', 'li', function(e) {
 			let $li = $(this);
-			let doctype = $li.find('span').html();
+			let doctype = $li.find('span').attr("doctype-value");
 
 			me.options.selected_company = frappe.defaults.get_default('company');
 			me.options.selected_doctype = doctype;
@@ -172,7 +172,7 @@
 			$container.find(".leaderboard-list").html(me.render_list_view(res.message));
 		} else {
 			me.$graph_area.hide();
-			me.message = "No items found.";
+			me.message = __("No items found.");
 			$container.find(".leaderboard-list").html(me.render_list_view());
 		}
 	},
@@ -301,7 +301,7 @@
 	get_sidebar_item: function(item) {
 		return $(`<li class="strong module-sidebar-item">
 			<a class="module-link">
-			<span>${ item }</span></a>
+			<span doctype-value="${item}">${ __(item) }</span></a>
 		</li>`);
 	}
 });