Merge branch 'develop' into payment-reconc-party-validation-fix
diff --git a/.eslintrc b/.eslintrc
index cb45ce5..46fb354 100644
--- a/.eslintrc
+++ b/.eslintrc
@@ -154,7 +154,8 @@
 		"before": true,
 		"beforeEach": true,
 		"onScan": true,
+		"html2canvas": true,
 		"extend_cscript": true,
-		"localforage": true,
+		"localforage": true
 	}
 }
diff --git a/.github/helper/documentation.py b/.github/helper/documentation.py
index 9cc4663..91983d3 100644
--- a/.github/helper/documentation.py
+++ b/.github/helper/documentation.py
@@ -32,11 +32,15 @@
 
 	if response.ok:
 		payload = response.json()
-		title = payload.get("title", "").lower()
-		head_sha = payload.get("head", {}).get("sha")
-		body = payload.get("body", "").lower()
+		title = (payload.get("title") or "").lower().strip()
+		head_sha = (payload.get("head") or {}).get("sha")
+		body = (payload.get("body") or "").lower()
 
-		if title.startswith("feat") and head_sha and "no-docs" not in body:
+		if (title.startswith("feat")
+			and head_sha
+			and "no-docs" not in body
+			and "backport" not in body
+		):
 			if docs_link_exists(body):
 				print("Documentation Link Found. You're Awesome! 🎉")
 
diff --git a/.github/workflows/patch.yml b/.github/workflows/patch.yml
index dc72987..72d4028 100644
--- a/.github/workflows/patch.yml
+++ b/.github/workflows/patch.yml
@@ -1,6 +1,12 @@
 name: Patch
 
-on: [pull_request, workflow_dispatch]
+on:
+  pull_request:
+    paths-ignore:
+      - '**.js'
+      - '**.md'
+  workflow_dispatch:
+
 
 jobs:
   test:
diff --git a/.github/workflows/server-tests.yml b/.github/workflows/server-tests.yml
index 606002e..3a1ecd3 100644
--- a/.github/workflows/server-tests.yml
+++ b/.github/workflows/server-tests.yml
@@ -2,9 +2,15 @@
 
 on:
   pull_request:
+    paths-ignore:
+      - '**.js'
+      - '**.md'
   workflow_dispatch:
   push:
     branches: [ develop ]
+    paths-ignore:
+      - '**.js'
+      - '**.md'
 
 jobs:
   test:
diff --git a/.github/workflows/ui-tests.yml b/.github/workflows/ui-tests.yml
index 9e29b6f..0be9bd8 100644
--- a/.github/workflows/ui-tests.yml
+++ b/.github/workflows/ui-tests.yml
@@ -2,6 +2,8 @@
 
 on:
   pull_request:
+    paths-ignore:
+      - '**.md'
   workflow_dispatch:
 
 jobs:
@@ -102,7 +104,7 @@
       - name: UI Tests
         run: cd ~/frappe-bench/ && bench --site test_site run-ui-tests erpnext --headless
         env:
-          CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
+          CYPRESS_RECORD_KEY: 60a8e3bf-08f5-45b1-9269-2b207d7d30cd
 
       - name: Show bench console if tests failed
         if: ${{ failure() }}
diff --git a/cypress/integration/test_organizational_chart_desktop.js b/cypress/integration/test_organizational_chart_desktop.js
new file mode 100644
index 0000000..820a23a
--- /dev/null
+++ b/cypress/integration/test_organizational_chart_desktop.js
@@ -0,0 +1,113 @@
+context('Organizational Chart', () => {
+	before(() => {
+		cy.login();
+		cy.visit('/app/website');
+		cy.awesomebar('Organizational Chart');
+		cy.wait(500);
+		cy.url().should('include', '/organizational-chart');
+
+		cy.window().its('frappe.csrf_token').then(csrf_token => {
+			return cy.request({
+				url: `/api/method/erpnext.tests.ui_test_helpers.create_employee_records`,
+				method: 'POST',
+				headers: {
+					Accept: 'application/json',
+					'Content-Type': 'application/json',
+					'X-Frappe-CSRF-Token': csrf_token
+				},
+				timeout: 60000
+			}).then(res => {
+				expect(res.status).eq(200);
+				cy.get('.frappe-control[data-fieldname=company] input').focus().as('input');
+				cy.get('@input')
+					.clear({ force: true })
+					.type('Test Org Chart{enter}', { force: true })
+					.blur({ force: true });
+			});
+		});
+	});
+
+	it('renders root nodes and loads children for the first expandable node', () => {
+		// check rendered root nodes and the node name, title, connections
+		cy.get('.hierarchy').find('.root-level ul.node-children').children()
+			.should('have.length', 2)
+			.first()
+			.as('first-child');
+
+		cy.get('@first-child').get('.node-name').contains('Test Employee 1');
+		cy.get('@first-child').get('.node-info').find('.node-title').contains('CEO');
+		cy.get('@first-child').get('.node-info').find('.node-connections').contains('· 2 Connections');
+
+		cy.call('erpnext.tests.ui_test_helpers.get_employee_records').then(employee_records => {
+			// children of 1st root visible
+			cy.get(`div[data-parent="${employee_records.message[0]}"]`).as('child-node');
+			cy.get('@child-node')
+				.should('have.length', 1)
+				.should('be.visible');
+			cy.get('@child-node').get('.node-name').contains('Test Employee 3');
+
+			// connectors between first root node and immediate child
+			cy.get(`path[data-parent="${employee_records.message[0]}"]`)
+				.should('be.visible')
+				.invoke('attr', 'data-child')
+				.should('equal', employee_records.message[2]);
+		});
+	});
+
+	it('hides active nodes children and connectors on expanding sibling node', () => {
+		cy.call('erpnext.tests.ui_test_helpers.get_employee_records').then(employee_records => {
+			// click sibling
+			cy.get(`#${employee_records.message[1]}`)
+				.click()
+				.should('have.class', 'active');
+
+			// child nodes and connectors hidden
+			cy.get(`[data-parent="${employee_records.message[0]}"]`).should('not.be.visible');
+			cy.get(`path[data-parent="${employee_records.message[0]}"]`).should('not.be.visible');
+		});
+	});
+
+	it('collapses previous level nodes and refreshes connectors on expanding child node', () => {
+		cy.call('erpnext.tests.ui_test_helpers.get_employee_records').then(employee_records => {
+			// click child node
+			cy.get(`#${employee_records.message[3]}`)
+				.click()
+				.should('have.class', 'active');
+
+			// previous level nodes: parent should be on active-path; other nodes should be collapsed
+			cy.get(`#${employee_records.message[0]}`).should('have.class', 'collapsed');
+			cy.get(`#${employee_records.message[1]}`).should('have.class', 'active-path');
+
+			// previous level connectors refreshed
+			cy.get(`path[data-parent="${employee_records.message[1]}"]`)
+				.should('have.class', 'collapsed-connector');
+
+			// child node's children and connectors rendered
+			cy.get(`[data-parent="${employee_records.message[3]}"]`).should('be.visible');
+			cy.get(`path[data-parent="${employee_records.message[3]}"]`).should('be.visible');
+		});
+	});
+
+	it('expands previous level nodes', () => {
+		cy.call('erpnext.tests.ui_test_helpers.get_employee_records').then(employee_records => {
+			cy.get(`#${employee_records.message[0]}`)
+				.click()
+				.should('have.class', 'active');
+
+			cy.get(`[data-parent="${employee_records.message[0]}"]`)
+				.should('be.visible');
+
+			cy.get('ul.hierarchy').children().should('have.length', 2);
+			cy.get(`#connectors`).children().should('have.length', 1);
+		});
+	});
+
+	it('edit node navigates to employee master', () => {
+		cy.call('erpnext.tests.ui_test_helpers.get_employee_records').then(employee_records => {
+			cy.get(`#${employee_records.message[0]}`).find('.btn-edit-node')
+				.click();
+
+			cy.url().should('include', `/employee/${employee_records.message[0]}`);
+		});
+	});
+});
diff --git a/cypress/integration/test_organizational_chart_mobile.js b/cypress/integration/test_organizational_chart_mobile.js
new file mode 100644
index 0000000..df90dbf
--- /dev/null
+++ b/cypress/integration/test_organizational_chart_mobile.js
@@ -0,0 +1,190 @@
+context('Organizational Chart Mobile', () => {
+	before(() => {
+		cy.login();
+		cy.viewport(375, 667);
+		cy.visit('/app/website');
+		cy.awesomebar('Organizational Chart');
+
+		cy.window().its('frappe.csrf_token').then(csrf_token => {
+			return cy.request({
+				url: `/api/method/erpnext.tests.ui_test_helpers.create_employee_records`,
+				method: 'POST',
+				headers: {
+					Accept: 'application/json',
+					'Content-Type': 'application/json',
+					'X-Frappe-CSRF-Token': csrf_token
+				},
+				timeout: 60000
+			}).then(res => {
+				expect(res.status).eq(200);
+				cy.get('.frappe-control[data-fieldname=company] input').focus().as('input');
+				cy.get('@input')
+					.clear({ force: true })
+					.type('Test Org Chart{enter}', { force: true })
+					.blur({ force: true });
+			});
+		});
+	});
+
+	it('renders root nodes', () => {
+		// check rendered root nodes and the node name, title, connections
+		cy.get('.hierarchy-mobile').find('.root-level').children()
+			.should('have.length', 2)
+			.first()
+			.as('first-child');
+
+		cy.get('@first-child').get('.node-name').contains('Test Employee 1');
+		cy.get('@first-child').get('.node-info').find('.node-title').contains('CEO');
+		cy.get('@first-child').get('.node-info').find('.node-connections').contains('· 2');
+	});
+
+	it('expands root node', () => {
+		cy.call('erpnext.tests.ui_test_helpers.get_employee_records').then(employee_records => {
+			cy.get(`#${employee_records.message[1]}`)
+				.click()
+				.should('have.class', 'active');
+
+			// other root node removed
+			cy.get(`#${employee_records.message[0]}`).should('not.exist');
+
+			// children of active root node
+			cy.get('.hierarchy-mobile').find('.level').first().find('ul.node-children').children()
+				.should('have.length', 2);
+
+			cy.get(`div[data-parent="${employee_records.message[1]}"]`).first().as('child-node');
+			cy.get('@child-node').should('be.visible');
+
+			cy.get('@child-node')
+				.get('.node-name')
+				.contains('Test Employee 4');
+
+			// connectors between root node and immediate children
+			cy.get(`path[data-parent="${employee_records.message[1]}"]`).as('connectors');
+			cy.get('@connectors')
+				.should('have.length', 2)
+				.should('be.visible');
+
+			cy.get('@connectors')
+				.first()
+				.invoke('attr', 'data-child')
+				.should('eq', employee_records.message[3]);
+		});
+	});
+
+	it('expands child node', () => {
+		cy.call('erpnext.tests.ui_test_helpers.get_employee_records').then(employee_records => {
+			cy.get(`#${employee_records.message[3]}`)
+				.click()
+				.should('have.class', 'active')
+				.as('expanded_node');
+
+			// 2 levels on screen; 1 on active path; 1 collapsed
+			cy.get('.hierarchy-mobile').children().should('have.length', 2);
+			cy.get(`#${employee_records.message[1]}`).should('have.class', 'active-path');
+
+			// children of expanded node visible
+			cy.get('@expanded_node')
+				.next()
+				.should('have.class', 'node-children')
+				.as('node-children');
+
+			cy.get('@node-children').children().should('have.length', 1);
+			cy.get('@node-children')
+				.first()
+				.get('.node-card')
+				.should('have.class', 'active-child')
+				.contains('Test Employee 7');
+
+			// orphan connectors removed
+			cy.get(`#connectors`).children().should('have.length', 2);
+		});
+	});
+
+	it('renders sibling group', () => {
+		cy.call('erpnext.tests.ui_test_helpers.get_employee_records').then(employee_records => {
+			// sibling group visible for parent
+			cy.get(`#${employee_records.message[1]}`)
+				.next()
+				.as('sibling_group');
+
+			cy.get('@sibling_group')
+				.should('have.attr', 'data-parent', 'undefined')
+				.should('have.class', 'node-group')
+				.and('have.class', 'collapsed');
+
+			cy.get('@sibling_group').get('.avatar-group').children().as('siblings');
+			cy.get('@siblings').should('have.length', 1);
+			cy.get('@siblings')
+				.first()
+				.should('have.attr', 'title', 'Test Employee 1');
+
+		});
+	});
+
+	it('expands previous level nodes', () => {
+		cy.call('erpnext.tests.ui_test_helpers.get_employee_records').then(employee_records => {
+			cy.get(`#${employee_records.message[6]}`)
+				.click()
+				.should('have.class', 'active');
+
+			// clicking on previous level node should remove all the nodes ahead
+			// and expand that node
+			cy.get(`#${employee_records.message[3]}`).click();
+			cy.get(`#${employee_records.message[3]}`)
+				.should('have.class', 'active')
+				.should('not.have.class', 'active-path');
+
+			cy.get(`#${employee_records.message[6]}`).should('have.class', 'active-child');
+			cy.get('.hierarchy-mobile').children().should('have.length', 2);
+			cy.get(`#connectors`).children().should('have.length', 2);
+		});
+	});
+
+	it('expands sibling group', () => {
+		cy.call('erpnext.tests.ui_test_helpers.get_employee_records').then(employee_records => {
+			// sibling group visible for parent
+			cy.get(`#${employee_records.message[6]}`).click();
+
+			cy.get(`#${employee_records.message[3]}`)
+				.next()
+				.click();
+
+			// siblings of parent should be visible
+			cy.get('.hierarchy-mobile').prev().as('sibling_group');
+			cy.get('@sibling_group')
+				.should('exist')
+				.should('have.class', 'sibling-group')
+				.should('not.have.class', 'collapsed');
+
+			cy.get(`#${employee_records.message[1]}`)
+				.should('be.visible')
+				.should('have.class', 'active');
+
+			cy.get(`[data-parent="${employee_records.message[1]}"]`)
+				.should('be.visible')
+				.should('have.length', 2)
+				.should('have.class', 'active-child');
+		});
+	});
+
+	it('goes to the respective level after clicking on non-collapsed sibling group', () => {
+		cy.call('erpnext.tests.ui_test_helpers.get_employee_records').then(() => {
+			// click on non-collapsed sibling group
+			cy.get('.hierarchy-mobile')
+				.prev()
+				.click();
+
+			// should take you to that level
+			cy.get('.hierarchy-mobile').find('li.level .node-card').should('have.length', 2);
+		});
+	});
+
+	it('edit node navigates to employee master', () => {
+		cy.call('erpnext.tests.ui_test_helpers.get_employee_records').then(employee_records => {
+			cy.get(`#${employee_records.message[0]}`).find('.btn-edit-node')
+				.click();
+
+			cy.url().should('include', `/employee/${employee_records.message[0]}`);
+		});
+	});
+});
diff --git a/erpnext/__init__.py b/erpnext/__init__.py
index c90e01c..17d6505 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__ = '13.8.0'
+__version__ = '13.9.0'
 
 def get_default_company(user=None):
 	'''Get default company for user'''
diff --git a/erpnext/accounts/doctype/accounts_settings/accounts_settings.json b/erpnext/accounts/doctype/accounts_settings/accounts_settings.json
index 7bcc6ee..a246ae5 100644
--- a/erpnext/accounts/doctype/accounts_settings/accounts_settings.json
+++ b/erpnext/accounts/doctype/accounts_settings/accounts_settings.json
@@ -20,6 +20,7 @@
   "book_asset_depreciation_entry_automatically",
   "unlink_advance_payment_on_cancelation_of_order",
   "post_change_gl_entries",
+  "enable_discount_accounting",
   "tax_settings_section",
   "determine_address_tax_category_from",
   "column_break_19",
@@ -260,6 +261,13 @@
    "fieldname": "post_change_gl_entries",
    "fieldtype": "Check",
    "label": "Create Ledger Entries for Change Amount"
+  },
+  {
+   "default": "0",
+   "description": "If enabled, additional ledger entries will be made for discounts in a separate Discount Account",
+   "fieldname": "enable_discount_accounting",
+   "fieldtype": "Check",
+   "label": "Enable Discount Accounting"
   }
  ],
  "icon": "icon-cog",
@@ -267,7 +275,7 @@
  "index_web_pages_for_search": 1,
  "issingle": 1,
  "links": [],
- "modified": "2021-08-09 13:08:01.335416",
+ "modified": "2021-08-09 13:08:04.335416",
  "modified_by": "Administrator",
  "module": "Accounts",
  "name": "Accounts Settings",
diff --git a/erpnext/accounts/doctype/accounts_settings/accounts_settings.py b/erpnext/accounts/doctype/accounts_settings/accounts_settings.py
index ac4a2d6..5544913 100644
--- a/erpnext/accounts/doctype/accounts_settings/accounts_settings.py
+++ b/erpnext/accounts/doctype/accounts_settings/accounts_settings.py
@@ -21,6 +21,7 @@
 
 		self.validate_stale_days()
 		self.enable_payment_schedule_in_print()
+		self.toggle_discount_accounting_fields()
 
 	def validate_stale_days(self):
 		if not self.allow_stale and cint(self.stale_days) <= 0:
@@ -33,3 +34,22 @@
 		for doctype in ("Sales Order", "Sales Invoice", "Purchase Order", "Purchase Invoice"):
 			make_property_setter(doctype, "due_date", "print_hide", show_in_print, "Check", validate_fields_for_doctype=False)
 			make_property_setter(doctype, "payment_schedule", "print_hide",  0 if show_in_print else 1, "Check", validate_fields_for_doctype=False)
+
+	def toggle_discount_accounting_fields(self):
+		enable_discount_accounting = cint(self.enable_discount_accounting)
+		
+		for doctype in ["Sales Invoice Item", "Purchase Invoice Item"]:
+			make_property_setter(doctype, "discount_account", "hidden", not(enable_discount_accounting), "Check", validate_fields_for_doctype=False)
+			if enable_discount_accounting:
+				make_property_setter(doctype, "discount_account", "mandatory_depends_on", "eval: doc.discount_amount", "Code", validate_fields_for_doctype=False)
+			else:
+				make_property_setter(doctype, "discount_account", "mandatory_depends_on", "", "Code", validate_fields_for_doctype=False)
+
+		for doctype in ["Sales Invoice", "Purchase Invoice"]:
+			make_property_setter(doctype, "additional_discount_account", "hidden", not(enable_discount_accounting), "Check", validate_fields_for_doctype=False)
+			if enable_discount_accounting:
+				make_property_setter(doctype, "additional_discount_account", "mandatory_depends_on", "eval: doc.discount_amount", "Code", validate_fields_for_doctype=False)
+			else:
+				make_property_setter(doctype, "additional_discount_account", "mandatory_depends_on", "", "Code", validate_fields_for_doctype=False)
+
+		make_property_setter("Item", "default_discount_account", "hidden", not(enable_discount_accounting), "Check", validate_fields_for_doctype=False)
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/campaign_item/__init__.py b/erpnext/accounts/doctype/campaign_item/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/erpnext/accounts/doctype/campaign_item/__init__.py
diff --git a/erpnext/accounts/doctype/campaign_item/campaign_item.json b/erpnext/accounts/doctype/campaign_item/campaign_item.json
new file mode 100644
index 0000000..69383a4
--- /dev/null
+++ b/erpnext/accounts/doctype/campaign_item/campaign_item.json
@@ -0,0 +1,31 @@
+{
+ "actions": [],
+ "creation": "2021-05-06 16:18:25.410476",
+ "doctype": "DocType",
+ "editable_grid": 1,
+ "engine": "InnoDB",
+ "field_order": [
+  "campaign"
+ ],
+ "fields": [
+  {
+   "fieldname": "campaign",
+   "fieldtype": "Link",
+   "in_list_view": 1,
+   "label": "Campaign",
+   "options": "Campaign"
+  }
+ ],
+ "index_web_pages_for_search": 1,
+ "istable": 1,
+ "links": [],
+ "modified": "2021-05-07 10:43:49.717633",
+ "modified_by": "Administrator",
+ "module": "Accounts",
+ "name": "Campaign Item",
+ "owner": "Administrator",
+ "permissions": [],
+ "sort_field": "modified",
+ "sort_order": "DESC",
+ "track_changes": 1
+}
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/campaign_item/campaign_item.py b/erpnext/accounts/doctype/campaign_item/campaign_item.py
new file mode 100644
index 0000000..4f5fd7f
--- /dev/null
+++ b/erpnext/accounts/doctype/campaign_item/campaign_item.py
@@ -0,0 +1,8 @@
+# Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and contributors
+# For license information, please see license.txt
+
+# import frappe
+from frappe.model.document import Document
+
+class CampaignItem(Document):
+	pass
diff --git a/erpnext/accounts/doctype/coupon_code/test_coupon_code.py b/erpnext/accounts/doctype/coupon_code/test_coupon_code.py
index 622bd33..5af12cd 100644
--- a/erpnext/accounts/doctype/coupon_code/test_coupon_code.py
+++ b/erpnext/accounts/doctype/coupon_code/test_coupon_code.py
@@ -57,7 +57,7 @@
 		})
 		item_price.insert()
 	# create test item pricing rule
-	if not frappe.db.exists("Pricing Rule","_Test Pricing Rule for _Test Item"):
+	if not frappe.db.exists("Pricing Rule", {"title": "_Test Pricing Rule for _Test Item"}):
 		item_pricing_rule = frappe.get_doc({
 		"doctype": "Pricing Rule",
 		"title": "_Test Pricing Rule for _Test Item",
@@ -86,14 +86,15 @@
 		sales_partner.insert()
 	# create test item coupon code
 	if not frappe.db.exists("Coupon Code", "SAVE30"):
+		pricing_rule = frappe.db.get_value("Pricing Rule", {"title": "_Test Pricing Rule for _Test Item"}, ['name'])
 		coupon_code = frappe.get_doc({
-		"doctype": "Coupon Code",
-		"coupon_name":"SAVE30",
-		"coupon_code":"SAVE30",
-		"pricing_rule": "_Test Pricing Rule for _Test Item",
-		"valid_from": "2014-01-01",
-		"maximum_use":1,
-		"used":0
+			"doctype": "Coupon Code",
+			"coupon_name":"SAVE30",
+			"coupon_code":"SAVE30",
+			"pricing_rule": pricing_rule,
+			"valid_from": "2014-01-01",
+			"maximum_use":1,
+			"used":0
 		})
 		coupon_code.insert()
 
@@ -102,7 +103,7 @@
 		test_create_test_data()
 
 	def tearDown(self):
-		frappe.set_user("Administrator")		
+		frappe.set_user("Administrator")
 
 	def test_sales_order_with_coupon_code(self):
 		frappe.db.set_value("Coupon Code", "SAVE30", "used", 0)
diff --git a/erpnext/accounts/doctype/customer_group_item/__init__.py b/erpnext/accounts/doctype/customer_group_item/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/erpnext/accounts/doctype/customer_group_item/__init__.py
diff --git a/erpnext/accounts/doctype/customer_group_item/customer_group_item.json b/erpnext/accounts/doctype/customer_group_item/customer_group_item.json
new file mode 100644
index 0000000..bd1229d
--- /dev/null
+++ b/erpnext/accounts/doctype/customer_group_item/customer_group_item.json
@@ -0,0 +1,31 @@
+{
+ "actions": [],
+ "creation": "2021-05-06 16:12:42.558878",
+ "doctype": "DocType",
+ "editable_grid": 1,
+ "engine": "InnoDB",
+ "field_order": [
+  "customer_group"
+ ],
+ "fields": [
+  {
+   "fieldname": "customer_group",
+   "fieldtype": "Link",
+   "in_list_view": 1,
+   "label": "Customer Group",
+   "options": "Customer Group"
+  }
+ ],
+ "index_web_pages_for_search": 1,
+ "istable": 1,
+ "links": [],
+ "modified": "2021-05-07 10:39:21.563506",
+ "modified_by": "Administrator",
+ "module": "Accounts",
+ "name": "Customer Group Item",
+ "owner": "Administrator",
+ "permissions": [],
+ "sort_field": "modified",
+ "sort_order": "DESC",
+ "track_changes": 1
+}
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/customer_group_item/customer_group_item.py b/erpnext/accounts/doctype/customer_group_item/customer_group_item.py
new file mode 100644
index 0000000..df782ac
--- /dev/null
+++ b/erpnext/accounts/doctype/customer_group_item/customer_group_item.py
@@ -0,0 +1,8 @@
+# Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and contributors
+# For license information, please see license.txt
+
+# import frappe
+from frappe.model.document import Document
+
+class CustomerGroupItem(Document):
+	pass
diff --git a/erpnext/accounts/doctype/customer_item/__init__.py b/erpnext/accounts/doctype/customer_item/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/erpnext/accounts/doctype/customer_item/__init__.py
diff --git a/erpnext/accounts/doctype/customer_item/customer_item.json b/erpnext/accounts/doctype/customer_item/customer_item.json
new file mode 100644
index 0000000..f3dac02
--- /dev/null
+++ b/erpnext/accounts/doctype/customer_item/customer_item.json
@@ -0,0 +1,31 @@
+{
+ "actions": [],
+ "creation": "2021-05-05 14:04:54.266353",
+ "doctype": "DocType",
+ "editable_grid": 1,
+ "engine": "InnoDB",
+ "field_order": [
+  "customer"
+ ],
+ "fields": [
+  {
+   "fieldname": "customer",
+   "fieldtype": "Link",
+   "in_list_view": 1,
+   "label": "Customer ",
+   "options": "Customer"
+  }
+ ],
+ "index_web_pages_for_search": 1,
+ "istable": 1,
+ "links": [],
+ "modified": "2021-05-06 10:02:32.967841",
+ "modified_by": "Administrator",
+ "module": "Accounts",
+ "name": "Customer Item",
+ "owner": "Administrator",
+ "permissions": [],
+ "sort_field": "modified",
+ "sort_order": "DESC",
+ "track_changes": 1
+}
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/customer_item/customer_item.py b/erpnext/accounts/doctype/customer_item/customer_item.py
new file mode 100644
index 0000000..a577145
--- /dev/null
+++ b/erpnext/accounts/doctype/customer_item/customer_item.py
@@ -0,0 +1,8 @@
+# Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and contributors
+# For license information, please see license.txt
+
+# import frappe
+from frappe.model.document import Document
+
+class CustomerItem(Document):
+	pass
diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.py b/erpnext/accounts/doctype/payment_entry/payment_entry.py
index 46904f7..831b270 100644
--- a/erpnext/accounts/doctype/payment_entry/payment_entry.py
+++ b/erpnext/accounts/doctype/payment_entry/payment_entry.py
@@ -529,7 +529,7 @@
 			if self.payment_type == "Receive" \
 				and self.base_total_allocated_amount < self.base_received_amount + total_deductions \
 				and self.total_allocated_amount < self.paid_amount + (total_deductions / self.source_exchange_rate):
-				self.unallocated_amount = (self.received_amount + total_deductions -
+				self.unallocated_amount = (self.base_received_amount + total_deductions -
 					self.base_total_allocated_amount) / self.source_exchange_rate
 				self.unallocated_amount -= included_taxes
 			elif self.payment_type == "Pay" \
diff --git a/erpnext/accounts/doctype/payment_entry/test_payment_entry.py b/erpnext/accounts/doctype/payment_entry/test_payment_entry.py
index d1302f5..801dadc 100644
--- a/erpnext/accounts/doctype/payment_entry/test_payment_entry.py
+++ b/erpnext/accounts/doctype/payment_entry/test_payment_entry.py
@@ -295,6 +295,34 @@
 		outstanding_amount = flt(frappe.db.get_value("Sales Invoice", si.name, "outstanding_amount"))
 		self.assertEqual(outstanding_amount, 80)
 
+	def test_payment_entry_against_si_usd_to_usd_with_deduction_in_base_currency (self):
+		si = create_sales_invoice(customer="_Test Customer USD", debit_to="_Test Receivable USD - _TC",
+			currency="USD", conversion_rate=50, do_not_save=1)
+
+		si.plc_conversion_rate = 50
+		si.save()
+		si.submit()
+
+		pe = get_payment_entry("Sales Invoice", si.name, party_amount=20,
+			bank_account="_Test Bank USD - _TC", bank_amount=900)
+
+		pe.source_exchange_rate = 45.263
+		pe.target_exchange_rate = 45.263
+		pe.reference_no = "1"
+		pe.reference_date = "2016-01-01"
+
+
+		pe.append("deductions", {
+			"account": "_Test Exchange Gain/Loss - _TC",
+			"cost_center": "_Test Cost Center - _TC",
+			"amount": 94.80
+		})
+
+		pe.save()
+
+		self.assertEqual(flt(pe.difference_amount, 2), 0.0)
+		self.assertEqual(flt(pe.unallocated_amount, 2), 0.0)
+
 	def test_payment_entry_retrieves_last_exchange_rate(self):
 		from erpnext.setup.doctype.currency_exchange.test_currency_exchange import test_records, save_new_records
 
diff --git a/erpnext/accounts/doctype/pricing_rule/pricing_rule.json b/erpnext/accounts/doctype/pricing_rule/pricing_rule.json
index 0be41b4..99c5b34 100644
--- a/erpnext/accounts/doctype/pricing_rule/pricing_rule.json
+++ b/erpnext/accounts/doctype/pricing_rule/pricing_rule.json
@@ -2,12 +2,13 @@
  "actions": [],
  "allow_import": 1,
  "allow_rename": 1,
- "autoname": "field:title",
+ "autoname": "naming_series:",
  "creation": "2014-02-21 15:02:51",
  "doctype": "DocType",
  "engine": "InnoDB",
  "field_order": [
   "applicability_section",
+  "naming_series",
   "title",
   "disable",
   "apply_on",
@@ -95,8 +96,7 @@
    "fieldtype": "Data",
    "label": "Title",
    "no_copy": 1,
-   "reqd": 1,
-   "unique": 1
+   "reqd": 1
   },
   {
    "default": "0",
@@ -571,6 +571,13 @@
    "fieldname": "is_recursive",
    "fieldtype": "Check",
    "label": "Is Recursive"
+  },
+  {
+   "default": "PRLE-.####",
+   "fieldname": "naming_series",
+   "fieldtype": "Select",
+   "label": "Naming Series",
+   "options": "PRLE-.####"
   }
  ],
  "icon": "fa fa-gift",
@@ -634,5 +641,6 @@
  ],
  "show_name_in_global_search": 1,
  "sort_field": "modified",
- "sort_order": "DESC"
-}
\ No newline at end of file
+ "sort_order": "DESC",
+ "title_field": "title"
+}
diff --git a/erpnext/accounts/doctype/promotional_scheme/promotional_scheme.json b/erpnext/accounts/doctype/promotional_scheme/promotional_scheme.json
index cc71324..1d68b23 100644
--- a/erpnext/accounts/doctype/promotional_scheme/promotional_scheme.json
+++ b/erpnext/accounts/doctype/promotional_scheme/promotional_scheme.json
@@ -1,1381 +1,339 @@
 {
- "allow_copy": 0,
- "allow_events_in_timeline": 0,
- "allow_guest_to_view": 0,
+ "actions": [],
  "allow_import": 1,
  "allow_rename": 1,
  "autoname": "Prompt",
- "beta": 0,
  "creation": "2019-02-08 17:10:36.077402",
- "custom": 0,
- "docstatus": 0,
  "doctype": "DocType",
- "document_type": "",
  "editable_grid": 1,
  "engine": "InnoDB",
+ "field_order": [
+  "section_break_1",
+  "apply_on",
+  "disable",
+  "column_break_3",
+  "items",
+  "item_groups",
+  "brands",
+  "mixed_conditions",
+  "is_cumulative",
+  "section_break_10",
+  "apply_rule_on_other",
+  "column_break_11",
+  "other_item_code",
+  "other_item_group",
+  "other_brand",
+  "section_break_8",
+  "selling",
+  "buying",
+  "column_break_12",
+  "applicable_for",
+  "customer",
+  "customer_group",
+  "territory",
+  "sales_partner",
+  "campaign",
+  "supplier",
+  "supplier_group",
+  "period_settings_section",
+  "valid_from",
+  "valid_upto",
+  "column_break_26",
+  "company",
+  "currency",
+  "section_break_14",
+  "price_discount_slabs",
+  "section_break_15",
+  "product_discount_slabs"
+ ],
  "fields": [
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "fetch_if_empty": 0,
    "fieldname": "section_break_1",
-   "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
+   "fieldtype": "Section Break"
   },
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
    "default": "Item Code",
-   "fetch_if_empty": 0,
    "fieldname": "apply_on",
    "fieldtype": "Select",
-   "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": "Apply On",
-   "length": 0,
-   "no_copy": 0,
    "options": "\nItem Code\nItem Group\nBrand\nTransaction",
-   "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
+   "reqd": 1
   },
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "fetch_if_empty": 0,
+   "default": "0",
    "fieldname": "disable",
    "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",
-   "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
+   "label": "Disable"
   },
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "depends_on": "",
-   "fetch_if_empty": 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
+   "fieldtype": "Column Break"
   },
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
    "depends_on": "eval:doc.apply_on == 'Item Code'",
-   "fetch_if_empty": 0,
    "fieldname": "items",
    "fieldtype": "Table",
-   "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": "Pricing Rule Item Code",
-   "length": 0,
-   "no_copy": 0,
-   "options": "Pricing Rule Item Code",
-   "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
+   "options": "Pricing Rule Item Code"
   },
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
    "depends_on": "eval:doc.apply_on == 'Item Group'",
-   "fetch_if_empty": 0,
    "fieldname": "item_groups",
    "fieldtype": "Table",
-   "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": "Pricing Rule Item Group",
-   "length": 0,
-   "no_copy": 0,
-   "options": "Pricing Rule Item Group",
-   "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
+   "options": "Pricing Rule Item Group"
   },
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
    "depends_on": "eval:doc.apply_on == 'Brand'",
-   "fetch_if_empty": 0,
    "fieldname": "brands",
    "fieldtype": "Table",
-   "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": "Pricing Rule Brand",
-   "length": 0,
-   "no_copy": 0,
-   "options": "Pricing Rule Brand",
-   "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
+   "options": "Pricing Rule Brand"
   },
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "fetch_if_empty": 0,
+   "default": "0",
    "fieldname": "mixed_conditions",
    "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": "Mixed 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
+   "label": "Mixed Conditions"
   },
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "fetch_if_empty": 0,
+   "default": "0",
    "fieldname": "is_cumulative",
    "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": "Is Cumulative",
-   "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
+   "label": "Is Cumulative"
   },
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
    "collapsible": 1,
-   "columns": 0,
-   "fetch_if_empty": 0,
    "fieldname": "section_break_10",
    "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": "Discount on Other Item",
-   "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
+   "label": "Discount on Other Item"
   },
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "depends_on": "",
-   "fetch_if_empty": 0,
    "fieldname": "apply_rule_on_other",
    "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": "Apply Rule On Other",
-   "length": 0,
-   "no_copy": 0,
-   "options": "\nItem Code\nItem Group\nBrand",
-   "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
+   "options": "\nItem Code\nItem Group\nBrand"
   },
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "depends_on": "",
-   "fetch_if_empty": 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
+   "fieldtype": "Column Break"
   },
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
    "depends_on": "eval:doc.apply_rule_on_other == 'Item Code'",
-   "fetch_if_empty": 0,
    "fieldname": "other_item_code",
    "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": "Item Code",
-   "length": 0,
-   "no_copy": 0,
-   "options": "Item",
-   "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
+   "options": "Item"
   },
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
    "depends_on": "eval:doc.apply_rule_on_other == 'Item Group'",
-   "fetch_if_empty": 0,
    "fieldname": "other_item_group",
    "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": "Item Group",
-   "length": 0,
-   "no_copy": 0,
-   "options": "Item Group",
-   "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
+   "options": "Item Group"
   },
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
    "depends_on": "eval:doc.apply_rule_on_other == 'Brand'",
-   "fetch_if_empty": 0,
    "fieldname": "other_brand",
    "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": "Brand",
-   "length": 0,
-   "no_copy": 0,
-   "options": "Brand",
-   "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
+   "options": "Brand"
   },
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
    "collapsible": 1,
-   "columns": 0,
-   "depends_on": "",
-   "fetch_if_empty": 0,
    "fieldname": "section_break_8",
    "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": "Party Information",
-   "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
+   "label": "Party Information"
   },
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "fetch_if_empty": 0,
+   "default": "0",
    "fieldname": "selling",
    "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": "Selling",
-   "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
+   "label": "Selling"
   },
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "fetch_if_empty": 0,
+   "default": "0",
    "fieldname": "buying",
    "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": "Buying",
-   "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
+   "label": "Buying"
   },
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "depends_on": "",
-   "fetch_if_empty": 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
+   "fieldtype": "Column Break"
   },
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
    "depends_on": "eval: doc.buying || doc.selling",
-   "fetch_if_empty": 0,
    "fieldname": "applicable_for",
    "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": "Applicable For",
-   "length": 0,
-   "no_copy": 0,
-   "options": "\nCustomer\nCustomer Group\nTerritory\nSales Partner\nCampaign\nSupplier\nSupplier Group",
-   "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
+   "options": "\nCustomer\nCustomer Group\nTerritory\nSales Partner\nCampaign\nSupplier\nSupplier Group"
   },
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
    "depends_on": "eval:doc.applicable_for=='Customer'",
-   "fetch_if_empty": 0,
    "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,
+   "fieldtype": "Table MultiSelect",
    "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
+   "options": "Customer Item"
   },
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
    "depends_on": "eval:doc.applicable_for==\"Customer Group\"",
-   "fetch_if_empty": 0,
    "fieldname": "customer_group",
-   "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,
+   "fieldtype": "Table MultiSelect",
    "label": "Customer Group",
-   "length": 0,
-   "no_copy": 0,
-   "options": "Customer Group",
-   "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
+   "options": "Customer Group Item"
   },
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
    "depends_on": "eval:doc.applicable_for==\"Territory\"",
-   "fetch_if_empty": 0,
    "fieldname": "territory",
-   "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,
+   "fieldtype": "Table MultiSelect",
    "label": "Territory",
-   "length": 0,
-   "no_copy": 0,
-   "options": "Territory",
-   "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
+   "options": "Territory Item"
   },
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
    "depends_on": "eval:doc.applicable_for==\"Sales Partner\"",
-   "fetch_if_empty": 0,
    "fieldname": "sales_partner",
-   "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,
+   "fieldtype": "Table MultiSelect",
    "label": "Sales Partner",
-   "length": 0,
-   "no_copy": 0,
-   "options": "Sales Partner",
-   "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
+   "options": "Sales Partner Item"
   },
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
    "depends_on": "eval:doc.applicable_for==\"Campaign\"",
-   "fetch_if_empty": 0,
    "fieldname": "campaign",
-   "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,
+   "fieldtype": "Table MultiSelect",
    "label": "Campaign",
-   "length": 0,
-   "no_copy": 0,
-   "options": "Campaign",
-   "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
+   "options": "Campaign Item"
   },
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
    "depends_on": "eval:doc.applicable_for=='Supplier'",
-   "fetch_if_empty": 0,
    "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,
+   "fieldtype": "Table MultiSelect",
    "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
+   "options": "Supplier Item"
   },
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
    "depends_on": "eval:doc.applicable_for==\"Supplier Group\"",
-   "fetch_if_empty": 0,
    "fieldname": "supplier_group",
-   "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,
+   "fieldtype": "Table MultiSelect",
    "label": "Supplier Group",
-   "length": 0,
-   "no_copy": 0,
-   "options": "Supplier Group",
-   "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
+   "options": "Supplier Group Item"
   },
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "fetch_if_empty": 0,
    "fieldname": "period_settings_section",
    "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": "Period Settings",
-   "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
+   "label": "Period Settings"
   },
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
    "default": "Today",
-   "fetch_if_empty": 0,
    "fieldname": "valid_from",
    "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": "Valid From",
-   "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
+   "label": "Valid From"
   },
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "fetch_if_empty": 0,
    "fieldname": "valid_upto",
    "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": "Valid Upto",
-   "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
+   "label": "Valid Upto"
   },
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "fetch_if_empty": 0,
    "fieldname": "column_break_26",
-   "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
+   "fieldtype": "Column Break"
   },
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "fetch_if_empty": 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": 0,
    "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
+   "reqd": 1
   },
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "fetch_if_empty": 0,
    "fieldname": "currency",
    "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": "Currency",
-   "length": 0,
-   "no_copy": 0,
-   "options": "Currency",
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
-   "translatable": 0,
-   "unique": 0
+   "options": "Currency"
   },
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "depends_on": "",
-   "fetch_if_empty": 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": "Price Discount Slabs",
-   "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
+   "label": "Price Discount Slabs"
   },
   {
    "allow_bulk_edit": 1,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "fetch_if_empty": 0,
    "fieldname": "price_discount_slabs",
    "fieldtype": "Table",
-   "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": "Promotional Scheme Price Discount",
-   "length": 0,
-   "no_copy": 0,
-   "options": "Promotional Scheme Price Discount",
-   "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
+   "options": "Promotional Scheme Price Discount"
   },
   {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "depends_on": "",
-   "fetch_if_empty": 0,
    "fieldname": "section_break_15",
    "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": "Product Discount Slabs",
-   "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
+   "label": "Product Discount Slabs"
   },
   {
    "allow_bulk_edit": 1,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "fetch_if_empty": 0,
    "fieldname": "product_discount_slabs",
    "fieldtype": "Table",
-   "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": "Promotional Scheme Product Discount",
-   "length": 0,
-   "no_copy": 0,
-   "options": "Promotional Scheme Product Discount",
-   "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
+   "options": "Promotional Scheme Product Discount"
   }
  ],
- "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": "2019-03-25 12:14:27.486586",
+ "links": [],
+ "modified": "2021-05-06 16:20:22.039078",
  "modified_by": "Administrator",
  "module": "Accounts",
  "name": "Promotional Scheme",
- "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": "System 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 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": "Sales 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,
- "show_name_in_global_search": 0,
  "sort_field": "modified",
  "sort_order": "DESC",
- "track_changes": 1,
- "track_seen": 0,
- "track_views": 0
+ "track_changes": 1
 }
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/promotional_scheme/promotional_scheme.py b/erpnext/accounts/doctype/promotional_scheme/promotional_scheme.py
index 7d93023..3d7a891 100644
--- a/erpnext/accounts/doctype/promotional_scheme/promotional_scheme.py
+++ b/erpnext/accounts/doctype/promotional_scheme/promotional_scheme.py
@@ -25,22 +25,31 @@
 
 class PromotionalScheme(Document):
 	def validate(self):
+		if not self.selling and not self.buying:
+			frappe.throw(_("Either 'Selling' or 'Buying' must be selected"), title=_("Mandatory"))
 		if not (self.price_discount_slabs
 			or self.product_discount_slabs):
 			frappe.throw(_("Price or product discount slabs are required"))
 
 	def on_update(self):
-		data = frappe.get_all('Pricing Rule', fields = ["promotional_scheme_id", "name"],
-			filters = {'promotional_scheme': self.name}) or {}
+		pricing_rules = frappe.get_all(
+			'Pricing Rule',
+			fields = ["promotional_scheme_id", "name", "creation"],
+			filters = {
+				'promotional_scheme': self.name,
+				'applicable_for': self.applicable_for
+			},
+			order_by = 'creation asc',
+		) or {}
+		self.update_pricing_rules(pricing_rules)
 
-		self.update_pricing_rules(data)
-
-	def update_pricing_rules(self, data):
+	def update_pricing_rules(self, pricing_rules):
 		rules = {}
 		count = 0
-
-		for d in data:
-			rules[d.get('promotional_scheme_id')] = d.get('name')
+		names = []
+		for rule in pricing_rules:
+			names.append(rule.name)
+			rules[rule.get('promotional_scheme_id')] = names
 
 		docs = get_pricing_rules(self, rules)
 
@@ -57,9 +66,9 @@
 			frappe.msgprint(_("New {0} pricing rules are created").format(count))
 
 	def on_trash(self):
-		for d in frappe.get_all('Pricing Rule',
+		for rule in frappe.get_all('Pricing Rule',
 			{'promotional_scheme': self.name}):
-			frappe.delete_doc('Pricing Rule', d.name)
+			frappe.delete_doc('Pricing Rule', rule.name)
 
 def get_pricing_rules(doc, rules = {}):
 	new_doc = []
@@ -73,42 +82,80 @@
 def _get_pricing_rules(doc, child_doc, discount_fields, rules = {}):
 	new_doc = []
 	args = get_args_for_pricing_rule(doc)
-	for d in doc.get(child_doc):
+	applicable_for = frappe.scrub(doc.get('applicable_for'))
+	for idx, d in enumerate(doc.get(child_doc)):
 		if d.name in rules:
-			pr = frappe.get_doc('Pricing Rule', rules.get(d.name))
+			for applicable_for_value in args.get(applicable_for):
+				temp_args = args.copy()
+				docname = frappe.get_all(
+					'Pricing Rule',
+					fields = ["promotional_scheme_id", "name", applicable_for],
+					filters = {
+						'promotional_scheme_id': d.name,
+						applicable_for: applicable_for_value
+					}
+				)
+
+				if docname:
+					pr = frappe.get_doc('Pricing Rule', docname[0].get('name'))
+					temp_args[applicable_for] = applicable_for_value
+					pr = set_args(temp_args, pr, doc, child_doc, discount_fields, d)
+				else:
+					pr = frappe.new_doc("Pricing Rule")
+					pr.title = doc.name
+					temp_args[applicable_for] = applicable_for_value
+					pr = set_args(temp_args, pr, doc, child_doc, discount_fields, d)
+
+				new_doc.append(pr)
+
 		else:
-			pr = frappe.new_doc("Pricing Rule")
-			pr.title = make_autoname("{0}/.####".format(doc.name))
-
-		pr.update(args)
-		for field in (other_fields + discount_fields):
-			pr.set(field, d.get(field))
-
-		pr.promotional_scheme_id = d.name
-		pr.promotional_scheme = doc.name
-		pr.disable = d.disable if d.disable else doc.disable
-		pr.price_or_product_discount = ('Price'
-			if child_doc == 'price_discount_slabs' else 'Product')
-
-		for field in ['items', 'item_groups', 'brands']:
-			if doc.get(field):
-				pr.set(field, [])
-
-			apply_on = frappe.scrub(doc.get('apply_on'))
-			for d in doc.get(field):
-				pr.append(field, {
-					apply_on: d.get(apply_on),
-					'uom': d.uom
-				})
-
-		new_doc.append(pr)
+			applicable_for_values = args.get(applicable_for) or []
+			for applicable_for_value in applicable_for_values:
+				pr = frappe.new_doc("Pricing Rule")
+				pr.title = doc.name
+				temp_args = args.copy()
+				temp_args[applicable_for] = applicable_for_value
+				pr = set_args(temp_args, pr, doc, child_doc, discount_fields, d)
+				new_doc.append(pr)
 
 	return new_doc
 
+
+
+
+def set_args(args, pr, doc, child_doc, discount_fields, child_doc_fields):
+	pr.update(args)
+	for field in (other_fields + discount_fields):
+		pr.set(field, child_doc_fields.get(field))
+
+	pr.promotional_scheme_id = child_doc_fields.name
+	pr.promotional_scheme = doc.name
+	pr.disable = child_doc_fields.disable if child_doc_fields.disable else doc.disable
+	pr.price_or_product_discount = ('Price'
+		if child_doc == 'price_discount_slabs' else 'Product')
+
+	for field in ['items', 'item_groups', 'brands']:
+		if doc.get(field):
+			pr.set(field, [])
+
+		apply_on = frappe.scrub(doc.get('apply_on'))
+		for d in doc.get(field):
+			pr.append(field, {
+				apply_on: d.get(apply_on),
+				'uom': d.uom
+			})
+	return pr
+
 def get_args_for_pricing_rule(doc):
 	args = { 'promotional_scheme': doc.name }
+	applicable_for = frappe.scrub(doc.get('applicable_for'))
 
 	for d in pricing_rule_fields:
-		args[d] = doc.get(d)
-
+		if d == applicable_for:
+			items = []
+			for applicable_for_values in doc.get(applicable_for):
+				items.append(applicable_for_values.get(applicable_for))
+			args[d] = items
+		else:
+			args[d] = doc.get(d)
 	return args
diff --git a/erpnext/accounts/doctype/promotional_scheme/test_promotional_scheme.py b/erpnext/accounts/doctype/promotional_scheme/test_promotional_scheme.py
index 8dc0499..7354ef0 100644
--- a/erpnext/accounts/doctype/promotional_scheme/test_promotional_scheme.py
+++ b/erpnext/accounts/doctype/promotional_scheme/test_promotional_scheme.py
@@ -7,4 +7,54 @@
 import unittest
 
 class TestPromotionalScheme(unittest.TestCase):
-	pass
+	def test_promotional_scheme(self):
+		ps = make_promotional_scheme()
+		price_rules = frappe.get_all('Pricing Rule', fields = ["promotional_scheme_id", "name", "creation"],
+			filters = {'promotional_scheme': ps.name})
+		self.assertTrue(len(price_rules),1) 
+		price_doc_details = frappe.db.get_value('Pricing Rule', price_rules[0].name, ['customer', 'min_qty', 'discount_percentage'], as_dict = 1)
+		self.assertTrue(price_doc_details.customer, '_Test Customer')
+		self.assertTrue(price_doc_details.min_qty, 4)
+		self.assertTrue(price_doc_details.discount_percentage, 20)
+
+		ps.price_discount_slabs[0].min_qty = 6
+		ps.append('customer', {  
+			'customer': "_Test Customer 2"})
+		ps.save()
+		price_rules = frappe.get_all('Pricing Rule', fields = ["promotional_scheme_id", "name"],
+			filters = {'promotional_scheme': ps.name})
+		self.assertTrue(len(price_rules), 2) 
+
+		price_doc_details = frappe.db.get_value('Pricing Rule', price_rules[1].name, ['customer', 'min_qty', 'discount_percentage'], as_dict = 1)
+		self.assertTrue(price_doc_details.customer, '_Test Customer 2')
+		self.assertTrue(price_doc_details.min_qty, 6)
+		self.assertTrue(price_doc_details.discount_percentage, 20)
+		
+		price_doc_details = frappe.db.get_value('Pricing Rule', price_rules[0].name, ['customer', 'min_qty', 'discount_percentage'], as_dict = 1)
+		self.assertTrue(price_doc_details.customer, '_Test Customer')
+		self.assertTrue(price_doc_details.min_qty, 6)
+
+		frappe.delete_doc('Promotional Scheme', ps.name)
+		price_rules = frappe.get_all('Pricing Rule', fields = ["promotional_scheme_id", "name"],
+			filters = {'promotional_scheme': ps.name})
+		self.assertEqual(price_rules, [])
+		
+def make_promotional_scheme():
+	ps = frappe.new_doc('Promotional Scheme')
+	ps.name = '_Test Scheme'
+	ps.append('items',{
+		'item_code': '_Test Item'
+	})
+	ps.selling = 1
+	ps.append('price_discount_slabs',{
+		'min_qty': 4,
+		'discount_percentage': 20,
+		'rule_description': 'Test'
+	})
+	ps.applicable_for = 'Customer'
+	ps.append('customer',{
+		'customer': "_Test Customer"
+	})
+	ps.save()
+
+	return ps
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
index bda9f41..3b91118 100644
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
@@ -283,7 +283,8 @@
 				party: this.frm.doc.supplier,
 				party_type: "Supplier",
 				account: this.frm.doc.credit_to,
-				price_list: this.frm.doc.buying_price_list
+				price_list: this.frm.doc.buying_price_list,
+				fetch_payment_terms_template: cint(!this.frm.doc.ignore_default_payment_terms_template)
 			}, function() {
 				me.apply_pricing_rule();
 				me.frm.doc.apply_tds = me.frm.supplier_tds ? 1 : 0;
@@ -365,7 +366,7 @@
 	items_add(doc, cdt, cdn) {
 		var row = frappe.get_doc(cdt, cdn);
 		this.frm.script_manager.copy_from_first_row("items", row,
-			["expense_account", "cost_center", "project"]);
+			["expense_account", "discount_account", "cost_center", "project"]);
 	}
 
 	on_submit() {
@@ -499,6 +500,16 @@
 			'Payment Entry': 'Payment'
 		}
 
+		frm.set_query("additional_discount_account", function() {
+			return {
+				filters: {
+					company: frm.doc.company,
+					is_group: 0,
+					report_type: "Profit and Loss",
+				}
+			};
+		});
+
 		frm.fields_dict['items'].grid.get_field('deferred_expense_account').get_query = function(doc) {
 			return {
 				filters: {
@@ -508,6 +519,16 @@
 				}
 			}
 		}
+
+		frm.fields_dict['items'].grid.get_field('discount_account').get_query = function(doc) {
+			return {
+				filters: {
+					'report_type': 'Profit and Loss',
+					'company': doc.company,
+					"is_group": 0
+				}
+			}
+		}
 	},
 
 	refresh: function(frm) {
@@ -570,4 +591,4 @@
 	company: function(frm) {
 		erpnext.accounts.dimensions.update_dimension(frm, frm.doctype);
 	},
-})
+})
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json
index 00ef7d5..7025dd9 100644
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json
@@ -96,6 +96,7 @@
   "section_break_44",
   "apply_discount_on",
   "base_discount_amount",
+  "additional_discount_account",
   "column_break_46",
   "additional_discount_percentage",
   "discount_amount",
@@ -131,6 +132,7 @@
   "advances",
   "payment_schedule_section",
   "payment_terms_template",
+  "ignore_default_payment_terms_template",
   "payment_schedule",
   "terms_section_break",
   "tc_name",
@@ -175,7 +177,9 @@
    "hidden": 1,
    "label": "Title",
    "no_copy": 1,
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "naming_series",
@@ -187,7 +191,9 @@
    "options": "ACC-PINV-.YYYY.-\nACC-PINV-RET-.YYYY.-",
    "print_hide": 1,
    "reqd": 1,
-   "set_only_once": 1
+   "set_only_once": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "supplier",
@@ -199,7 +205,9 @@
    "options": "Supplier",
    "print_hide": 1,
    "reqd": 1,
-   "search_index": 1
+   "search_index": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "bold": 1,
@@ -211,7 +219,9 @@
    "label": "Supplier Name",
    "oldfieldname": "supplier_name",
    "oldfieldtype": "Data",
-   "read_only": 1
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fetch_from": "supplier.tax_id",
@@ -219,21 +229,27 @@
    "fieldtype": "Read Only",
    "label": "Tax Id",
    "print_hide": 1,
-   "read_only": 1
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "due_date",
    "fieldtype": "Date",
    "label": "Due Date",
    "oldfieldname": "due_date",
-   "oldfieldtype": "Date"
+   "oldfieldtype": "Date",
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "default": "0",
    "fieldname": "is_paid",
    "fieldtype": "Check",
    "label": "Is Paid",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "default": "0",
@@ -241,19 +257,25 @@
    "fieldtype": "Check",
    "label": "Is Return (Debit Note)",
    "no_copy": 1,
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "default": "0",
    "fieldname": "apply_tds",
    "fieldtype": "Check",
    "label": "Apply Tax Withholding Amount",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "column_break1",
    "fieldtype": "Column Break",
    "oldfieldtype": "Column Break",
+   "show_days": 1,
+   "show_seconds": 1,
    "width": "50%"
   },
   {
@@ -263,13 +285,17 @@
    "label": "Company",
    "options": "Company",
    "print_hide": 1,
-   "remember_last_selected_value": 1
+   "remember_last_selected_value": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "cost_center",
    "fieldtype": "Link",
    "label": "Cost Center",
-   "options": "Cost Center"
+   "options": "Cost Center",
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "default": "Today",
@@ -281,7 +307,9 @@
    "oldfieldtype": "Date",
    "print_hide": 1,
    "reqd": 1,
-   "search_index": 1
+   "search_index": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "posting_time",
@@ -290,6 +318,8 @@
    "no_copy": 1,
    "print_hide": 1,
    "print_width": "100px",
+   "show_days": 1,
+   "show_seconds": 1,
    "width": "100px"
   },
   {
@@ -298,7 +328,9 @@
    "fieldname": "set_posting_time",
    "fieldtype": "Check",
    "label": "Edit Posting Date and Time",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "amended_from",
@@ -310,44 +342,58 @@
    "oldfieldtype": "Link",
    "options": "Purchase Invoice",
    "print_hide": 1,
-   "read_only": 1
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "collapsible": 1,
    "collapsible_depends_on": "eval:doc.on_hold",
    "fieldname": "sb_14",
    "fieldtype": "Section Break",
-   "label": "Hold Invoice"
+   "label": "Hold Invoice",
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "default": "0",
    "fieldname": "on_hold",
    "fieldtype": "Check",
-   "label": "Hold Invoice"
+   "label": "Hold Invoice",
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "depends_on": "eval:doc.on_hold",
    "description": "Once set, this invoice will be on hold till the set date",
    "fieldname": "release_date",
    "fieldtype": "Date",
-   "label": "Release Date"
+   "label": "Release Date",
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "cb_17",
-   "fieldtype": "Column Break"
+   "fieldtype": "Column Break",
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "depends_on": "eval:doc.on_hold",
    "fieldname": "hold_comment",
    "fieldtype": "Small Text",
-   "label": "Reason For Putting On Hold"
+   "label": "Reason For Putting On Hold",
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "collapsible": 1,
    "collapsible_depends_on": "bill_no",
    "fieldname": "supplier_invoice_details",
    "fieldtype": "Section Break",
-   "label": "Supplier Invoice Details"
+   "label": "Supplier Invoice Details",
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "bill_no",
@@ -355,11 +401,15 @@
    "label": "Supplier Invoice No",
    "oldfieldname": "bill_no",
    "oldfieldtype": "Data",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "column_break_15",
-   "fieldtype": "Column Break"
+   "fieldtype": "Column Break",
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "bill_date",
@@ -368,13 +418,17 @@
    "no_copy": 1,
    "oldfieldname": "bill_date",
    "oldfieldtype": "Date",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "depends_on": "return_against",
    "fieldname": "returns",
    "fieldtype": "Section Break",
-   "label": "Returns"
+   "label": "Returns",
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "depends_on": "return_against",
@@ -384,26 +438,34 @@
    "no_copy": 1,
    "options": "Purchase Invoice",
    "print_hide": 1,
-   "read_only": 1
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "collapsible": 1,
    "fieldname": "section_addresses",
    "fieldtype": "Section Break",
-   "label": "Address and Contact"
+   "label": "Address and Contact",
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "supplier_address",
    "fieldtype": "Link",
    "label": "Select Supplier Address",
    "options": "Address",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "address_display",
    "fieldtype": "Small Text",
    "label": "Address",
-   "read_only": 1
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "contact_person",
@@ -411,51 +473,67 @@
    "in_global_search": 1,
    "label": "Contact Person",
    "options": "Contact",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "contact_display",
    "fieldtype": "Small Text",
    "label": "Contact",
-   "read_only": 1
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "contact_mobile",
    "fieldtype": "Small Text",
    "label": "Mobile No",
-   "read_only": 1
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "contact_email",
    "fieldtype": "Small Text",
    "label": "Contact Email",
    "print_hide": 1,
-   "read_only": 1
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "col_break_address",
-   "fieldtype": "Column Break"
+   "fieldtype": "Column Break",
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "shipping_address",
    "fieldtype": "Link",
    "label": "Select Shipping Address",
    "options": "Address",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "shipping_address_display",
    "fieldtype": "Small Text",
    "label": "Shipping Address",
    "print_hide": 1,
-   "read_only": 1
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "collapsible": 1,
    "fieldname": "currency_and_price_list",
    "fieldtype": "Section Break",
    "label": "Currency and Price List",
-   "options": "fa fa-tag"
+   "options": "fa fa-tag",
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "currency",
@@ -464,7 +542,9 @@
    "oldfieldname": "currency",
    "oldfieldtype": "Select",
    "options": "Currency",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "conversion_rate",
@@ -473,18 +553,24 @@
    "oldfieldname": "conversion_rate",
    "oldfieldtype": "Currency",
    "precision": "9",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "column_break2",
-   "fieldtype": "Column Break"
+   "fieldtype": "Column Break",
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "buying_price_list",
    "fieldtype": "Link",
    "label": "Price List",
    "options": "Price List",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "price_list_currency",
@@ -492,14 +578,18 @@
    "label": "Price List Currency",
    "options": "Currency",
    "print_hide": 1,
-   "read_only": 1
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "plc_conversion_rate",
    "fieldtype": "Float",
    "label": "Price List Exchange Rate",
    "precision": "9",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "default": "0",
@@ -508,11 +598,15 @@
    "label": "Ignore Pricing Rule",
    "no_copy": 1,
    "permlevel": 1,
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "sec_warehouse",
-   "fieldtype": "Section Break"
+   "fieldtype": "Section Break",
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "depends_on": "update_stock",
@@ -521,7 +615,9 @@
    "fieldtype": "Link",
    "label": "Set Accepted Warehouse",
    "options": "Warehouse",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "depends_on": "update_stock",
@@ -531,11 +627,15 @@
    "label": "Rejected Warehouse",
    "no_copy": 1,
    "options": "Warehouse",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "col_break_warehouse",
-   "fieldtype": "Column Break"
+   "fieldtype": "Column Break",
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "default": "No",
@@ -543,25 +643,33 @@
    "fieldtype": "Select",
    "label": "Raw Materials Supplied",
    "options": "No\nYes",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "items_section",
    "fieldtype": "Section Break",
    "oldfieldtype": "Section Break",
-   "options": "fa fa-shopping-cart"
+   "options": "fa fa-shopping-cart",
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "default": "0",
    "fieldname": "update_stock",
    "fieldtype": "Check",
    "label": "Update Stock",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "scan_barcode",
    "fieldtype": "Data",
-   "label": "Scan Barcode"
+   "label": "Scan Barcode",
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "allow_bulk_edit": 1,
@@ -571,25 +679,33 @@
    "oldfieldname": "entries",
    "oldfieldtype": "Table",
    "options": "Purchase Invoice Item",
-   "reqd": 1
+   "reqd": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "pricing_rule_details",
    "fieldtype": "Section Break",
-   "label": "Pricing Rules"
+   "label": "Pricing Rules",
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "pricing_rules",
    "fieldtype": "Table",
    "label": "Pricing Rule Detail",
    "options": "Pricing Rule Detail",
-   "read_only": 1
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "collapsible_depends_on": "supplied_items",
    "fieldname": "raw_materials_supplied",
    "fieldtype": "Section Break",
-   "label": "Raw Materials Supplied"
+   "label": "Raw Materials Supplied",
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "depends_on": "update_stock",
@@ -597,17 +713,23 @@
    "fieldtype": "Table",
    "label": "Supplied Items",
    "no_copy": 1,
-   "options": "Purchase Receipt Item Supplied"
+   "options": "Purchase Receipt Item Supplied",
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "section_break_26",
-   "fieldtype": "Section Break"
+   "fieldtype": "Section Break",
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "total_qty",
    "fieldtype": "Float",
    "label": "Total Quantity",
-   "read_only": 1
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "base_total",
@@ -615,7 +737,9 @@
    "label": "Total (Company Currency)",
    "options": "Company:company:default_currency",
    "print_hide": 1,
-   "read_only": 1
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "base_net_total",
@@ -625,18 +749,24 @@
    "oldfieldtype": "Currency",
    "options": "Company:company:default_currency",
    "print_hide": 1,
-   "read_only": 1
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "column_break_28",
-   "fieldtype": "Column Break"
+   "fieldtype": "Column Break",
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "total",
    "fieldtype": "Currency",
    "label": "Total",
    "options": "currency",
-   "read_only": 1
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "net_total",
@@ -646,42 +776,56 @@
    "oldfieldtype": "Currency",
    "options": "currency",
    "print_hide": 1,
-   "read_only": 1
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "total_net_weight",
    "fieldtype": "Float",
    "label": "Total Net Weight",
    "print_hide": 1,
-   "read_only": 1
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "taxes_section",
    "fieldtype": "Section Break",
    "oldfieldtype": "Section Break",
-   "options": "fa fa-money"
+   "options": "fa fa-money",
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "tax_category",
    "fieldtype": "Link",
    "label": "Tax Category",
    "options": "Tax Category",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "column_break_49",
-   "fieldtype": "Column Break"
+   "fieldtype": "Column Break",
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "shipping_rule",
    "fieldtype": "Link",
    "label": "Shipping Rule",
    "options": "Shipping Rule",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "section_break_51",
-   "fieldtype": "Section Break"
+   "fieldtype": "Section Break",
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "taxes_and_charges",
@@ -690,7 +834,9 @@
    "oldfieldname": "purchase_other_charges",
    "oldfieldtype": "Link",
    "options": "Purchase Taxes and Charges Template",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "taxes",
@@ -698,13 +844,17 @@
    "label": "Purchase Taxes and Charges",
    "oldfieldname": "purchase_tax_details",
    "oldfieldtype": "Table",
-   "options": "Purchase Taxes and Charges"
+   "options": "Purchase Taxes and Charges",
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "collapsible": 1,
    "fieldname": "sec_tax_breakup",
    "fieldtype": "Section Break",
-   "label": "Tax Breakup"
+   "label": "Tax Breakup",
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "other_charges_calculation",
@@ -713,13 +863,17 @@
    "no_copy": 1,
    "oldfieldtype": "HTML",
    "print_hide": 1,
-   "read_only": 1
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "totals",
    "fieldtype": "Section Break",
    "oldfieldtype": "Section Break",
-   "options": "fa fa-money"
+   "options": "fa fa-money",
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "base_taxes_and_charges_added",
@@ -729,7 +883,9 @@
    "oldfieldtype": "Currency",
    "options": "Company:company:default_currency",
    "print_hide": 1,
-   "read_only": 1
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "base_taxes_and_charges_deducted",
@@ -739,7 +895,9 @@
    "oldfieldtype": "Currency",
    "options": "Company:company:default_currency",
    "print_hide": 1,
-   "read_only": 1
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "base_total_taxes_and_charges",
@@ -749,11 +907,15 @@
    "oldfieldtype": "Currency",
    "options": "Company:company:default_currency",
    "print_hide": 1,
-   "read_only": 1
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "column_break_40",
-   "fieldtype": "Column Break"
+   "fieldtype": "Column Break",
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "taxes_and_charges_added",
@@ -763,7 +925,9 @@
    "oldfieldtype": "Currency",
    "options": "currency",
    "print_hide": 1,
-   "read_only": 1
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "taxes_and_charges_deducted",
@@ -773,7 +937,9 @@
    "oldfieldtype": "Currency",
    "options": "currency",
    "print_hide": 1,
-   "read_only": 1
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "total_taxes_and_charges",
@@ -781,14 +947,18 @@
    "label": "Total Taxes and Charges",
    "options": "currency",
    "print_hide": 1,
-   "read_only": 1
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "collapsible": 1,
    "collapsible_depends_on": "discount_amount",
    "fieldname": "section_break_44",
    "fieldtype": "Section Break",
-   "label": "Additional Discount"
+   "label": "Additional Discount",
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "default": "Grand Total",
@@ -796,7 +966,9 @@
    "fieldtype": "Select",
    "label": "Apply Additional Discount On",
    "options": "\nGrand Total\nNet Total",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "base_discount_amount",
@@ -804,28 +976,38 @@
    "label": "Additional Discount Amount (Company Currency)",
    "options": "Company:company:default_currency",
    "print_hide": 1,
-   "read_only": 1
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "column_break_46",
-   "fieldtype": "Column Break"
+   "fieldtype": "Column Break",
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "additional_discount_percentage",
    "fieldtype": "Float",
    "label": "Additional Discount Percentage",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "discount_amount",
    "fieldtype": "Currency",
    "label": "Additional Discount Amount",
    "options": "currency",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "section_break_49",
-   "fieldtype": "Section Break"
+   "fieldtype": "Section Break",
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "base_grand_total",
@@ -835,7 +1017,9 @@
    "oldfieldtype": "Currency",
    "options": "Company:company:default_currency",
    "print_hide": 1,
-   "read_only": 1
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "depends_on": "eval:!doc.disable_rounded_total",
@@ -845,7 +1029,9 @@
    "no_copy": 1,
    "options": "Company:company:default_currency",
    "print_hide": 1,
-   "read_only": 1
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "depends_on": "eval:!doc.disable_rounded_total",
@@ -855,7 +1041,9 @@
    "no_copy": 1,
    "options": "Company:company:default_currency",
    "print_hide": 1,
-   "read_only": 1
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "base_in_words",
@@ -865,13 +1053,17 @@
    "oldfieldname": "in_words",
    "oldfieldtype": "Data",
    "print_hide": 1,
-   "read_only": 1
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "column_break8",
    "fieldtype": "Column Break",
    "oldfieldtype": "Column Break",
    "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1,
    "width": "50%"
   },
   {
@@ -882,7 +1074,9 @@
    "oldfieldname": "grand_total_import",
    "oldfieldtype": "Currency",
    "options": "currency",
-   "read_only": 1
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "depends_on": "eval:!doc.disable_rounded_total",
@@ -892,7 +1086,9 @@
    "no_copy": 1,
    "options": "currency",
    "print_hide": 1,
-   "read_only": 1
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "depends_on": "eval:!doc.disable_rounded_total",
@@ -902,7 +1098,9 @@
    "no_copy": 1,
    "options": "currency",
    "print_hide": 1,
-   "read_only": 1
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "in_words",
@@ -912,7 +1110,9 @@
    "oldfieldname": "in_words_import",
    "oldfieldtype": "Data",
    "print_hide": 1,
-   "read_only": 1
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "total_advance",
@@ -923,7 +1123,9 @@
    "oldfieldtype": "Currency",
    "options": "party_account_currency",
    "print_hide": 1,
-   "read_only": 1
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "outstanding_amount",
@@ -934,14 +1136,18 @@
    "oldfieldtype": "Currency",
    "options": "party_account_currency",
    "print_hide": 1,
-   "read_only": 1
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "default": "0",
    "depends_on": "grand_total",
    "fieldname": "disable_rounded_total",
    "fieldtype": "Check",
-   "label": "Disable Rounded Total"
+   "label": "Disable Rounded Total",
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "collapsible": 1,
@@ -949,20 +1155,26 @@
    "depends_on": "eval:doc.is_paid===1||(doc.advances && doc.advances.length>0)",
    "fieldname": "payments_section",
    "fieldtype": "Section Break",
-   "label": "Payments"
+   "label": "Payments",
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "mode_of_payment",
    "fieldtype": "Link",
    "label": "Mode of Payment",
    "options": "Mode of Payment",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "cash_bank_account",
    "fieldtype": "Link",
    "label": "Cash/Bank Account",
-   "options": "Account"
+   "options": "Account",
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "clearance_date",
@@ -970,11 +1182,15 @@
    "label": "Clearance Date",
    "no_copy": 1,
    "print_hide": 1,
-   "read_only": 1
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "col_br_payments",
-   "fieldtype": "Column Break"
+   "fieldtype": "Column Break",
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "depends_on": "is_paid",
@@ -983,7 +1199,9 @@
    "label": "Paid Amount",
    "no_copy": 1,
    "options": "currency",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "base_paid_amount",
@@ -992,7 +1210,9 @@
    "no_copy": 1,
    "options": "Company:company:default_currency",
    "print_hide": 1,
-   "read_only": 1
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "collapsible": 1,
@@ -1000,7 +1220,9 @@
    "depends_on": "grand_total",
    "fieldname": "write_off",
    "fieldtype": "Section Break",
-   "label": "Write Off"
+   "label": "Write Off",
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "write_off_amount",
@@ -1008,7 +1230,9 @@
    "label": "Write Off Amount",
    "no_copy": 1,
    "options": "currency",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "base_write_off_amount",
@@ -1017,11 +1241,15 @@
    "no_copy": 1,
    "options": "Company:company:default_currency",
    "print_hide": 1,
-   "read_only": 1
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "column_break_61",
-   "fieldtype": "Column Break"
+   "fieldtype": "Column Break",
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "depends_on": "eval:flt(doc.write_off_amount)!=0",
@@ -1029,7 +1257,9 @@
    "fieldtype": "Link",
    "label": "Write Off Account",
    "options": "Account",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "depends_on": "eval:flt(doc.write_off_amount)!=0",
@@ -1037,7 +1267,9 @@
    "fieldtype": "Link",
    "label": "Write Off Cost Center",
    "options": "Cost Center",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "collapsible": 1,
@@ -1047,13 +1279,17 @@
    "label": "Advance Payments",
    "oldfieldtype": "Section Break",
    "options": "fa fa-money",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "default": "0",
    "fieldname": "allocate_advances_automatically",
    "fieldtype": "Check",
-   "label": "Set Advances and Allocate (FIFO)"
+   "label": "Set Advances and Allocate (FIFO)",
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "depends_on": "eval:!doc.allocate_advances_automatically",
@@ -1061,7 +1297,9 @@
    "fieldtype": "Button",
    "label": "Get Advances Paid",
    "oldfieldtype": "Button",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "advances",
@@ -1071,20 +1309,26 @@
    "oldfieldname": "advance_allocation_details",
    "oldfieldtype": "Table",
    "options": "Purchase Invoice Advance",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "collapsible": 1,
    "collapsible_depends_on": "eval:(!doc.is_return)",
    "fieldname": "payment_schedule_section",
    "fieldtype": "Section Break",
-   "label": "Payment Terms"
+   "label": "Payment Terms",
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "payment_terms_template",
    "fieldtype": "Link",
    "label": "Payment Terms Template",
-   "options": "Payment Terms Template"
+   "options": "Payment Terms Template",
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "payment_schedule",
@@ -1092,7 +1336,9 @@
    "label": "Payment Schedule",
    "no_copy": 1,
    "options": "Payment Schedule",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "collapsible": 1,
@@ -1100,25 +1346,33 @@
    "fieldname": "terms_section_break",
    "fieldtype": "Section Break",
    "label": "Terms and Conditions",
-   "options": "fa fa-legal"
+   "options": "fa fa-legal",
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "tc_name",
    "fieldtype": "Link",
    "label": "Terms",
    "options": "Terms and Conditions",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "terms",
    "fieldtype": "Text Editor",
-   "label": "Terms and Conditions1"
+   "label": "Terms and Conditions1",
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "collapsible": 1,
    "fieldname": "printing_settings",
    "fieldtype": "Section Break",
-   "label": "Printing Settings"
+   "label": "Printing Settings",
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "allow_on_submit": 1,
@@ -1126,7 +1380,9 @@
    "fieldtype": "Link",
    "label": "Letter Head",
    "options": "Letter Head",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "allow_on_submit": 1,
@@ -1134,11 +1390,15 @@
    "fieldname": "group_same_items",
    "fieldtype": "Check",
    "label": "Group same items",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "column_break_112",
-   "fieldtype": "Column Break"
+   "fieldtype": "Column Break",
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "allow_on_submit": 1,
@@ -1150,14 +1410,18 @@
    "oldfieldtype": "Link",
    "options": "Print Heading",
    "print_hide": 1,
-   "report_hide": 1
+   "report_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "language",
    "fieldtype": "Data",
    "label": "Print Language",
    "print_hide": 1,
-   "read_only": 1
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "collapsible": 1,
@@ -1166,7 +1430,9 @@
    "label": "More Information",
    "oldfieldtype": "Section Break",
    "options": "fa fa-file-text",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "credit_to",
@@ -1177,7 +1443,9 @@
    "options": "Account",
    "print_hide": 1,
    "reqd": 1,
-   "search_index": 1
+   "search_index": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "party_account_currency",
@@ -1187,7 +1455,9 @@
    "no_copy": 1,
    "options": "Currency",
    "print_hide": 1,
-   "read_only": 1
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "default": "No",
@@ -1197,7 +1467,9 @@
    "oldfieldname": "is_opening",
    "oldfieldtype": "Select",
    "options": "No\nYes",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "against_expense_account",
@@ -1207,11 +1479,15 @@
    "no_copy": 1,
    "oldfieldname": "against_expense_account",
    "oldfieldtype": "Small Text",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "column_break_63",
-   "fieldtype": "Column Break"
+   "fieldtype": "Column Break",
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "default": "Draft",
@@ -1220,7 +1496,9 @@
    "in_standard_filter": 1,
    "label": "Status",
    "options": "\nDraft\nReturn\nDebit Note Issued\nSubmitted\nPaid\nUnpaid\nOverdue\nCancelled\nInternal Transfer",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "inter_company_invoice_reference",
@@ -1229,7 +1507,9 @@
    "no_copy": 1,
    "options": "Sales Invoice",
    "print_hide": 1,
-   "read_only": 1
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "remarks",
@@ -1238,14 +1518,18 @@
    "no_copy": 1,
    "oldfieldname": "remarks",
    "oldfieldtype": "Text",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "collapsible": 1,
    "fieldname": "subscription_section",
    "fieldtype": "Section Break",
    "label": "Subscription Section",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "allow_on_submit": 1,
@@ -1254,7 +1538,9 @@
    "fieldtype": "Date",
    "label": "From Date",
    "no_copy": 1,
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "allow_on_submit": 1,
@@ -1263,11 +1549,15 @@
    "fieldtype": "Date",
    "label": "To Date",
    "no_copy": 1,
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "column_break_114",
-   "fieldtype": "Column Break"
+   "fieldtype": "Column Break",
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "auto_repeat",
@@ -1276,24 +1566,32 @@
    "no_copy": 1,
    "options": "Auto Repeat",
    "print_hide": 1,
-   "read_only": 1
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "allow_on_submit": 1,
    "depends_on": "eval: doc.auto_repeat",
    "fieldname": "update_auto_repeat_reference",
    "fieldtype": "Button",
-   "label": "Update Auto Repeat Reference"
+   "label": "Update Auto Repeat Reference",
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "collapsible": 1,
    "fieldname": "accounting_dimensions_section",
    "fieldtype": "Section Break",
-   "label": "Accounting Dimensions "
+   "label": "Accounting Dimensions ",
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "dimension_col_break",
-   "fieldtype": "Column Break"
+   "fieldtype": "Column Break",
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "default": "0",
@@ -1301,7 +1599,9 @@
    "fieldname": "is_internal_supplier",
    "fieldtype": "Check",
    "label": "Is Internal Supplier",
-   "read_only": 1
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "tax_withholding_category",
@@ -1309,25 +1609,33 @@
    "hidden": 1,
    "label": "Tax Withholding Category",
    "options": "Tax Withholding Category",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "billing_address",
    "fieldtype": "Link",
    "label": "Select Billing Address",
-   "options": "Address"
+   "options": "Address",
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "billing_address_display",
    "fieldtype": "Small Text",
    "label": "Billing Address",
-   "read_only": 1
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "project",
    "fieldtype": "Link",
    "label": "Project",
-   "options": "Project"
+   "options": "Project",
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "depends_on": "eval:doc.is_internal_supplier",
@@ -1335,7 +1643,9 @@
    "fieldname": "unrealized_profit_loss_account",
    "fieldtype": "Link",
    "label": "Unrealized Profit / Loss Account",
-   "options": "Account"
+   "options": "Account",
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "depends_on": "eval:doc.is_internal_supplier",
@@ -1344,7 +1654,9 @@
    "fieldname": "represents_company",
    "fieldtype": "Link",
    "label": "Represents Company",
-   "options": "Company"
+   "options": "Company",
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "depends_on": "eval:doc.update_stock && doc.is_internal_supplier",
@@ -1356,6 +1668,8 @@
    "options": "Warehouse",
    "print_hide": 1,
    "print_width": "50px",
+   "show_days": 1,
+   "show_seconds": 1,
    "width": "50px"
   },
   {
@@ -1367,6 +1681,8 @@
    "options": "Warehouse",
    "print_hide": 1,
    "print_width": "50px",
+   "show_days": 1,
+   "show_seconds": 1,
    "width": "50px"
   },
   {
@@ -1377,13 +1693,29 @@
    "no_copy": 1,
    "print_hide": 1,
    "read_only": 1
+  },
+  {
+   "fieldname": "additional_discount_account",
+   "fieldtype": "Link",
+   "label": "Additional Discount Account",
+   "options": "Account"
+  },
+  {
+   "default": "0",
+   "fieldname": "ignore_default_payment_terms_template",
+   "fieldtype": "Check",
+   "hidden": 1,
+   "label": "Ignore Default Payment Terms Template",
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   }
  ],
  "icon": "fa fa-file-text",
  "idx": 204,
  "is_submittable": 1,
  "links": [],
- "modified": "2021-06-15 18:20:56.806195",
+ "modified": "2021-08-07 17:53:14.351439",
  "modified_by": "Administrator",
  "module": "Accounts",
  "name": "Purchase Invoice",
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
index 25f42bc..a16795e 100644
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
@@ -448,6 +448,7 @@
 
 		self.make_supplier_gl_entry(gl_entries)
 		self.make_item_gl_entries(gl_entries)
+		self.make_discount_gl_entries(gl_entries)
 
 		if self.check_asset_cwip_enabled():
 			self.get_asset_gl_entry(gl_entries)
@@ -522,6 +523,8 @@
 
 		exchange_rate_map, net_rate_map = get_purchase_document_details(self)
 
+		enable_discount_accounting = cint(frappe.db.get_single_value('Accounts Settings', 'enable_discount_accounting'))
+
 		for item in self.get("items"):
 			if flt(item.base_net_amount):
 				account_currency = get_account_currency(item.expense_account)
@@ -612,7 +615,7 @@
 						if (not item.enable_deferred_expense or self.is_return) else item.deferred_expense_account)
 
 					if not item.is_fixed_asset:
-						amount = flt(item.base_net_amount, item.precision("base_net_amount"))
+						dummy, amount = self.get_amount_and_base_amount(item, enable_discount_accounting)
 					else:
 						amount = flt(item.base_net_amount + item.item_tax_amount, item.precision("base_net_amount"))
 
@@ -854,8 +857,11 @@
 	def make_tax_gl_entries(self, gl_entries):
 		# tax table gl entries
 		valuation_tax = {}
+		enable_discount_accounting = cint(frappe.db.get_single_value('Accounts Settings', 'enable_discount_accounting'))
+
 		for tax in self.get("taxes"):
-			if tax.category in ("Total", "Valuation and Total") and flt(tax.base_tax_amount_after_discount_amount):
+			amount, base_amount = self.get_tax_amounts(tax, enable_discount_accounting)
+			if tax.category in ("Total", "Valuation and Total") and flt(base_amount):
 				account_currency = get_account_currency(tax.account_head)
 
 				dr_or_cr = "debit" if tax.add_deduct_tax == "Add" else "credit"
@@ -864,21 +870,21 @@
 					self.get_gl_dict({
 						"account": tax.account_head,
 						"against": self.supplier,
-						dr_or_cr: tax.base_tax_amount_after_discount_amount,
-						dr_or_cr + "_in_account_currency": tax.base_tax_amount_after_discount_amount \
-							if account_currency==self.company_currency \
-							else tax.tax_amount_after_discount_amount,
+						dr_or_cr: base_amount,
+						dr_or_cr + "_in_account_currency": base_amount
+							if account_currency==self.company_currency
+							else amount,
 						"cost_center": tax.cost_center
 					}, account_currency, item=tax)
 				)
 			# accumulate valuation tax
-			if self.is_opening == "No" and tax.category in ("Valuation", "Valuation and Total") and flt(tax.base_tax_amount_after_discount_amount) \
+			if self.is_opening == "No" and tax.category in ("Valuation", "Valuation and Total") and flt(base_amount) \
 				and not self.is_internal_transfer():
 				if self.auto_accounting_for_stock and not tax.cost_center:
 					frappe.throw(_("Cost Center is required in row {0} in Taxes table for type {1}").format(tax.idx, _(tax.category)))
 				valuation_tax.setdefault(tax.name, 0)
 				valuation_tax[tax.name] += \
-					(tax.add_deduct_tax == "Add" and 1 or -1) * flt(tax.base_tax_amount_after_discount_amount)
+					(tax.add_deduct_tax == "Add" and 1 or -1) * flt(base_amount)
 
 		if self.is_opening == "No" and self.negative_expense_to_be_booked and valuation_tax:
 			# credit valuation tax amount in "Expenses Included In Valuation"
@@ -919,6 +925,13 @@
 							"remarks": self.remarks or "Accounting Entry for Stock"
 						}, item=tax))
 
+	@property
+	def enable_discount_accounting(self):
+		if not hasattr(self, "_enable_discount_accounting"):
+			self._enable_discount_accounting = cint(frappe.db.get_single_value('Accounts Settings', 'enable_discount_accounting'))
+
+		return self._enable_discount_accounting
+
 	def make_internal_transfer_gl_entries(self, gl_entries):
 		if self.is_internal_transfer() and flt(self.base_total_taxes_and_charges):
 			account_currency = get_account_currency(self.unrealized_profit_loss_account)
diff --git a/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py
index e90b35f..37ff52c 100644
--- a/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py
+++ b/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py
@@ -251,6 +251,50 @@
 
 		self.assertEqual(discrepancy_caused_by_exchange_rate_diff, amount)
 
+	def test_purchase_invoice_with_discount_accounting_enabled(self):
+		enable_discount_accounting()
+
+		discount_account = create_account(account_name="Discount Account",
+			parent_account="Indirect Expenses - _TC", company="_Test Company")
+		pi = make_purchase_invoice(discount_account=discount_account, rate=45)
+
+		expected_gle = [
+			["_Test Account Cost for Goods Sold - _TC", 250.0, 0.0, nowdate()],
+			["Creditors - _TC", 0.0, 225.0, nowdate()],
+			["Discount Account - _TC", 0.0, 25.0, nowdate()]
+		]
+
+		check_gl_entries(self, pi.name, expected_gle, nowdate())
+		enable_discount_accounting(enable=0)
+
+	def test_additional_discount_for_purchase_invoice_with_discount_accounting_enabled(self):
+		enable_discount_accounting()
+		additional_discount_account = create_account(account_name="Discount Account",
+			parent_account="Indirect Expenses - _TC", company="_Test Company")
+
+		pi = make_purchase_invoice(do_not_save=1, parent_cost_center="Main - _TC")
+		pi.apply_discount_on = "Grand Total"
+		pi.additional_discount_account = additional_discount_account
+		pi.additional_discount_percentage = 10
+		pi.disable_rounded_total = 1
+		pi.append("taxes", {
+			"charge_type": "On Net Total",
+			"account_head": "_Test Account VAT - _TC",
+			"cost_center": "Main - _TC",
+			"description": "Test",
+			"rate": 10
+		})
+		pi.submit()
+
+		expected_gle = [
+			["_Test Account Cost for Goods Sold - _TC", 250.0, 0.0, nowdate()],
+			["_Test Account VAT - _TC", 25.0, 0.0, nowdate()],
+			["Creditors - _TC", 0.0, 247.5, nowdate()],
+			["Discount Account - _TC", 0.0, 27.5, nowdate()]
+		]
+
+		check_gl_entries(self, pi.name, expected_gle, nowdate())
+
 	def test_purchase_invoice_change_naming_series(self):
 		pi = frappe.copy_doc(test_records[1])
 		pi.insert()
@@ -1161,6 +1205,18 @@
 			self.assertEqual(expected_gle[i][0], gle.account)
 			self.assertEqual(expected_gle[i][1], gle.amount)
 
+def check_gl_entries(doc, voucher_no, expected_gle, posting_date):
+	gl_entries = frappe.db.sql("""select account, debit, credit, posting_date
+		from `tabGL Entry`
+		where voucher_type='Purchase Invoice' and voucher_no=%s and posting_date >= %s
+		order by posting_date asc, account asc""", (voucher_no, posting_date), as_dict=1)
+
+	for i, gle in enumerate(gl_entries):
+		doc.assertEqual(expected_gle[i][0], gle.account)
+		doc.assertEqual(expected_gle[i][1], gle.debit)
+		doc.assertEqual(expected_gle[i][2], gle.credit)
+		doc.assertEqual(getdate(expected_gle[i][3]), gle.posting_date)
+
 def update_tax_witholding_category(company, account, date):
 	from erpnext.accounts.utils import get_fiscal_year
 
@@ -1191,6 +1247,11 @@
 	accounts_settings.unlink_payment_on_cancellation_of_invoice = enable
 	accounts_settings.save()
 
+def enable_discount_accounting(enable=1):
+	accounts_settings = frappe.get_doc("Accounts Settings")
+	accounts_settings.enable_discount_accounting = enable
+	accounts_settings.save()
+
 def make_purchase_invoice(**args):
 	pi = frappe.new_doc("Purchase Invoice")
 	args = frappe._dict(args)
@@ -1213,6 +1274,7 @@
 	pi.return_against = args.return_against
 	pi.is_subcontracted = args.is_subcontracted or "No"
 	pi.supplier_warehouse = args.supplier_warehouse or "_Test Warehouse 1 - _TC"
+	pi.cost_center = args.parent_cost_center
 
 	pi.append("items", {
 		"item_code": args.item or args.item_code or "_Test Item",
@@ -1221,7 +1283,10 @@
 		"received_qty": args.received_qty or 0,
 		"rejected_qty": args.rejected_qty or 0,
 		"rate": args.rate or 50,
-		'expense_account': args.expense_account or '_Test Account Cost for Goods Sold - _TC',
+		"price_list_rate": args.price_list_rate or 50,
+		"expense_account": args.expense_account or '_Test Account Cost for Goods Sold - _TC',
+		"discount_account": args.discount_account or None,
+		"discount_amount": args.discount_amount or 0,
 		"conversion_factor": 1.0,
 		"serial_no": args.serial_no,
 		"stock_uom": args.uom or "_Test UOM",
diff --git a/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.json b/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.json
index b39022d..a7618e2 100644
--- a/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.json
+++ b/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.json
@@ -73,6 +73,7 @@
   "manufacturer_part_no",
   "accounting",
   "expense_account",
+  "discount_account",
   "col_break5",
   "is_fixed_asset",
   "asset_location",
@@ -501,6 +502,7 @@
   },
   {
    "collapsible": 1,
+   "collapsible_depends_on": "enable_deferred_expense",
    "fieldname": "deferred_expense_section",
    "fieldtype": "Section Break",
    "label": "Deferred Expense"
@@ -849,12 +851,18 @@
    "options": "Company:company:default_currency",
    "print_hide": 1,
    "read_only": 1
+  },
+  {
+   "fieldname": "discount_account",
+   "fieldtype": "Link",
+   "label": "Discount Account",
+   "options": "Account"
   }
  ],
  "idx": 1,
  "istable": 1,
  "links": [],
- "modified": "2021-06-16 19:43:51.099386",
+ "modified": "2021-08-12 20:14:48.506639",
  "modified_by": "Administrator",
  "module": "Accounts",
  "name": "Purchase Invoice Item",
diff --git a/erpnext/accounts/doctype/purchase_taxes_and_charges/purchase_taxes_and_charges.json b/erpnext/accounts/doctype/purchase_taxes_and_charges/purchase_taxes_and_charges.json
index 1fa68e0..d86abad 100644
--- a/erpnext/accounts/doctype/purchase_taxes_and_charges/purchase_taxes_and_charges.json
+++ b/erpnext/accounts/doctype/purchase_taxes_and_charges/purchase_taxes_and_charges.json
@@ -22,7 +22,7 @@
   "cost_center",
   "dimension_col_break",
   "section_break_9",
-  "currency",
+  "account_currency",
   "tax_amount",
   "tax_amount_after_discount_amount",
   "total",
@@ -209,26 +209,26 @@
    "fieldtype": "Column Break"
   },
   {
-   "fetch_from": "account_head.account_currency",
-   "fieldname": "currency",
-   "fieldtype": "Link",
-   "label": "Account Currency",
-   "options": "Currency",
-   "read_only": 1
-  },
-  {
    "default": "0",
    "depends_on": "eval:['Purchase Taxes and Charges Template', 'Payment Entry'].includes(parent.doctype)",
    "description": "If checked, the tax amount will be considered as already included in the Paid Amount in Payment Entry",
    "fieldname": "included_in_paid_amount",
    "fieldtype": "Check",
    "label": "Considered In Paid Amount"
+  },
+  {
+   "fetch_from": "account_head.account_currency",
+   "fieldname": "account_currency",
+   "fieldtype": "Link",
+   "label": "Account Currency",
+   "options": "Currency",
+   "read_only": 1
   }
  ],
  "idx": 1,
  "istable": 1,
  "links": [],
- "modified": "2021-06-14 01:43:50.750455",
+ "modified": "2021-08-05 20:04:36.618240",
  "modified_by": "Administrator",
  "module": "Accounts",
  "name": "Purchase Taxes and Charges",
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
index bb55651..8d65101 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
@@ -347,7 +347,7 @@
 
 	items_add(doc, cdt, cdn) {
 		var row = frappe.get_doc(cdt, cdn);
-		this.frm.script_manager.copy_from_first_row("items", row, ["income_account", "cost_center"]);
+		this.frm.script_manager.copy_from_first_row("items", row, ["income_account", "discount_account", "cost_center"]);
 	}
 
 	set_dynamic_labels() {
@@ -448,6 +448,15 @@
 		this.frm.refresh_field("paid_amount");
 		this.frm.refresh_field("base_paid_amount");
 	}
+
+	currency() {
+		super.currency();
+		$.each(cur_frm.doc.timesheets, function(i, d) {
+			let row = frappe.get_doc(d.doctype, d.name)
+			set_timesheet_detail_rate(row.doctype, row.name, cur_frm.doc.currency, row.timesheet_detail)
+		});
+		calculate_total_billing_amount(cur_frm)
+	}
 };
 
 // for backward compatibility: combine new and previous states
@@ -510,7 +519,6 @@
 	}
 });
 
-
 // Cost Center in Details Table
 // -----------------------------
 cur_frm.fields_dict["items"].grid.get_field("cost_center").get_query = function(doc) {
@@ -592,6 +600,16 @@
 			};
 		});
 
+		frm.set_query("additional_discount_account", function() {
+			return {
+				filters: {
+					company: frm.doc.company,
+					is_group: 0,
+					report_type: "Profit and Loss",
+				}
+			};
+		});
+
 		frm.custom_make_buttons = {
 			'Delivery Note': 'Delivery',
 			'Sales Invoice': 'Return / Credit Note',
@@ -618,6 +636,17 @@
 			}
 		}
 
+		// discount account
+		frm.fields_dict['items'].grid.get_field('discount_account').get_query = function(doc) {
+			return {
+				filters: {
+					'report_type': 'Profit and Loss',
+					'company': doc.company,
+					"is_group": 0
+				}
+			}
+		}
+
 		frm.fields_dict['items'].grid.get_field('deferred_revenue_account').get_query = function(doc) {
 			return {
 				filters: {
@@ -826,7 +855,8 @@
 			'time_sheet': row.parent,
 			'billing_hours': row.billing_hours,
 			'billing_amount': flt(row.billing_amount) * flt(exchange_rate),
-			'timesheet_detail': row.name
+			'timesheet_detail': row.name,
+			'project_name': row.project_name
 		});
 		frm.refresh_field('timesheets');
 		calculate_total_billing_amount(frm);
@@ -945,43 +975,34 @@
 	}
 })
 
-frappe.ui.form.on('Sales Invoice Timesheet', {
-	time_sheet: function(frm, cdt, cdn){
-		var d = locals[cdt][cdn];
-		if(d.time_sheet) {
-			frappe.call({
-				method: "erpnext.projects.doctype.timesheet.timesheet.get_timesheet_data",
-				args: {
-					'name': d.time_sheet,
-					'project': frm.doc.project || null
-				},
-				callback: function(r, rt) {
-					if(r.message){
-						let data = r.message;
-						frappe.model.set_value(cdt, cdn, "billing_hours", data.billing_hours);
-						frappe.model.set_value(cdt, cdn, "billing_amount", data.billing_amount);
-						frappe.model.set_value(cdt, cdn, "timesheet_detail", data.timesheet_detail);
-						calculate_total_billing_amount(frm)
-					}
-				}
-			})
-		}
-	}
-})
-
 var calculate_total_billing_amount =  function(frm) {
 	var doc = frm.doc;
 
 	doc.total_billing_amount = 0.0
-	if(doc.timesheets) {
+	if (doc.timesheets) {
 		$.each(doc.timesheets, function(index, data){
-			doc.total_billing_amount += data.billing_amount
+			doc.total_billing_amount += flt(data.billing_amount)
 		})
 	}
 
 	refresh_field('total_billing_amount')
 }
 
+var set_timesheet_detail_rate = function(cdt, cdn, currency, timelog) {
+	frappe.call({
+		method: "erpnext.projects.doctype.timesheet.timesheet.get_timesheet_detail_rate",
+		args: {
+			timelog: timelog,
+			currency: currency
+		},
+		callback: function(r) {
+			if (!r.exc && r.message) {
+				frappe.model.set_value(cdt, cdn, 'billing_amount', r.message);
+			}
+		}
+	});
+}
+
 var select_loyalty_program = function(frm, loyalty_programs) {
 	var dialog = new frappe.ui.Dialog({
 		title: __("Select Loyalty Program"),
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json
index 0a9a105..b2be860 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json
@@ -106,6 +106,7 @@
   "section_break_49",
   "apply_discount_on",
   "base_discount_amount",
+  "additional_discount_account",
   "column_break_51",
   "additional_discount_percentage",
   "discount_amount",
@@ -127,6 +128,7 @@
   "get_advances",
   "advances",
   "payment_schedule_section",
+  "ignore_default_payment_terms_template",
   "payment_terms_template",
   "payment_schedule",
   "payments_section",
@@ -197,7 +199,9 @@
    "fieldtype": "Section Break",
    "hide_days": 1,
    "hide_seconds": 1,
-   "options": "fa fa-user"
+   "options": "fa fa-user",
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "allow_on_submit": 1,
@@ -209,7 +213,9 @@
    "hide_seconds": 1,
    "label": "Title",
    "no_copy": 1,
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "bold": 1,
@@ -224,7 +230,9 @@
    "options": "ACC-SINV-.YYYY.-\nACC-SINV-RET-.YYYY.-",
    "print_hide": 1,
    "reqd": 1,
-   "set_only_once": 1
+   "set_only_once": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "bold": 1,
@@ -238,7 +246,9 @@
    "oldfieldtype": "Link",
    "options": "Customer",
    "print_hide": 1,
-   "search_index": 1
+   "search_index": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "bold": 1,
@@ -252,7 +262,9 @@
    "label": "Customer Name",
    "oldfieldname": "customer_name",
    "oldfieldtype": "Data",
-   "read_only": 1
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "tax_id",
@@ -261,7 +273,9 @@
    "hide_seconds": 1,
    "label": "Tax Id",
    "print_hide": 1,
-   "read_only": 1
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "project",
@@ -273,7 +287,9 @@
    "oldfieldname": "project_name",
    "oldfieldtype": "Link",
    "options": "Project",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "default": "0",
@@ -284,7 +300,9 @@
    "label": "Include Payment (POS)",
    "oldfieldname": "is_pos",
    "oldfieldtype": "Check",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "depends_on": "is_pos",
@@ -294,7 +312,9 @@
    "hide_seconds": 1,
    "label": "POS Profile",
    "options": "POS Profile",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "default": "0",
@@ -304,14 +324,18 @@
    "hide_seconds": 1,
    "label": "Is Return (Credit Note)",
    "no_copy": 1,
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "column_break1",
    "fieldtype": "Column Break",
    "hide_days": 1,
    "hide_seconds": 1,
-   "oldfieldtype": "Column Break"
+   "oldfieldtype": "Column Break",
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "company",
@@ -325,7 +349,9 @@
    "options": "Company",
    "print_hide": 1,
    "remember_last_selected_value": 1,
-   "reqd": 1
+   "reqd": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "cost_center",
@@ -333,7 +359,9 @@
    "hide_days": 1,
    "hide_seconds": 1,
    "label": "Cost Center",
-   "options": "Cost Center"
+   "options": "Cost Center",
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "bold": 1,
@@ -347,7 +375,9 @@
    "oldfieldname": "posting_date",
    "oldfieldtype": "Date",
    "reqd": 1,
-   "search_index": 1
+   "search_index": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "posting_time",
@@ -358,7 +388,9 @@
    "no_copy": 1,
    "oldfieldname": "posting_time",
    "oldfieldtype": "Time",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "default": "0",
@@ -368,7 +400,9 @@
    "hide_days": 1,
    "hide_seconds": 1,
    "label": "Edit Posting Date and Time",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "due_date",
@@ -378,7 +412,9 @@
    "label": "Payment Due Date",
    "no_copy": 1,
    "oldfieldname": "due_date",
-   "oldfieldtype": "Date"
+   "oldfieldtype": "Date",
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "amended_from",
@@ -392,7 +428,9 @@
    "oldfieldtype": "Link",
    "options": "Sales Invoice",
    "print_hide": 1,
-   "read_only": 1
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "depends_on": "eval:doc.return_against || doc.is_debit_note",
@@ -405,7 +443,9 @@
    "options": "Sales Invoice",
    "print_hide": 1,
    "read_only_depends_on": "eval:doc.is_return",
-   "search_index": 1
+   "search_index": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "default": "0",
@@ -414,7 +454,9 @@
    "fieldtype": "Check",
    "hide_days": 1,
    "hide_seconds": 1,
-   "label": "Update Billed Amount in Sales Order"
+   "label": "Update Billed Amount in Sales Order",
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "collapsible": 1,
@@ -423,7 +465,9 @@
    "fieldtype": "Section Break",
    "hide_days": 1,
    "hide_seconds": 1,
-   "label": "Customer PO Details"
+   "label": "Customer PO Details",
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "allow_on_submit": 1,
@@ -433,13 +477,17 @@
    "hide_seconds": 1,
    "label": "Customer's Purchase Order",
    "no_copy": 1,
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "column_break_23",
    "fieldtype": "Column Break",
    "hide_days": 1,
-   "hide_seconds": 1
+   "hide_seconds": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "allow_on_submit": 1,
@@ -447,7 +495,9 @@
    "fieldtype": "Date",
    "hide_days": 1,
    "hide_seconds": 1,
-   "label": "Customer's Purchase Order Date"
+   "label": "Customer's Purchase Order Date",
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "collapsible": 1,
@@ -455,7 +505,9 @@
    "fieldtype": "Section Break",
    "hide_days": 1,
    "hide_seconds": 1,
-   "label": "Address and Contact"
+   "label": "Address and Contact",
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "customer_address",
@@ -464,7 +516,9 @@
    "hide_seconds": 1,
    "label": "Customer Address",
    "options": "Address",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "address_display",
@@ -472,7 +526,9 @@
    "hide_days": 1,
    "hide_seconds": 1,
    "label": "Address",
-   "read_only": 1
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "contact_person",
@@ -482,7 +538,9 @@
    "in_global_search": 1,
    "label": "Contact Person",
    "options": "Contact",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "contact_display",
@@ -490,7 +548,9 @@
    "hide_days": 1,
    "hide_seconds": 1,
    "label": "Contact",
-   "read_only": 1
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "contact_mobile",
@@ -499,7 +559,9 @@
    "hide_days": 1,
    "hide_seconds": 1,
    "label": "Mobile No",
-   "read_only": 1
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "contact_email",
@@ -510,7 +572,9 @@
    "label": "Contact Email",
    "options": "Email",
    "print_hide": 1,
-   "read_only": 1
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "territory",
@@ -519,13 +583,17 @@
    "hide_seconds": 1,
    "label": "Territory",
    "options": "Territory",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "col_break4",
    "fieldtype": "Column Break",
    "hide_days": 1,
-   "hide_seconds": 1
+   "hide_seconds": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "shipping_address_name",
@@ -534,7 +602,9 @@
    "hide_seconds": 1,
    "label": "Shipping Address Name",
    "options": "Address",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "shipping_address",
@@ -543,7 +613,9 @@
    "hide_seconds": 1,
    "label": "Shipping Address",
    "print_hide": 1,
-   "read_only": 1
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "company_address",
@@ -552,7 +624,9 @@
    "hide_seconds": 1,
    "label": "Company Address Name",
    "options": "Address",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "company_address_display",
@@ -562,7 +636,9 @@
    "hide_seconds": 1,
    "label": "Company Address",
    "print_hide": 1,
-   "read_only": 1
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "collapsible": 1,
@@ -571,7 +647,9 @@
    "fieldtype": "Section Break",
    "hide_days": 1,
    "hide_seconds": 1,
-   "label": "Currency and Price List"
+   "label": "Currency and Price List",
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "currency",
@@ -583,7 +661,9 @@
    "oldfieldtype": "Select",
    "options": "Currency",
    "print_hide": 1,
-   "reqd": 1
+   "reqd": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "description": "Rate at which Customer Currency is converted to customer's base currency",
@@ -596,13 +676,17 @@
    "oldfieldtype": "Currency",
    "precision": "9",
    "print_hide": 1,
-   "reqd": 1
+   "reqd": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "column_break2",
    "fieldtype": "Column Break",
    "hide_days": 1,
    "hide_seconds": 1,
+   "show_days": 1,
+   "show_seconds": 1,
    "width": "50%"
   },
   {
@@ -615,7 +699,9 @@
    "oldfieldtype": "Select",
    "options": "Price List",
    "print_hide": 1,
-   "reqd": 1
+   "reqd": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "price_list_currency",
@@ -626,7 +712,9 @@
    "options": "Currency",
    "print_hide": 1,
    "read_only": 1,
-   "reqd": 1
+   "reqd": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "description": "Rate at which Price list currency is converted to customer's base currency",
@@ -637,7 +725,9 @@
    "label": "Price List Exchange Rate",
    "precision": "9",
    "print_hide": 1,
-   "reqd": 1
+   "reqd": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "default": "0",
@@ -648,14 +738,18 @@
    "label": "Ignore Pricing Rule",
    "no_copy": 1,
    "permlevel": 1,
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "sec_warehouse",
    "fieldtype": "Section Break",
    "hide_days": 1,
    "hide_seconds": 1,
-   "label": "Warehouse"
+   "label": "Warehouse",
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "depends_on": "update_stock",
@@ -665,7 +759,9 @@
    "hide_seconds": 1,
    "label": "Source Warehouse",
    "options": "Warehouse",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "items_section",
@@ -674,7 +770,9 @@
    "hide_seconds": 1,
    "label": "Items",
    "oldfieldtype": "Section Break",
-   "options": "fa fa-shopping-cart"
+   "options": "fa fa-shopping-cart",
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "default": "0",
@@ -685,14 +783,18 @@
    "label": "Update Stock",
    "oldfieldname": "update_stock",
    "oldfieldtype": "Check",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "scan_barcode",
    "fieldtype": "Data",
    "hide_days": 1,
    "hide_seconds": 1,
-   "label": "Scan Barcode"
+   "label": "Scan Barcode",
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "allow_bulk_edit": 1,
@@ -704,14 +806,18 @@
    "oldfieldname": "entries",
    "oldfieldtype": "Table",
    "options": "Sales Invoice Item",
-   "reqd": 1
+   "reqd": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "pricing_rule_details",
    "fieldtype": "Section Break",
    "hide_days": 1,
    "hide_seconds": 1,
-   "label": "Pricing Rules"
+   "label": "Pricing Rules",
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "pricing_rules",
@@ -720,7 +826,9 @@
    "hide_seconds": 1,
    "label": "Pricing Rule Detail",
    "options": "Pricing Rule Detail",
-   "read_only": 1
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "packing_list",
@@ -729,7 +837,9 @@
    "hide_seconds": 1,
    "label": "Packing List",
    "options": "fa fa-suitcase",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "packed_items",
@@ -738,7 +848,9 @@
    "hide_seconds": 1,
    "label": "Packed Items",
    "options": "Packed Item",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "product_bundle_help",
@@ -746,7 +858,9 @@
    "hide_days": 1,
    "hide_seconds": 1,
    "label": "Product Bundle Help",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "collapsible": 1,
@@ -756,7 +870,9 @@
    "fieldtype": "Section Break",
    "hide_days": 1,
    "hide_seconds": 1,
-   "label": "Time Sheet List"
+   "label": "Time Sheet List",
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "timesheets",
@@ -765,7 +881,9 @@
    "hide_seconds": 1,
    "label": "Time Sheets",
    "options": "Sales Invoice Timesheet",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "default": "0",
@@ -776,13 +894,17 @@
    "label": "Total Billing Amount",
    "options": "currency",
    "print_hide": 1,
-   "read_only": 1
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "section_break_30",
    "fieldtype": "Section Break",
    "hide_days": 1,
-   "hide_seconds": 1
+   "hide_seconds": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "total_qty",
@@ -790,7 +912,9 @@
    "hide_days": 1,
    "hide_seconds": 1,
    "label": "Total Quantity",
-   "read_only": 1
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "base_total",
@@ -800,7 +924,9 @@
    "label": "Total (Company Currency)",
    "options": "Company:company:default_currency",
    "print_hide": 1,
-   "read_only": 1
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "base_net_total",
@@ -813,13 +939,17 @@
    "options": "Company:company:default_currency",
    "print_hide": 1,
    "read_only": 1,
-   "reqd": 1
+   "reqd": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "column_break_32",
    "fieldtype": "Column Break",
    "hide_days": 1,
-   "hide_seconds": 1
+   "hide_seconds": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "total",
@@ -828,7 +958,9 @@
    "hide_seconds": 1,
    "label": "Total",
    "options": "currency",
-   "read_only": 1
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "net_total",
@@ -838,7 +970,9 @@
    "label": "Net Total",
    "options": "currency",
    "print_hide": 1,
-   "read_only": 1
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "total_net_weight",
@@ -847,7 +981,9 @@
    "hide_seconds": 1,
    "label": "Total Net Weight",
    "print_hide": 1,
-   "read_only": 1
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "taxes_section",
@@ -855,7 +991,9 @@
    "hide_days": 1,
    "hide_seconds": 1,
    "oldfieldtype": "Section Break",
-   "options": "fa fa-money"
+   "options": "fa fa-money",
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "taxes_and_charges",
@@ -866,13 +1004,17 @@
    "oldfieldname": "charge",
    "oldfieldtype": "Link",
    "options": "Sales Taxes and Charges Template",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "column_break_38",
    "fieldtype": "Column Break",
    "hide_days": 1,
-   "hide_seconds": 1
+   "hide_seconds": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "shipping_rule",
@@ -882,7 +1024,9 @@
    "label": "Shipping Rule",
    "oldfieldtype": "Button",
    "options": "Shipping Rule",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "tax_category",
@@ -891,13 +1035,17 @@
    "hide_seconds": 1,
    "label": "Tax Category",
    "options": "Tax Category",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "section_break_40",
    "fieldtype": "Section Break",
    "hide_days": 1,
-   "hide_seconds": 1
+   "hide_seconds": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "taxes",
@@ -907,7 +1055,9 @@
    "label": "Sales Taxes and Charges",
    "oldfieldname": "other_charges",
    "oldfieldtype": "Table",
-   "options": "Sales Taxes and Charges"
+   "options": "Sales Taxes and Charges",
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "collapsible": 1,
@@ -915,7 +1065,9 @@
    "fieldtype": "Section Break",
    "hide_days": 1,
    "hide_seconds": 1,
-   "label": "Tax Breakup"
+   "label": "Tax Breakup",
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "other_charges_calculation",
@@ -926,13 +1078,17 @@
    "no_copy": 1,
    "oldfieldtype": "HTML",
    "print_hide": 1,
-   "read_only": 1
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "section_break_43",
    "fieldtype": "Section Break",
    "hide_days": 1,
-   "hide_seconds": 1
+   "hide_seconds": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "base_total_taxes_and_charges",
@@ -944,13 +1100,17 @@
    "oldfieldtype": "Currency",
    "options": "Company:company:default_currency",
    "print_hide": 1,
-   "read_only": 1
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "column_break_47",
    "fieldtype": "Column Break",
    "hide_days": 1,
-   "hide_seconds": 1
+   "hide_seconds": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "total_taxes_and_charges",
@@ -960,7 +1120,9 @@
    "label": "Total Taxes and Charges",
    "options": "currency",
    "print_hide": 1,
-   "read_only": 1
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "collapsible": 1,
@@ -968,7 +1130,9 @@
    "fieldtype": "Section Break",
    "hide_days": 1,
    "hide_seconds": 1,
-   "label": "Loyalty Points Redemption"
+   "label": "Loyalty Points Redemption",
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "depends_on": "redeem_loyalty_points",
@@ -978,7 +1142,9 @@
    "hide_seconds": 1,
    "label": "Loyalty Points",
    "no_copy": 1,
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "depends_on": "redeem_loyalty_points",
@@ -990,7 +1156,9 @@
    "no_copy": 1,
    "options": "Company:company:default_currency",
    "print_hide": 1,
-   "read_only": 1
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "default": "0",
@@ -1000,13 +1168,17 @@
    "hide_seconds": 1,
    "label": "Redeem Loyalty Points",
    "no_copy": 1,
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "column_break_77",
    "fieldtype": "Column Break",
    "hide_days": 1,
-   "hide_seconds": 1
+   "hide_seconds": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fetch_from": "customer.loyalty_program",
@@ -1018,7 +1190,9 @@
    "no_copy": 1,
    "options": "Loyalty Program",
    "print_hide": 1,
-   "read_only": 1
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "depends_on": "redeem_loyalty_points",
@@ -1028,7 +1202,9 @@
    "hide_seconds": 1,
    "label": "Redemption Account",
    "no_copy": 1,
-   "options": "Account"
+   "options": "Account",
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "depends_on": "redeem_loyalty_points",
@@ -1038,7 +1214,9 @@
    "hide_seconds": 1,
    "label": "Redemption Cost Center",
    "no_copy": 1,
-   "options": "Cost Center"
+   "options": "Cost Center",
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "collapsible": 1,
@@ -1047,7 +1225,9 @@
    "fieldtype": "Section Break",
    "hide_days": 1,
    "hide_seconds": 1,
-   "label": "Additional Discount"
+   "label": "Additional Discount",
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "default": "Grand Total",
@@ -1057,7 +1237,9 @@
    "hide_seconds": 1,
    "label": "Apply Additional Discount On",
    "options": "\nGrand Total\nNet Total",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "base_discount_amount",
@@ -1067,13 +1249,17 @@
    "label": "Additional Discount Amount (Company Currency)",
    "options": "Company:company:default_currency",
    "print_hide": 1,
-   "read_only": 1
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "column_break_51",
    "fieldtype": "Column Break",
    "hide_days": 1,
-   "hide_seconds": 1
+   "hide_seconds": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "additional_discount_percentage",
@@ -1081,7 +1267,9 @@
    "hide_days": 1,
    "hide_seconds": 1,
    "label": "Additional Discount Percentage",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "discount_amount",
@@ -1090,7 +1278,9 @@
    "hide_seconds": 1,
    "label": "Additional Discount Amount",
    "options": "currency",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "totals",
@@ -1099,7 +1289,9 @@
    "hide_seconds": 1,
    "oldfieldtype": "Section Break",
    "options": "fa fa-money",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "base_grand_total",
@@ -1112,7 +1304,9 @@
    "options": "Company:company:default_currency",
    "print_hide": 1,
    "read_only": 1,
-   "reqd": 1
+   "reqd": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "depends_on": "eval:!doc.disable_rounded_total",
@@ -1124,7 +1318,9 @@
    "no_copy": 1,
    "options": "Company:company:default_currency",
    "print_hide": 1,
-   "read_only": 1
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "depends_on": "eval:!doc.disable_rounded_total",
@@ -1137,7 +1333,9 @@
    "oldfieldtype": "Currency",
    "options": "Company:company:default_currency",
    "print_hide": 1,
-   "read_only": 1
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "description": "In Words will be visible once you save the Sales Invoice.",
@@ -1150,7 +1348,9 @@
    "oldfieldname": "in_words",
    "oldfieldtype": "Data",
    "print_hide": 1,
-   "read_only": 1
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "column_break5",
@@ -1159,6 +1359,8 @@
    "hide_seconds": 1,
    "oldfieldtype": "Column Break",
    "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1,
    "width": "50%"
   },
   {
@@ -1173,7 +1375,9 @@
    "oldfieldtype": "Currency",
    "options": "currency",
    "read_only": 1,
-   "reqd": 1
+   "reqd": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "depends_on": "eval:!doc.disable_rounded_total",
@@ -1185,7 +1389,9 @@
    "no_copy": 1,
    "options": "currency",
    "print_hide": 1,
-   "read_only": 1
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "bold": 1,
@@ -1198,7 +1404,9 @@
    "oldfieldname": "rounded_total_export",
    "oldfieldtype": "Currency",
    "options": "currency",
-   "read_only": 1
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "in_words",
@@ -1210,7 +1418,9 @@
    "oldfieldname": "in_words_export",
    "oldfieldtype": "Data",
    "print_hide": 1,
-   "read_only": 1
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "total_advance",
@@ -1222,7 +1432,9 @@
    "oldfieldtype": "Currency",
    "options": "party_account_currency",
    "print_hide": 1,
-   "read_only": 1
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "outstanding_amount",
@@ -1235,7 +1447,9 @@
    "oldfieldtype": "Currency",
    "options": "party_account_currency",
    "print_hide": 1,
-   "read_only": 1
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "collapsible": 1,
@@ -1247,7 +1461,9 @@
    "label": "Advance Payments",
    "oldfieldtype": "Section Break",
    "options": "fa fa-money",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "default": "0",
@@ -1255,7 +1471,9 @@
    "fieldtype": "Check",
    "hide_days": 1,
    "hide_seconds": 1,
-   "label": "Allocate Advances Automatically (FIFO)"
+   "label": "Allocate Advances Automatically (FIFO)",
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "depends_on": "eval:!doc.allocate_advances_automatically",
@@ -1264,7 +1482,9 @@
    "hide_days": 1,
    "hide_seconds": 1,
    "label": "Get Advances Received",
-   "options": "set_advances"
+   "options": "set_advances",
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "advances",
@@ -1275,7 +1495,9 @@
    "oldfieldname": "advance_adjustment_details",
    "oldfieldtype": "Table",
    "options": "Sales Invoice Advance",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "collapsible": 1,
@@ -1284,7 +1506,9 @@
    "fieldtype": "Section Break",
    "hide_days": 1,
    "hide_seconds": 1,
-   "label": "Payment Terms"
+   "label": "Payment Terms",
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "depends_on": "eval:(!doc.is_pos && !doc.is_return)",
@@ -1295,7 +1519,9 @@
    "label": "Payment Terms Template",
    "no_copy": 1,
    "options": "Payment Terms Template",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "depends_on": "eval:(!doc.is_pos && !doc.is_return)",
@@ -1306,7 +1532,9 @@
    "label": "Payment Schedule",
    "no_copy": 1,
    "options": "Payment Schedule",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "depends_on": "eval:doc.is_pos===1||(doc.advances && doc.advances.length>0)",
@@ -1315,7 +1543,9 @@
    "hide_days": 1,
    "hide_seconds": 1,
    "label": "Payments",
-   "options": "fa fa-money"
+   "options": "fa fa-money",
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "depends_on": "is_pos",
@@ -1328,7 +1558,9 @@
    "oldfieldname": "cash_bank_account",
    "oldfieldtype": "Link",
    "options": "Account",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "depends_on": "eval:doc.is_pos===1",
@@ -1338,13 +1570,17 @@
    "hide_seconds": 1,
    "label": "Sales Invoice Payment",
    "options": "Sales Invoice Payment",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "section_break_84",
    "fieldtype": "Section Break",
    "hide_days": 1,
-   "hide_seconds": 1
+   "hide_seconds": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "base_paid_amount",
@@ -1355,13 +1591,17 @@
    "no_copy": 1,
    "options": "Company:company:default_currency",
    "print_hide": 1,
-   "read_only": 1
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "column_break_86",
    "fieldtype": "Column Break",
    "hide_days": 1,
-   "hide_seconds": 1
+   "hide_seconds": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "depends_on": "eval: doc.is_pos || doc.redeem_loyalty_points",
@@ -1375,13 +1615,17 @@
    "oldfieldtype": "Currency",
    "options": "currency",
    "print_hide": 1,
-   "read_only": 1
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "section_break_88",
    "fieldtype": "Section Break",
    "hide_days": 1,
-   "hide_seconds": 1
+   "hide_seconds": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "depends_on": "is_pos",
@@ -1393,13 +1637,17 @@
    "no_copy": 1,
    "options": "Company:company:default_currency",
    "print_hide": 1,
-   "read_only": 1
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "column_break_90",
    "fieldtype": "Column Break",
    "hide_days": 1,
-   "hide_seconds": 1
+   "hide_seconds": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "depends_on": "is_pos",
@@ -1410,7 +1658,9 @@
    "label": "Change Amount",
    "no_copy": 1,
    "options": "currency",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "depends_on": "is_pos",
@@ -1420,7 +1670,9 @@
    "hide_seconds": 1,
    "label": "Account for Change Amount",
    "options": "Account",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "collapsible": 1,
@@ -1431,6 +1683,8 @@
    "hide_days": 1,
    "hide_seconds": 1,
    "label": "Write Off",
+   "show_days": 1,
+   "show_seconds": 1,
    "width": "50%"
   },
   {
@@ -1441,7 +1695,9 @@
    "label": "Write Off Amount",
    "no_copy": 1,
    "options": "currency",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "base_write_off_amount",
@@ -1452,7 +1708,9 @@
    "no_copy": 1,
    "options": "Company:company:default_currency",
    "print_hide": 1,
-   "read_only": 1
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "default": "0",
@@ -1462,13 +1720,17 @@
    "hide_days": 1,
    "hide_seconds": 1,
    "label": "Write Off Outstanding Amount",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "column_break_74",
    "fieldtype": "Column Break",
    "hide_days": 1,
-   "hide_seconds": 1
+   "hide_seconds": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "write_off_account",
@@ -1477,7 +1739,9 @@
    "hide_seconds": 1,
    "label": "Write Off Account",
    "options": "Account",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "write_off_cost_center",
@@ -1486,7 +1750,9 @@
    "hide_seconds": 1,
    "label": "Write Off Cost Center",
    "options": "Cost Center",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "collapsible": 1,
@@ -1496,7 +1762,9 @@
    "hide_days": 1,
    "hide_seconds": 1,
    "label": "Terms and Conditions",
-   "oldfieldtype": "Section Break"
+   "oldfieldtype": "Section Break",
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "tc_name",
@@ -1507,7 +1775,9 @@
    "oldfieldname": "tc_name",
    "oldfieldtype": "Link",
    "options": "Terms and Conditions",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "terms",
@@ -1516,7 +1786,9 @@
    "hide_seconds": 1,
    "label": "Terms and Conditions Details",
    "oldfieldname": "terms",
-   "oldfieldtype": "Text Editor"
+   "oldfieldtype": "Text Editor",
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "collapsible": 1,
@@ -1524,7 +1796,9 @@
    "fieldtype": "Section Break",
    "hide_days": 1,
    "hide_seconds": 1,
-   "label": "Printing Settings"
+   "label": "Printing Settings",
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "allow_on_submit": 1,
@@ -1536,7 +1810,9 @@
    "oldfieldname": "letter_head",
    "oldfieldtype": "Select",
    "options": "Letter Head",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "allow_on_submit": 1,
@@ -1546,7 +1822,9 @@
    "hide_days": 1,
    "hide_seconds": 1,
    "label": "Group same items",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "language",
@@ -1555,13 +1833,17 @@
    "hide_seconds": 1,
    "label": "Print Language",
    "print_hide": 1,
-   "read_only": 1
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "column_break_84",
    "fieldtype": "Column Break",
    "hide_days": 1,
-   "hide_seconds": 1
+   "hide_seconds": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "allow_on_submit": 1,
@@ -1575,7 +1857,9 @@
    "oldfieldtype": "Link",
    "options": "Print Heading",
    "print_hide": 1,
-   "report_hide": 1
+   "report_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "collapsible": 1,
@@ -1584,7 +1868,9 @@
    "fieldtype": "Section Break",
    "hide_days": 1,
    "hide_seconds": 1,
-   "label": "More Information"
+   "label": "More Information",
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "inter_company_invoice_reference",
@@ -1593,7 +1879,9 @@
    "hide_seconds": 1,
    "label": "Inter Company Invoice Reference",
    "options": "Purchase Invoice",
-   "read_only": 1
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "customer_group",
@@ -1603,7 +1891,9 @@
    "hide_seconds": 1,
    "label": "Customer Group",
    "options": "Customer Group",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "campaign",
@@ -1614,7 +1904,9 @@
    "oldfieldname": "campaign",
    "oldfieldtype": "Link",
    "options": "Campaign",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "default": "0",
@@ -1624,13 +1916,17 @@
    "hide_seconds": 1,
    "label": "Is Discounted",
    "no_copy": 1,
-   "read_only": 1
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "col_break23",
    "fieldtype": "Column Break",
    "hide_days": 1,
    "hide_seconds": 1,
+   "show_days": 1,
+   "show_seconds": 1,
    "width": "50%"
   },
   {
@@ -1644,7 +1940,9 @@
    "no_copy": 1,
    "options": "\nDraft\nReturn\nCredit Note Issued\nSubmitted\nPaid\nUnpaid\nUnpaid and Discounted\nOverdue and Discounted\nOverdue\nCancelled\nInternal Transfer",
    "print_hide": 1,
-   "read_only": 1
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "source",
@@ -1655,7 +1953,9 @@
    "oldfieldname": "source",
    "oldfieldtype": "Select",
    "options": "Lead Source",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "collapsible": 1,
@@ -1666,7 +1966,9 @@
    "label": "Accounting Details",
    "oldfieldtype": "Section Break",
    "options": "fa fa-file-text",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "debit_to",
@@ -1679,7 +1981,9 @@
    "options": "Account",
    "print_hide": 1,
    "reqd": 1,
-   "search_index": 1
+   "search_index": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "party_account_currency",
@@ -1691,7 +1995,9 @@
    "no_copy": 1,
    "options": "Currency",
    "print_hide": 1,
-   "read_only": 1
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "default": "No",
@@ -1703,7 +2009,9 @@
    "oldfieldname": "is_opening",
    "oldfieldtype": "Select",
    "options": "No\nYes",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "c_form_applicable",
@@ -1713,7 +2021,9 @@
    "label": "C-Form Applicable",
    "no_copy": 1,
    "options": "No\nYes",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "c_form_no",
@@ -1724,7 +2034,9 @@
    "no_copy": 1,
    "options": "C-Form",
    "print_hide": 1,
-   "read_only": 1
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "column_break8",
@@ -1732,7 +2044,9 @@
    "hide_days": 1,
    "hide_seconds": 1,
    "oldfieldtype": "Column Break",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "remarks",
@@ -1743,7 +2057,9 @@
    "no_copy": 1,
    "oldfieldname": "remarks",
    "oldfieldtype": "Text",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "collapsible": 1,
@@ -1755,7 +2071,9 @@
    "label": "Commission",
    "oldfieldtype": "Section Break",
    "options": "fa fa-group",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "sales_partner",
@@ -1766,7 +2084,9 @@
    "oldfieldname": "sales_partner",
    "oldfieldtype": "Link",
    "options": "Sales Partner",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "column_break10",
@@ -1775,6 +2095,8 @@
    "hide_seconds": 1,
    "oldfieldtype": "Column Break",
    "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1,
    "width": "50%"
   },
   {
@@ -1785,7 +2107,9 @@
    "label": "Commission Rate (%)",
    "oldfieldname": "commission_rate",
    "oldfieldtype": "Currency",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "total_commission",
@@ -1796,7 +2120,9 @@
    "oldfieldname": "total_commission",
    "oldfieldtype": "Currency",
    "options": "Company:company:default_currency",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "collapsible": 1,
@@ -1806,7 +2132,9 @@
    "hide_days": 1,
    "hide_seconds": 1,
    "label": "Sales Team",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "allow_on_submit": 1,
@@ -1818,7 +2146,9 @@
    "oldfieldname": "sales_team",
    "oldfieldtype": "Table",
    "options": "Sales Team",
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "collapsible": 1,
@@ -1826,7 +2156,9 @@
    "fieldtype": "Section Break",
    "hide_days": 1,
    "hide_seconds": 1,
-   "label": "Subscription Section"
+   "label": "Subscription Section",
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "allow_on_submit": 1,
@@ -1836,7 +2168,9 @@
    "hide_seconds": 1,
    "label": "From Date",
    "no_copy": 1,
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "allow_on_submit": 1,
@@ -1846,13 +2180,17 @@
    "hide_seconds": 1,
    "label": "To Date",
    "no_copy": 1,
-   "print_hide": 1
+   "print_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "column_break_140",
    "fieldtype": "Column Break",
    "hide_days": 1,
-   "hide_seconds": 1
+   "hide_seconds": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "allow_on_submit": 1,
@@ -1864,7 +2202,9 @@
    "no_copy": 1,
    "options": "Auto Repeat",
    "print_hide": 1,
-   "read_only": 1
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "allow_on_submit": 1,
@@ -1873,7 +2213,9 @@
    "fieldtype": "Button",
    "hide_days": 1,
    "hide_seconds": 1,
-   "label": "Update Auto Repeat Reference"
+   "label": "Update Auto Repeat Reference",
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "against_income_account",
@@ -1886,7 +2228,9 @@
    "oldfieldname": "against_income_account",
    "oldfieldtype": "Small Text",
    "print_hide": 1,
-   "report_hide": 1
+   "report_hide": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "collapsible": 1,
@@ -1894,13 +2238,17 @@
    "fieldtype": "Section Break",
    "hide_days": 1,
    "hide_seconds": 1,
-   "label": "Accounting Dimensions"
+   "label": "Accounting Dimensions",
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "dimension_col_break",
    "fieldtype": "Column Break",
    "hide_days": 1,
-   "hide_seconds": 1
+   "hide_seconds": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "default": "0",
@@ -1908,7 +2256,9 @@
    "fieldname": "is_consolidated",
    "fieldtype": "Check",
    "label": "Is Consolidated",
-   "read_only": 1
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "default": "0",
@@ -1918,14 +2268,18 @@
    "hide_days": 1,
    "hide_seconds": 1,
    "label": "Is Internal Customer",
-   "read_only": 1
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fetch_from": "company.tax_id",
    "fieldname": "company_tax_id",
    "fieldtype": "Data",
    "label": "Company Tax ID",
-   "read_only": 1
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "depends_on": "eval:doc.is_internal_customer",
@@ -1933,7 +2287,9 @@
    "fieldname": "unrealized_profit_loss_account",
    "fieldtype": "Link",
    "label": "Unrealized Profit / Loss Account",
-   "options": "Account"
+   "options": "Account",
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "depends_on": "eval:doc.is_internal_customer",
@@ -1943,31 +2299,47 @@
    "fieldtype": "Link",
    "label": "Represents Company",
    "options": "Company",
-   "read_only": 1
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "column_break_55",
-   "fieldtype": "Column Break"
+   "fieldtype": "Column Break",
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "depends_on": "eval: doc.is_internal_customer && doc.update_stock",
    "fieldname": "set_target_warehouse",
    "fieldtype": "Link",
    "label": "Set Target Warehouse",
-   "options": "Warehouse"
+   "options": "Warehouse",
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "default": "0",
    "fieldname": "is_debit_note",
    "fieldtype": "Check",
-   "label": "Is Debit Note"
+   "label": "Is Debit Note",
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "default": "0",
    "depends_on": "grand_total",
    "fieldname": "disable_rounded_total",
    "fieldtype": "Check",
-   "label": "Disable Rounded Total"
+   "label": "Disable Rounded Total",
+   "show_days": 1,
+   "show_seconds": 1
+  },
+  {
+   "fieldname": "additional_discount_account",
+   "fieldtype": "Link",
+   "label": "Additional Discount Account",
+   "options": "Account"
   },
   {
    "allow_on_submit": 1,
@@ -1983,6 +2355,16 @@
    "fieldtype": "Small Text",
    "label": "Dispatch Address",
    "read_only": 1
+  },
+  {
+   "default": "0",
+   "fieldname": "ignore_default_payment_terms_template",
+   "fieldtype": "Check",
+   "hidden": 1,
+   "label": "Ignore Default Payment Terms Template",
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   }
  ],
  "icon": "fa fa-file-text",
@@ -1995,7 +2377,7 @@
    "link_fieldname": "consolidated_invoice"
   }
  ],
- "modified": "2021-07-08 14:03:55.502522",
+ "modified": "2021-08-07 23:02:20.445127",
  "modified_by": "Administrator",
  "module": "Accounts",
  "name": "Sales Invoice",
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
index cecc1a1..5fa6228 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
@@ -4,7 +4,7 @@
 from __future__ import unicode_literals
 import frappe, erpnext
 import frappe.defaults
-from frappe.utils import cint, flt, getdate, add_days, cstr, nowdate, get_link_to_form, formatdate
+from frappe.utils import cint, flt, getdate, add_days, add_months, cstr, nowdate, get_link_to_form, formatdate
 from frappe import _, msgprint, throw
 from erpnext.accounts.party import get_party_account, get_due_date, get_party_details
 from frappe.model.mapper import get_mapped_doc
@@ -13,7 +13,7 @@
 from erpnext.stock.doctype.delivery_note.delivery_note import update_billed_amount_based_on_so
 from erpnext.projects.doctype.timesheet.timesheet import get_projectwise_timesheet_data
 from erpnext.assets.doctype.asset.depreciation \
-	import get_disposal_account_and_cost_center, get_gl_entries_on_asset_disposal, get_gl_entries_on_asset_regain
+	import get_disposal_account_and_cost_center, get_gl_entries_on_asset_disposal, get_gl_entries_on_asset_regain, post_depreciation_entries
 from erpnext.stock.doctype.batch.batch import set_batch_nos
 from erpnext.stock.doctype.serial_no.serial_no import get_serial_nos, get_delivery_note_serial_no
 from erpnext.setup.doctype.company.company import update_company_current_month_sales
@@ -478,6 +478,9 @@
 		if cint(self.is_pos) != 1:
 			return
 
+		if not self.account_for_change_amount:
+			self.account_for_change_amount = frappe.get_cached_value('Company',  self.company,  'default_cash_account')
+
 		from erpnext.stock.get_item_details import get_pos_profile_item_details, get_pos_profile
 		if not self.pos_profile:
 			pos_profile = get_pos_profile(self.company) or {}
@@ -492,9 +495,6 @@
 		if not self.get('payments') and not for_validate:
 			update_multi_mode_option(self, pos)
 
-		if not self.account_for_change_amount:
-			self.account_for_change_amount = frappe.get_cached_value('Company',  self.company,  'default_cash_account')
-
 		if pos:
 			if not for_validate:
 				self.tax_category = pos.get("tax_category")
@@ -848,6 +848,7 @@
 		self.allocate_advance_taxes(gl_entries)
 
 		self.make_item_gl_entries(gl_entries)
+		self.make_discount_gl_entries(gl_entries)
 
 		# merge gl entries before adding pos entries
 		gl_entries = merge_similar_entries(gl_entries)
@@ -887,18 +888,22 @@
 			)
 
 	def make_tax_gl_entries(self, gl_entries):
+		enable_discount_accounting = cint(frappe.db.get_single_value('Accounts Settings', 'enable_discount_accounting'))
+
 		for tax in self.get("taxes"):
+			amount, base_amount = self.get_tax_amounts(tax, enable_discount_accounting)
+
 			if flt(tax.base_tax_amount_after_discount_amount):
 				account_currency = get_account_currency(tax.account_head)
 				gl_entries.append(
 					self.get_gl_dict({
 						"account": tax.account_head,
 						"against": self.customer,
-						"credit": flt(tax.base_tax_amount_after_discount_amount,
+						"credit": flt(base_amount,
 							tax.precision("tax_amount_after_discount_amount")),
-						"credit_in_account_currency": (flt(tax.base_tax_amount_after_discount_amount,
+						"credit_in_account_currency": (flt(base_amount,
 							tax.precision("base_tax_amount_after_discount_amount")) if account_currency==self.company_currency else
-							flt(tax.tax_amount_after_discount_amount, tax.precision("tax_amount_after_discount_amount"))),
+							flt(amount, tax.precision("tax_amount_after_discount_amount"))),
 						"cost_center": tax.cost_center
 					}, account_currency, item=tax)
 				)
@@ -917,30 +922,29 @@
 
 	def make_item_gl_entries(self, gl_entries):
 		# income account gl entries
+		enable_discount_accounting = cint(frappe.db.get_single_value('Accounts Settings', 'enable_discount_accounting'))
+
 		for item in self.get("items"):
 			if flt(item.base_net_amount, item.precision("base_net_amount")):
 				if item.is_fixed_asset:
-					if item.get('asset'):
-						asset = frappe.get_doc("Asset", item.asset)
-					else:
-						frappe.throw(_(
-							"Row #{0}: You must select an Asset for Item {1}.").format(item.idx, item.item_name),
-							title=_("Missing Asset")
-						)
-					if (len(asset.finance_books) > 1 and not item.finance_book
-						and asset.finance_books[0].finance_book):
-						frappe.throw(_("Select finance book for the item {0} at row {1}")
-							.format(item.item_code, item.idx))
+					asset = self.get_asset(item)
 
 					if self.is_return:
 						fixed_asset_gl_entries = get_gl_entries_on_asset_regain(asset,
 							item.base_net_amount, item.finance_book)
 						asset.db_set("disposal_date", None)
+
+						if asset.calculate_depreciation:
+							self.reset_depreciation_schedule(asset)
+
 					else:
 						fixed_asset_gl_entries = get_gl_entries_on_asset_disposal(asset,
 							item.base_net_amount, item.finance_book)
 						asset.db_set("disposal_date", self.posting_date)
 
+						if asset.calculate_depreciation:
+							self.depreciate_asset(asset)
+
 					for gle in fixed_asset_gl_entries:
 						gle["against"] = self.customer
 						gl_entries.append(self.get_gl_dict(gle, item=item))
@@ -953,15 +957,17 @@
 						income_account = (item.income_account
 							if (not item.enable_deferred_revenue or self.is_return) else item.deferred_revenue_account)
 
+						amount, base_amount = self.get_amount_and_base_amount(item, enable_discount_accounting)
+
 						account_currency = get_account_currency(income_account)
 						gl_entries.append(
 							self.get_gl_dict({
 								"account": income_account,
 								"against": self.customer,
-								"credit": flt(item.base_net_amount, item.precision("base_net_amount")),
-								"credit_in_account_currency": (flt(item.base_net_amount, item.precision("base_net_amount"))
+								"credit": flt(base_amount, item.precision("base_net_amount")),
+								"credit_in_account_currency": (flt(base_amount, item.precision("base_net_amount"))
 									if account_currency==self.company_currency
-									else flt(item.net_amount, item.precision("net_amount"))),
+									else flt(amount, item.precision("net_amount"))),
 								"cost_center": item.cost_center,
 								"project": item.project or self.project
 							}, account_currency, item=item)
@@ -972,6 +978,96 @@
 			erpnext.is_perpetual_inventory_enabled(self.company):
 			gl_entries += super(SalesInvoice, self).get_gl_entries()
 
+	def get_asset(self, item):
+		if item.get('asset'):
+			asset = frappe.get_doc("Asset", item.asset)
+		else:
+			frappe.throw(_(
+				"Row #{0}: You must select an Asset for Item {1}.").format(item.idx, item.item_name),
+				title=_("Missing Asset")
+			)
+
+		self.check_finance_books(item, asset)
+		return asset
+
+	def check_finance_books(self, item, asset):
+		if (len(asset.finance_books) > 1 and not item.finance_book
+			and asset.finance_books[0].finance_book):
+			frappe.throw(_("Select finance book for the item {0} at row {1}")
+				.format(item.item_code, item.idx))
+
+	def depreciate_asset(self, asset):
+		asset.flags.ignore_validate_update_after_submit = True
+		asset.prepare_depreciation_data(self.posting_date)
+		asset.save()
+
+		post_depreciation_entries(self.posting_date)
+
+	def reset_depreciation_schedule(self, asset):
+		asset.flags.ignore_validate_update_after_submit = True
+
+		# recreate original depreciation schedule of the asset
+		asset.prepare_depreciation_data()
+
+		self.modify_depreciation_schedule_for_asset_repairs(asset)
+		asset.save()
+
+		self.delete_depreciation_entry_made_after_sale(asset)
+
+	def modify_depreciation_schedule_for_asset_repairs(self, asset):
+		asset_repairs = frappe.get_all(
+			'Asset Repair',
+			filters = {'asset': asset.name},
+			fields = ['name', 'increase_in_asset_life']
+		)
+
+		for repair in asset_repairs:
+			if repair.increase_in_asset_life:
+				asset_repair = frappe.get_doc('Asset Repair', repair.name)
+				asset_repair.modify_depreciation_schedule()
+				asset.prepare_depreciation_data()
+
+	def delete_depreciation_entry_made_after_sale(self, asset):
+		from erpnext.accounts.doctype.journal_entry.journal_entry import make_reverse_journal_entry
+
+		posting_date_of_original_invoice = self.get_posting_date_of_sales_invoice()
+
+		row = -1
+		finance_book = asset.get('schedules')[0].get('finance_book')
+		for schedule in asset.get('schedules'):
+			if schedule.finance_book != finance_book:
+				row = 0
+				finance_book = schedule.finance_book
+			else:
+				row += 1
+
+			if schedule.schedule_date == posting_date_of_original_invoice:
+				if not self.sale_was_made_on_original_schedule_date(asset, schedule, row, posting_date_of_original_invoice):
+					reverse_journal_entry = make_reverse_journal_entry(schedule.journal_entry)
+					reverse_journal_entry.posting_date = nowdate()
+					reverse_journal_entry.submit()
+
+	def get_posting_date_of_sales_invoice(self):
+		return frappe.db.get_value('Sales Invoice', self.return_against, 'posting_date')
+
+	# if the invoice had been posted on the date the depreciation was initially supposed to happen, the depreciation shouldn't be undone
+	def sale_was_made_on_original_schedule_date(self, asset, schedule, row, posting_date_of_original_invoice):
+		for finance_book in asset.get('finance_books'):
+			if schedule.finance_book == finance_book.finance_book:
+				orginal_schedule_date = add_months(finance_book.depreciation_start_date,
+					row * cint(finance_book.frequency_of_depreciation))
+
+				if orginal_schedule_date == posting_date_of_original_invoice:
+					return True
+		return False
+
+	@property
+	def enable_discount_accounting(self):
+		if not hasattr(self, "_enable_discount_accounting"):
+			self._enable_discount_accounting = cint(frappe.db.get_single_value('Accounts Settings', 'enable_discount_accounting'))
+
+		return self._enable_discount_accounting
+
 	def set_asset_status(self, asset):
 		if self.is_return:
 			asset.set_status()
@@ -1367,7 +1463,7 @@
 
 		discounting_status = None
 		if self.is_discounted:
-			discountng_status = get_discounting_status(self.name)
+			discounting_status = get_discounting_status(self.name)
 
 		if not status:
 			if self.docstatus == 2:
@@ -1375,11 +1471,11 @@
 			elif self.docstatus == 1:
 				if self.is_internal_transfer():
 					self.status = 'Internal Transfer'
-				elif outstanding_amount > 0 and due_date < nowdate and self.is_discounted and discountng_status=='Disbursed':
+				elif outstanding_amount > 0 and due_date < nowdate and self.is_discounted and discounting_status=='Disbursed':
 					self.status = "Overdue and Discounted"
 				elif outstanding_amount > 0 and due_date < nowdate:
 					self.status = "Overdue"
-				elif outstanding_amount > 0 and due_date >= nowdate and self.is_discounted and discountng_status=='Disbursed':
+				elif outstanding_amount > 0 and due_date >= nowdate and self.is_discounted and discounting_status=='Disbursed':
 					self.status = "Unpaid and Discounted"
 				elif outstanding_amount > 0 and due_date >= nowdate:
 					self.status = "Unpaid"
diff --git a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py
index be20b18..4d1e0c3 100644
--- a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py
+++ b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py
@@ -12,6 +12,7 @@
 from erpnext.accounts.doctype.purchase_invoice.purchase_invoice import WarehouseMissingError
 from erpnext.accounts.doctype.pos_profile.test_pos_profile import make_pos_profile
 from erpnext.assets.doctype.asset.test_asset import create_asset, create_asset_data
+from erpnext.assets.doctype.asset.depreciation import post_depreciation_entries
 from erpnext.exceptions import InvalidAccountCurrency, InvalidCurrency
 from erpnext.stock.doctype.serial_no.serial_no import SerialNoWarehouseError
 from frappe.model.naming import make_autoname
@@ -2101,6 +2102,78 @@
 		sales_invoice.save()
 		self.assertEqual(sales_invoice.items[0].item_tax_template, "_Test Account Excise Duty @ 10 - _TC")
 
+	def test_sales_invoice_with_discount_accounting_enabled(self):
+		from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice import enable_discount_accounting
+
+		enable_discount_accounting()
+
+		discount_account = create_account(account_name="Discount Account",
+			parent_account="Indirect Expenses - _TC", company="_Test Company")
+		si = create_sales_invoice(discount_account=discount_account, discount_percentage=10, rate=90)
+
+		expected_gle = [
+			["Debtors - _TC", 90.0, 0.0, nowdate()],
+			["Discount Account - _TC", 10.0, 0.0, nowdate()],
+			["Sales - _TC", 0.0, 100.0, nowdate()]
+		]
+
+		check_gl_entries(self, si.name, expected_gle, add_days(nowdate(), -1))
+		enable_discount_accounting(enable=0)
+
+	def test_additional_discount_for_sales_invoice_with_discount_accounting_enabled(self):
+		from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice import enable_discount_accounting
+
+		enable_discount_accounting()
+		additional_discount_account = create_account(account_name="Discount Account",
+			parent_account="Indirect Expenses - _TC", company="_Test Company")
+
+		si = create_sales_invoice(parent_cost_center='Main - _TC', do_not_save=1)
+		si.apply_discount_on = "Grand Total"
+		si.additional_discount_account = additional_discount_account
+		si.additional_discount_percentage = 20
+		si.append("taxes", {
+			"charge_type": "On Net Total",
+			"account_head": "_Test Account VAT - _TC",
+			"cost_center": "Main - _TC",
+			"description": "Test",
+			"rate": 10
+		})
+		si.submit()
+
+		expected_gle = [
+			["_Test Account VAT - _TC", 0.0, 10.0, nowdate()],
+			["Debtors - _TC", 88, 0.0, nowdate()],
+			["Discount Account - _TC", 22.0, 0.0, nowdate()],
+			["Sales - _TC", 0.0, 100.0, nowdate()]
+		]
+
+		check_gl_entries(self, si.name, expected_gle, add_days(nowdate(), -1))
+		enable_discount_accounting(enable=0)
+
+	def test_asset_depreciation_on_sale(self):
+		"""
+			Tests if an Asset set to depreciate yearly on June 30, that gets sold on Sept 30, creates an additional depreciation entry on Sept 30.
+		"""
+
+		create_asset_data()
+		asset = create_asset(item_code="Macbook Pro", calculate_depreciation=1, submit=1)
+		post_depreciation_entries(getdate("2021-09-30"))
+
+		create_sales_invoice(item_code="Macbook Pro", asset=asset.name, qty=1, rate=90000, posting_date=getdate("2021-09-30"))
+		asset.load_from_db()
+
+		expected_values = [
+			["2020-06-30", 1311.48, 1311.48],
+			["2021-06-30", 20000.0, 21311.48],
+			["2021-09-30", 3966.76, 25278.24]
+		]
+
+		for i, schedule in enumerate(asset.schedules):
+			self.assertEqual(getdate(expected_values[i][0]), schedule.schedule_date)
+			self.assertEqual(expected_values[i][1], schedule.depreciation_amount)
+			self.assertEqual(expected_values[i][2], schedule.accumulated_depreciation_amount)
+			self.assertTrue(schedule.journal_entry)
+
 def get_sales_invoice_for_e_invoice():
 	si = make_sales_invoice_for_ewaybill()
 	si.naming_series = 'INV-2020-.#####'
@@ -2293,6 +2366,7 @@
 	si.currency=args.currency or "INR"
 	si.conversion_rate = args.conversion_rate or 1
 	si.naming_series = args.naming_series or "T-SINV-"
+	si.cost_center = args.parent_cost_center
 
 	si.append("items", {
 		"item_code": args.item or args.item_code or "_Test Item",
@@ -2304,8 +2378,11 @@
 		"uom": args.uom or "Nos",
 		"stock_uom": args.uom or "Nos",
 		"rate": args.rate if args.get("rate") is not None else 100,
+		"price_list_rate": args.price_list_rate if args.get("price_list_rate") is not None else 100,
 		"income_account": args.income_account or "Sales - _TC",
 		"expense_account": args.expense_account or "Cost of Goods Sold - _TC",
+		"discount_account": args.discount_account or None,
+		"discount_amount": args.discount_amount or 0,
 		"asset": args.asset or None,
 		"cost_center": args.cost_center or "_Test Cost Center - _TC",
 		"serial_no": args.serial_no,
diff --git a/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json b/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json
index 6690bda..c77076c 100644
--- a/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json
+++ b/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json
@@ -63,6 +63,7 @@
   "finance_book",
   "col_break4",
   "expense_account",
+  "discount_account",
   "deferred_revenue",
   "deferred_revenue_account",
   "service_stop_date",
@@ -473,6 +474,7 @@
   },
   {
    "collapsible": 1,
+   "collapsible_depends_on": "enable_deferred_revenue",
    "fieldname": "deferred_revenue",
    "fieldtype": "Section Break",
    "label": "Deferred Revenue"
@@ -820,12 +822,18 @@
    "no_copy": 1,
    "options": "currency",
    "read_only": 1
+  },
+  {
+   "fieldname": "discount_account",
+   "fieldtype": "Link",
+   "label": "Discount Account",
+   "options": "Account"
   }
  ],
  "idx": 1,
  "istable": 1,
  "links": [],
- "modified": "2021-06-21 23:03:11.599901",
+ "modified": "2021-08-12 20:15:47.668399",
  "modified_by": "Administrator",
  "module": "Accounts",
  "name": "Sales Invoice Item",
diff --git a/erpnext/accounts/doctype/sales_invoice_timesheet/sales_invoice_timesheet.json b/erpnext/accounts/doctype/sales_invoice_timesheet/sales_invoice_timesheet.json
index f069e8d..c902973 100644
--- a/erpnext/accounts/doctype/sales_invoice_timesheet/sales_invoice_timesheet.json
+++ b/erpnext/accounts/doctype/sales_invoice_timesheet/sales_invoice_timesheet.json
@@ -9,7 +9,9 @@
   "description",
   "billing_hours",
   "billing_amount",
+  "column_break_5",
   "time_sheet",
+  "project_name",
   "timesheet_detail"
  ],
  "fields": [
@@ -61,11 +63,21 @@
    "in_list_view": 1,
    "label": "Description",
    "read_only": 1
+  },
+  {
+   "fieldname": "column_break_5",
+   "fieldtype": "Column Break"
+  },
+  {
+   "fieldname": "project_name",
+   "fieldtype": "Data",
+   "label": "Project Name",
+   "read_only": 1
   }
  ],
  "istable": 1,
  "links": [],
- "modified": "2021-05-20 22:33:57.234846",
+ "modified": "2021-06-08 14:43:02.748981",
  "modified_by": "Administrator",
  "module": "Accounts",
  "name": "Sales Invoice Timesheet",
diff --git a/erpnext/accounts/doctype/sales_partner_item/__init__.py b/erpnext/accounts/doctype/sales_partner_item/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/erpnext/accounts/doctype/sales_partner_item/__init__.py
diff --git a/erpnext/accounts/doctype/sales_partner_item/sales_partner_item.json b/erpnext/accounts/doctype/sales_partner_item/sales_partner_item.json
new file mode 100644
index 0000000..c176e4d
--- /dev/null
+++ b/erpnext/accounts/doctype/sales_partner_item/sales_partner_item.json
@@ -0,0 +1,31 @@
+{
+ "actions": [],
+ "creation": "2021-05-06 16:17:44.329943",
+ "doctype": "DocType",
+ "editable_grid": 1,
+ "engine": "InnoDB",
+ "field_order": [
+  "sales_partner"
+ ],
+ "fields": [
+  {
+   "fieldname": "sales_partner",
+   "fieldtype": "Link",
+   "in_list_view": 1,
+   "label": "Sales Partner ",
+   "options": "Sales Partner"
+  }
+ ],
+ "index_web_pages_for_search": 1,
+ "istable": 1,
+ "links": [],
+ "modified": "2021-05-07 10:43:37.532095",
+ "modified_by": "Administrator",
+ "module": "Accounts",
+ "name": "Sales Partner Item",
+ "owner": "Administrator",
+ "permissions": [],
+ "sort_field": "modified",
+ "sort_order": "DESC",
+ "track_changes": 1
+}
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/sales_partner_item/sales_partner_item.py b/erpnext/accounts/doctype/sales_partner_item/sales_partner_item.py
new file mode 100644
index 0000000..9796c7b
--- /dev/null
+++ b/erpnext/accounts/doctype/sales_partner_item/sales_partner_item.py
@@ -0,0 +1,8 @@
+# Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and contributors
+# For license information, please see license.txt
+
+# import frappe
+from frappe.model.document import Document
+
+class SalesPartnerItem(Document):
+	pass
diff --git a/erpnext/accounts/doctype/sales_taxes_and_charges/sales_taxes_and_charges.json b/erpnext/accounts/doctype/sales_taxes_and_charges/sales_taxes_and_charges.json
index cfdb167..3a871bf 100644
--- a/erpnext/accounts/doctype/sales_taxes_and_charges/sales_taxes_and_charges.json
+++ b/erpnext/accounts/doctype/sales_taxes_and_charges/sales_taxes_and_charges.json
@@ -19,7 +19,7 @@
   "section_break_8",
   "rate",
   "section_break_9",
-  "currency",
+  "account_currency",
   "tax_amount",
   "total",
   "tax_amount_after_discount_amount",
@@ -187,14 +187,6 @@
    "fieldtype": "Column Break"
   },
   {
-   "fetch_from": "account_head.account_currency",
-   "fieldname": "currency",
-   "fieldtype": "Link",
-   "label": "Account Currency",
-   "options": "Currency",
-   "read_only": 1
-  },
-  {
    "default": "0",
    "depends_on": "eval:['Sales Taxes and Charges Template', 'Payment Entry'].includes(parent.doctype)",
    "description": "If checked, the tax amount will be considered as already included in the Paid Amount in Payment Entry",
@@ -210,13 +202,21 @@
    "label": "Dont Recompute tax",
    "print_hide": 1,
    "read_only": 1
+  },
+  {
+   "fetch_from": "account_head.account_currency",
+   "fieldname": "account_currency",
+   "fieldtype": "Link",
+   "label": "Account Currency",
+   "options": "Currency",
+   "read_only": 1
   }
  ],
  "idx": 1,
  "index_web_pages_for_search": 1,
  "istable": 1,
  "links": [],
- "modified": "2021-07-27 12:40:59.051803",
+ "modified": "2021-08-05 20:04:01.726867",
  "modified_by": "Administrator",
  "module": "Accounts",
  "name": "Sales Taxes and Charges",
diff --git a/erpnext/accounts/doctype/supplier_group_item/__init__.py b/erpnext/accounts/doctype/supplier_group_item/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/erpnext/accounts/doctype/supplier_group_item/__init__.py
diff --git a/erpnext/accounts/doctype/supplier_group_item/supplier_group_item.json b/erpnext/accounts/doctype/supplier_group_item/supplier_group_item.json
new file mode 100644
index 0000000..67fac45
--- /dev/null
+++ b/erpnext/accounts/doctype/supplier_group_item/supplier_group_item.json
@@ -0,0 +1,31 @@
+{
+ "actions": [],
+ "creation": "2021-05-06 16:19:22.040795",
+ "doctype": "DocType",
+ "editable_grid": 1,
+ "engine": "InnoDB",
+ "field_order": [
+  "supplier_group"
+ ],
+ "fields": [
+  {
+   "fieldname": "supplier_group",
+   "fieldtype": "Link",
+   "in_list_view": 1,
+   "label": "Supplier Group",
+   "options": "Supplier Group"
+  }
+ ],
+ "index_web_pages_for_search": 1,
+ "istable": 1,
+ "links": [],
+ "modified": "2021-05-07 10:43:59.877938",
+ "modified_by": "Administrator",
+ "module": "Accounts",
+ "name": "Supplier Group Item",
+ "owner": "Administrator",
+ "permissions": [],
+ "sort_field": "modified",
+ "sort_order": "DESC",
+ "track_changes": 1
+}
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/supplier_group_item/supplier_group_item.py b/erpnext/accounts/doctype/supplier_group_item/supplier_group_item.py
new file mode 100644
index 0000000..de0444e
--- /dev/null
+++ b/erpnext/accounts/doctype/supplier_group_item/supplier_group_item.py
@@ -0,0 +1,8 @@
+# Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and contributors
+# For license information, please see license.txt
+
+# import frappe
+from frappe.model.document import Document
+
+class SupplierGroupItem(Document):
+	pass
diff --git a/erpnext/accounts/doctype/supplier_item/__init__.py b/erpnext/accounts/doctype/supplier_item/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/erpnext/accounts/doctype/supplier_item/__init__.py
diff --git a/erpnext/accounts/doctype/supplier_item/supplier_item.json b/erpnext/accounts/doctype/supplier_item/supplier_item.json
new file mode 100644
index 0000000..95c4dc6
--- /dev/null
+++ b/erpnext/accounts/doctype/supplier_item/supplier_item.json
@@ -0,0 +1,31 @@
+{
+ "actions": [],
+ "creation": "2021-05-06 16:18:54.758468",
+ "doctype": "DocType",
+ "editable_grid": 1,
+ "engine": "InnoDB",
+ "field_order": [
+  "supplier"
+ ],
+ "fields": [
+  {
+   "fieldname": "supplier",
+   "fieldtype": "Link",
+   "in_list_view": 1,
+   "label": "Supplier",
+   "options": "Supplier"
+  }
+ ],
+ "index_web_pages_for_search": 1,
+ "istable": 1,
+ "links": [],
+ "modified": "2021-05-07 10:44:09.707778",
+ "modified_by": "Administrator",
+ "module": "Accounts",
+ "name": "Supplier Item",
+ "owner": "Administrator",
+ "permissions": [],
+ "sort_field": "modified",
+ "sort_order": "DESC",
+ "track_changes": 1
+}
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/supplier_item/supplier_item.py b/erpnext/accounts/doctype/supplier_item/supplier_item.py
new file mode 100644
index 0000000..ad66e23
--- /dev/null
+++ b/erpnext/accounts/doctype/supplier_item/supplier_item.py
@@ -0,0 +1,8 @@
+# Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and contributors
+# For license information, please see license.txt
+
+# import frappe
+from frappe.model.document import Document
+
+class SupplierItem(Document):
+	pass
diff --git a/erpnext/accounts/doctype/territory_item/__init__.py b/erpnext/accounts/doctype/territory_item/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/erpnext/accounts/doctype/territory_item/__init__.py
diff --git a/erpnext/accounts/doctype/territory_item/territory_item.json b/erpnext/accounts/doctype/territory_item/territory_item.json
new file mode 100644
index 0000000..0f0fdea
--- /dev/null
+++ b/erpnext/accounts/doctype/territory_item/territory_item.json
@@ -0,0 +1,31 @@
+{
+ "actions": [],
+ "creation": "2021-05-06 16:16:51.885441",
+ "doctype": "DocType",
+ "editable_grid": 1,
+ "engine": "InnoDB",
+ "field_order": [
+  "territory"
+ ],
+ "fields": [
+  {
+   "fieldname": "territory",
+   "fieldtype": "Link",
+   "in_list_view": 1,
+   "label": "Territory",
+   "options": "Territory"
+  }
+ ],
+ "index_web_pages_for_search": 1,
+ "istable": 1,
+ "links": [],
+ "modified": "2021-05-07 10:43:26.641030",
+ "modified_by": "Administrator",
+ "module": "Accounts",
+ "name": "Territory Item",
+ "owner": "Administrator",
+ "permissions": [],
+ "sort_field": "modified",
+ "sort_order": "DESC",
+ "track_changes": 1
+}
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/territory_item/territory_item.py b/erpnext/accounts/doctype/territory_item/territory_item.py
new file mode 100644
index 0000000..d46edc9
--- /dev/null
+++ b/erpnext/accounts/doctype/territory_item/territory_item.py
@@ -0,0 +1,8 @@
+# Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and contributors
+# For license information, please see license.txt
+
+# import frappe
+from frappe.model.document import Document
+
+class TerritoryItem(Document):
+	pass
diff --git a/erpnext/accounts/party.py b/erpnext/accounts/party.py
index c3b78a4..de7dde9 100644
--- a/erpnext/accounts/party.py
+++ b/erpnext/accounts/party.py
@@ -8,7 +8,7 @@
 from frappe.core.doctype.user_permission.user_permission import get_permitted_documents
 from frappe.model.utils import get_fetch_values
 from frappe.utils import (add_days, getdate, formatdate, date_diff,
-	add_years, get_timestamp, nowdate, flt, cstr, add_months, get_last_day)
+	add_years, get_timestamp, nowdate, flt, cstr, add_months, get_last_day, cint)
 from frappe.contacts.doctype.address.address import (get_address_display,
 	get_default_address, get_company_address)
 from frappe.contacts.doctype.contact.contact import get_contact_details
@@ -58,7 +58,7 @@
 			customer_group=party_details.customer_group, supplier_group=party_details.supplier_group, tax_category=party_details.tax_category,
 			billing_address=party_address, shipping_address=shipping_address)
 
-	if fetch_payment_terms_template:
+	if cint(fetch_payment_terms_template):
 		party_details["payment_terms_template"] = get_payment_terms_template(party.name, party_type, company)
 
 	if not party_details.get("currency"):
diff --git a/erpnext/accounts/print_format/bank_and_cash_payment_voucher/bank_and_cash_payment_voucher.json b/erpnext/accounts/print_format/bank_and_cash_payment_voucher/bank_and_cash_payment_voucher.json
index e3afaec..9e126ba 100644
--- a/erpnext/accounts/print_format/bank_and_cash_payment_voucher/bank_and_cash_payment_voucher.json
+++ b/erpnext/accounts/print_format/bank_and_cash_payment_voucher/bank_and_cash_payment_voucher.json
@@ -16,7 +16,7 @@
  "name": "Bank and Cash Payment Voucher", 
  "owner": "Administrator", 
  "print_format_builder": 0, 
- "print_format_type": "Server", 
+ "print_format_type": "Jinja", 
  "show_section_headings": 0, 
  "standard": "Yes"
 }
\ No newline at end of file
diff --git a/erpnext/accounts/print_format/cheque_printing_format/cheque_printing_format.json b/erpnext/accounts/print_format/cheque_printing_format/cheque_printing_format.json
index 8c9c266..08b8ef8 100755
--- a/erpnext/accounts/print_format/cheque_printing_format/cheque_printing_format.json
+++ b/erpnext/accounts/print_format/cheque_printing_format/cheque_printing_format.json
@@ -10,6 +10,6 @@
  "modified_by": "Administrator", 
  "name": "Cheque Printing Format", 
  "owner": "Administrator", 
- "print_format_type": "Server", 
+ "print_format_type": "Jinja", 
  "standard": "Yes"
 }
\ No newline at end of file
diff --git a/erpnext/accounts/print_format/credit_note/credit_note.json b/erpnext/accounts/print_format/credit_note/credit_note.json
index c5a11cf..d12b872 100644
--- a/erpnext/accounts/print_format/credit_note/credit_note.json
+++ b/erpnext/accounts/print_format/credit_note/credit_note.json
@@ -17,7 +17,7 @@
  "owner": "Administrator",
  "parentfield": "__print_formats",
  "print_format_builder": 0,
- "print_format_type": "Server",
+ "print_format_type": "Jinja",
  "show_section_headings": 0,
  "standard": "Yes"
 }
\ No newline at end of file
diff --git a/erpnext/accounts/print_format/gst_purchase_invoice/gst_purchase_invoice.json b/erpnext/accounts/print_format/gst_purchase_invoice/gst_purchase_invoice.json
index 6d7c3d3..1467f27 100644
--- a/erpnext/accounts/print_format/gst_purchase_invoice/gst_purchase_invoice.json
+++ b/erpnext/accounts/print_format/gst_purchase_invoice/gst_purchase_invoice.json
@@ -16,7 +16,7 @@
  "name": "GST Purchase Invoice", 
  "owner": "Administrator", 
  "print_format_builder": 1, 
- "print_format_type": "Server", 
+ "print_format_type": "Jinja", 
  "show_section_headings": 0, 
  "standard": "Yes"
 }
\ No newline at end of file
diff --git a/erpnext/accounts/print_format/journal_auditing_voucher/journal_auditing_voucher.json b/erpnext/accounts/print_format/journal_auditing_voucher/journal_auditing_voucher.json
index 927e818..e45295d 100644
--- a/erpnext/accounts/print_format/journal_auditing_voucher/journal_auditing_voucher.json
+++ b/erpnext/accounts/print_format/journal_auditing_voucher/journal_auditing_voucher.json
@@ -16,7 +16,7 @@
  "name": "Journal Auditing Voucher", 
  "owner": "Administrator", 
  "print_format_builder": 0, 
- "print_format_type": "Server", 
+ "print_format_type": "Jinja", 
  "show_section_headings": 0, 
  "standard": "Yes"
 }
\ No newline at end of file
diff --git a/erpnext/accounts/print_format/payment_receipt_voucher/payment_receipt_voucher.json b/erpnext/accounts/print_format/payment_receipt_voucher/payment_receipt_voucher.json
index f1de448..c52eeb2 100755
--- a/erpnext/accounts/print_format/payment_receipt_voucher/payment_receipt_voucher.json
+++ b/erpnext/accounts/print_format/payment_receipt_voucher/payment_receipt_voucher.json
@@ -12,6 +12,6 @@
  "name": "Payment Receipt Voucher", 
  "owner": "Administrator", 
  "print_format_builder": 0, 
- "print_format_type": "Server", 
+ "print_format_type": "Jinja", 
  "standard": "Yes"
 }
\ No newline at end of file
diff --git a/erpnext/accounts/print_format/purchase_auditing_voucher/purchase_auditing_voucher.json b/erpnext/accounts/print_format/purchase_auditing_voucher/purchase_auditing_voucher.json
index 73779d4..3398117 100644
--- a/erpnext/accounts/print_format/purchase_auditing_voucher/purchase_auditing_voucher.json
+++ b/erpnext/accounts/print_format/purchase_auditing_voucher/purchase_auditing_voucher.json
@@ -16,7 +16,7 @@
  "name": "Purchase Auditing Voucher", 
  "owner": "Administrator", 
  "print_format_builder": 0, 
- "print_format_type": "Server", 
+ "print_format_type": "Jinja", 
  "show_section_headings": 0, 
  "standard": "Yes"
 }
\ No newline at end of file
diff --git a/erpnext/accounts/print_format/sales_auditing_voucher/sales_auditing_voucher.json b/erpnext/accounts/print_format/sales_auditing_voucher/sales_auditing_voucher.json
index 0544e0b..289e184 100644
--- a/erpnext/accounts/print_format/sales_auditing_voucher/sales_auditing_voucher.json
+++ b/erpnext/accounts/print_format/sales_auditing_voucher/sales_auditing_voucher.json
@@ -16,7 +16,7 @@
  "name": "Sales Auditing Voucher", 
  "owner": "Administrator", 
  "print_format_builder": 0, 
- "print_format_type": "Server", 
+ "print_format_type": "Jinja", 
  "show_section_headings": 0, 
  "standard": "Yes"
 }
\ No newline at end of file
diff --git a/erpnext/accounts/report/budget_variance_report/budget_variance_report.py b/erpnext/accounts/report/budget_variance_report/budget_variance_report.py
index f1b231b..9f0eee8 100644
--- a/erpnext/accounts/report/budget_variance_report/budget_variance_report.py
+++ b/erpnext/accounts/report/budget_variance_report/budget_variance_report.py
@@ -38,8 +38,8 @@
 				GROUP BY parent''',{'dimension':[dimension]})
 			if DCC_allocation:
 				filters['budget_against_filter'] = [DCC_allocation[0][0]]
-				cam_map = get_dimension_account_month_map(filters)
-				dimension_items = cam_map.get(DCC_allocation[0][0])
+				ddc_cam_map = get_dimension_account_month_map(filters)
+				dimension_items = ddc_cam_map.get(DCC_allocation[0][0])
 				if dimension_items:
 					data = get_final_data(dimension, dimension_items, filters, period_month_ranges, data, DCC_allocation[0][1])
 
@@ -48,7 +48,6 @@
 	return columns, data, None, chart
 
 def get_final_data(dimension, dimension_items, filters, period_month_ranges, data, DCC_allocation):
-
 	for account, monthwise_data in iteritems(dimension_items):
 		row = [dimension, account]
 		totals = [0, 0, 0]
diff --git a/erpnext/accounts/workspace/accounting/accounting.json b/erpnext/accounts/workspace/accounting/accounting.json
index 821fa4d..b5bd14d 100644
--- a/erpnext/accounts/workspace/accounting/accounting.json
+++ b/erpnext/accounts/workspace/accounting/accounting.json
@@ -1,28 +1,32 @@
 {
- "category": "Modules",
+ "category": "",
  "charts": [
   {
    "chart_name": "Profit and Loss",
    "label": "Profit and Loss"
   }
  ],
+ "content": "[{\"type\": \"onboarding\", \"data\": {\"onboarding_name\":\"Accounts\", \"col\": 12}}, {\"type\": \"chart\", \"data\": {\"chart_name\": \"Profit and Loss\", \"col\": 12}}, {\"type\": \"spacer\", \"data\": {\"col\": 12}}, {\"type\": \"header\", \"data\": {\"text\": \"Your Shortcuts\", \"level\": 4, \"col\": 12}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Chart of Accounts\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Sales Invoice\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Purchase Invoice\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Journal Entry\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Payment Entry\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Accounts Receivable\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"General Ledger\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Trial Balance\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Dashboard\", \"col\": 4}}, {\"type\": \"spacer\", \"data\": {\"col\": 12}}, {\"type\": \"header\", \"data\": {\"text\": \"Reports & Masters\", \"level\": 4, \"col\": 12}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Accounting Masters\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"General Ledger\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Accounts Receivable\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Accounts Payable\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Reports\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Financial Statements\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Multi Currency\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Settings\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Bank Statement\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Subscription Management\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Goods and Services Tax (GST India)\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Share Management\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Cost Center and Budgeting\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Opening and Closing\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Taxes\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Profitability\", \"col\": 4}}]",
  "creation": "2020-03-02 15:41:59.515192",
  "developer_mode_only": 0,
  "disable_user_customization": 0,
  "docstatus": 0,
  "doctype": "Workspace",
+ "extends": "",
  "extends_another_page": 0,
+ "for_user": "",
  "hide_custom": 0,
  "icon": "accounting",
  "idx": 0,
  "is_default": 0,
- "is_standard": 1,
+ "is_standard": 0,
  "label": "Accounting",
  "links": [
   {
    "hidden": 0,
    "is_query_report": 0,
    "label": "Accounting Masters",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -31,6 +35,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Company",
+   "link_count": 0,
    "link_to": "Company",
    "link_type": "DocType",
    "onboard": 1,
@@ -41,6 +46,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Chart of Accounts",
+   "link_count": 0,
    "link_to": "Account",
    "link_type": "DocType",
    "onboard": 1,
@@ -51,6 +57,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Accounts Settings",
+   "link_count": 0,
    "link_to": "Accounts Settings",
    "link_type": "DocType",
    "onboard": 0,
@@ -61,6 +68,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Fiscal Year",
+   "link_count": 0,
    "link_to": "Fiscal Year",
    "link_type": "DocType",
    "onboard": 0,
@@ -71,6 +79,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Accounting Dimension",
+   "link_count": 0,
    "link_to": "Accounting Dimension",
    "link_type": "DocType",
    "onboard": 0,
@@ -81,6 +90,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Finance Book",
+   "link_count": 0,
    "link_to": "Finance Book",
    "link_type": "DocType",
    "onboard": 0,
@@ -91,6 +101,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Accounting Period",
+   "link_count": 0,
    "link_to": "Accounting Period",
    "link_type": "DocType",
    "onboard": 0,
@@ -101,6 +112,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Payment Term",
+   "link_count": 0,
    "link_to": "Payment Term",
    "link_type": "DocType",
    "onboard": 0,
@@ -110,6 +122,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "General Ledger",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -118,6 +131,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Journal Entry",
+   "link_count": 0,
    "link_to": "Journal Entry",
    "link_type": "DocType",
    "onboard": 0,
@@ -128,6 +142,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Journal Entry Template",
+   "link_count": 0,
    "link_to": "Journal Entry Template",
    "link_type": "DocType",
    "onboard": 0,
@@ -138,6 +153,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "General Ledger",
+   "link_count": 0,
    "link_to": "General Ledger",
    "link_type": "Report",
    "onboard": 0,
@@ -148,6 +164,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Customer Ledger Summary",
+   "link_count": 0,
    "link_to": "Customer Ledger Summary",
    "link_type": "Report",
    "onboard": 0,
@@ -158,6 +175,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Supplier Ledger Summary",
+   "link_count": 0,
    "link_to": "Supplier Ledger Summary",
    "link_type": "Report",
    "onboard": 0,
@@ -167,6 +185,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Accounts Receivable",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -175,6 +194,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Sales Invoice",
+   "link_count": 0,
    "link_to": "Sales Invoice",
    "link_type": "DocType",
    "onboard": 1,
@@ -185,6 +205,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Customer",
+   "link_count": 0,
    "link_to": "Customer",
    "link_type": "DocType",
    "onboard": 1,
@@ -195,6 +216,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Payment Entry",
+   "link_count": 0,
    "link_to": "Payment Entry",
    "link_type": "DocType",
    "onboard": 0,
@@ -205,6 +227,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Payment Request",
+   "link_count": 0,
    "link_to": "Payment Request",
    "link_type": "DocType",
    "onboard": 0,
@@ -215,6 +238,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Accounts Receivable",
+   "link_count": 0,
    "link_to": "Accounts Receivable",
    "link_type": "Report",
    "onboard": 0,
@@ -225,6 +249,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Accounts Receivable Summary",
+   "link_count": 0,
    "link_to": "Accounts Receivable Summary",
    "link_type": "Report",
    "onboard": 0,
@@ -235,6 +260,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Sales Register",
+   "link_count": 0,
    "link_to": "Sales Register",
    "link_type": "Report",
    "onboard": 0,
@@ -245,6 +271,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Item-wise Sales Register",
+   "link_count": 0,
    "link_to": "Item-wise Sales Register",
    "link_type": "Report",
    "onboard": 0,
@@ -255,6 +282,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Sales Order Analysis",
+   "link_count": 0,
    "link_to": "Sales Order Analysis",
    "link_type": "Report",
    "onboard": 0,
@@ -265,6 +293,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Delivered Items To Be Billed",
+   "link_count": 0,
    "link_to": "Delivered Items To Be Billed",
    "link_type": "Report",
    "onboard": 0,
@@ -274,6 +303,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Accounts Payable",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -282,6 +312,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Purchase Invoice",
+   "link_count": 0,
    "link_to": "Purchase Invoice",
    "link_type": "DocType",
    "onboard": 1,
@@ -292,6 +323,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Supplier",
+   "link_count": 0,
    "link_to": "Supplier",
    "link_type": "DocType",
    "onboard": 1,
@@ -302,6 +334,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Payment Entry",
+   "link_count": 0,
    "link_to": "Payment Entry",
    "link_type": "DocType",
    "onboard": 0,
@@ -312,6 +345,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Accounts Payable",
+   "link_count": 0,
    "link_to": "Accounts Payable",
    "link_type": "Report",
    "onboard": 0,
@@ -322,6 +356,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Accounts Payable Summary",
+   "link_count": 0,
    "link_to": "Accounts Payable Summary",
    "link_type": "Report",
    "onboard": 0,
@@ -332,6 +367,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Purchase Register",
+   "link_count": 0,
    "link_to": "Purchase Register",
    "link_type": "Report",
    "onboard": 0,
@@ -342,6 +378,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Item-wise Purchase Register",
+   "link_count": 0,
    "link_to": "Item-wise Purchase Register",
    "link_type": "Report",
    "onboard": 0,
@@ -352,6 +389,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Purchase Order Analysis",
+   "link_count": 0,
    "link_to": "Purchase Order Analysis",
    "link_type": "Report",
    "onboard": 0,
@@ -362,6 +400,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Received Items To Be Billed",
+   "link_count": 0,
    "link_to": "Received Items To Be Billed",
    "link_type": "Report",
    "onboard": 0,
@@ -371,6 +410,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Reports",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -379,6 +419,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Trial Balance for Party",
+   "link_count": 0,
    "link_to": "Trial Balance for Party",
    "link_type": "Report",
    "onboard": 0,
@@ -389,6 +430,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Payment Period Based On Invoice Date",
+   "link_count": 0,
    "link_to": "Payment Period Based On Invoice Date",
    "link_type": "Report",
    "onboard": 0,
@@ -399,6 +441,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Sales Partners Commission",
+   "link_count": 0,
    "link_to": "Sales Partners Commission",
    "link_type": "Report",
    "onboard": 0,
@@ -409,6 +452,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Customer Credit Balance",
+   "link_count": 0,
    "link_to": "Customer Credit Balance",
    "link_type": "Report",
    "onboard": 0,
@@ -419,6 +463,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Sales Payment Summary",
+   "link_count": 0,
    "link_to": "Sales Payment Summary",
    "link_type": "Report",
    "onboard": 0,
@@ -429,6 +474,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Address And Contacts",
+   "link_count": 0,
    "link_to": "Address And Contacts",
    "link_type": "Report",
    "onboard": 0,
@@ -439,6 +485,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Tax Detail",
+   "link_count": 0,
    "link_to": "Tax Detail",
    "link_type": "Report",
    "onboard": 0,
@@ -449,6 +496,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "DATEV Export",
+   "link_count": 0,
    "link_to": "DATEV",
    "link_type": "Report",
    "onboard": 0,
@@ -460,6 +508,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "UAE VAT 201",
+   "link_count": 0,
    "link_to": "UAE VAT 201",
    "link_type": "Report",
    "onboard": 0,
@@ -470,6 +519,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Financial Statements",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -478,6 +528,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Trial Balance",
+   "link_count": 0,
    "link_to": "Trial Balance",
    "link_type": "Report",
    "onboard": 0,
@@ -488,6 +539,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Profit and Loss Statement",
+   "link_count": 0,
    "link_to": "Profit and Loss Statement",
    "link_type": "Report",
    "onboard": 0,
@@ -498,6 +550,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Balance Sheet",
+   "link_count": 0,
    "link_to": "Balance Sheet",
    "link_type": "Report",
    "onboard": 0,
@@ -508,6 +561,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Cash Flow",
+   "link_count": 0,
    "link_to": "Cash Flow",
    "link_type": "Report",
    "onboard": 0,
@@ -518,6 +572,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Consolidated Financial Statement",
+   "link_count": 0,
    "link_to": "Consolidated Financial Statement",
    "link_type": "Report",
    "onboard": 0,
@@ -527,6 +582,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Multi Currency",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -535,6 +591,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Currency",
+   "link_count": 0,
    "link_to": "Currency",
    "link_type": "DocType",
    "onboard": 0,
@@ -545,6 +602,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Currency Exchange",
+   "link_count": 0,
    "link_to": "Currency Exchange",
    "link_type": "DocType",
    "onboard": 0,
@@ -555,6 +613,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Exchange Rate Revaluation",
+   "link_count": 0,
    "link_to": "Exchange Rate Revaluation",
    "link_type": "DocType",
    "onboard": 0,
@@ -564,6 +623,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Settings",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -572,6 +632,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Payment Gateway Account",
+   "link_count": 0,
    "link_to": "Payment Gateway Account",
    "link_type": "DocType",
    "onboard": 0,
@@ -582,6 +643,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Terms and Conditions Template",
+   "link_count": 0,
    "link_to": "Terms and Conditions",
    "link_type": "DocType",
    "onboard": 0,
@@ -592,6 +654,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Mode of Payment",
+   "link_count": 0,
    "link_to": "Mode of Payment",
    "link_type": "DocType",
    "onboard": 0,
@@ -601,6 +664,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Bank Statement",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -609,6 +673,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Bank",
+   "link_count": 0,
    "link_to": "Bank",
    "link_type": "DocType",
    "onboard": 0,
@@ -619,6 +684,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Bank Account",
+   "link_count": 0,
    "link_to": "Bank Account",
    "link_type": "DocType",
    "onboard": 0,
@@ -629,6 +695,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Bank Clearance",
+   "link_count": 0,
    "link_to": "Bank Clearance",
    "link_type": "DocType",
    "onboard": 0,
@@ -639,6 +706,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Bank Reconciliation Tool",
+   "link_count": 0,
    "link_to": "Bank Reconciliation Tool",
    "link_type": "DocType",
    "onboard": 0,
@@ -649,6 +717,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Bank Reconciliation Statement",
+   "link_count": 0,
    "link_to": "Bank Reconciliation Statement",
    "link_type": "Report",
    "onboard": 0,
@@ -658,6 +727,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Subscription Management",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -666,6 +736,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Subscription Plan",
+   "link_count": 0,
    "link_to": "Subscription Plan",
    "link_type": "DocType",
    "onboard": 0,
@@ -676,6 +747,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Subscription",
+   "link_count": 0,
    "link_to": "Subscription",
    "link_type": "DocType",
    "onboard": 0,
@@ -686,6 +758,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Subscription Settings",
+   "link_count": 0,
    "link_to": "Subscription Settings",
    "link_type": "DocType",
    "onboard": 0,
@@ -695,6 +768,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Goods and Services Tax (GST India)",
+   "link_count": 0,
    "onboard": 0,
    "only_for": "India",
    "type": "Card Break"
@@ -704,6 +778,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "GST Settings",
+   "link_count": 0,
    "link_to": "GST Settings",
    "link_type": "DocType",
    "onboard": 0,
@@ -715,6 +790,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "GST HSN Code",
+   "link_count": 0,
    "link_to": "GST HSN Code",
    "link_type": "DocType",
    "onboard": 0,
@@ -726,6 +802,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "GSTR-1",
+   "link_count": 0,
    "link_to": "GSTR-1",
    "link_type": "Report",
    "onboard": 0,
@@ -737,6 +814,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "GSTR-2",
+   "link_count": 0,
    "link_to": "GSTR-2",
    "link_type": "Report",
    "onboard": 0,
@@ -748,6 +826,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "GSTR 3B Report",
+   "link_count": 0,
    "link_to": "GSTR 3B Report",
    "link_type": "DocType",
    "onboard": 0,
@@ -759,6 +838,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "GST Sales Register",
+   "link_count": 0,
    "link_to": "GST Sales Register",
    "link_type": "Report",
    "onboard": 0,
@@ -770,6 +850,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "GST Purchase Register",
+   "link_count": 0,
    "link_to": "GST Purchase Register",
    "link_type": "Report",
    "onboard": 0,
@@ -781,6 +862,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "GST Itemised Sales Register",
+   "link_count": 0,
    "link_to": "GST Itemised Sales Register",
    "link_type": "Report",
    "onboard": 0,
@@ -792,6 +874,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "GST Itemised Purchase Register",
+   "link_count": 0,
    "link_to": "GST Itemised Purchase Register",
    "link_type": "Report",
    "onboard": 0,
@@ -803,6 +886,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "C-Form",
+   "link_count": 0,
    "link_to": "C-Form",
    "link_type": "DocType",
    "onboard": 0,
@@ -814,6 +898,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Lower Deduction Certificate",
+   "link_count": 0,
    "link_to": "Lower Deduction Certificate",
    "link_type": "DocType",
    "onboard": 0,
@@ -824,6 +909,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Share Management",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -832,6 +918,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Shareholder",
+   "link_count": 0,
    "link_to": "Shareholder",
    "link_type": "DocType",
    "onboard": 0,
@@ -842,6 +929,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Share Transfer",
+   "link_count": 0,
    "link_to": "Share Transfer",
    "link_type": "DocType",
    "onboard": 0,
@@ -852,6 +940,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Share Ledger",
+   "link_count": 0,
    "link_to": "Share Ledger",
    "link_type": "Report",
    "onboard": 0,
@@ -862,6 +951,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Share Balance",
+   "link_count": 0,
    "link_to": "Share Balance",
    "link_type": "Report",
    "onboard": 0,
@@ -871,6 +961,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Cost Center and Budgeting",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -879,6 +970,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Chart of Cost Centers",
+   "link_count": 0,
    "link_to": "Cost Center",
    "link_type": "DocType",
    "onboard": 0,
@@ -889,6 +981,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Budget",
+   "link_count": 0,
    "link_to": "Budget",
    "link_type": "DocType",
    "onboard": 0,
@@ -899,6 +992,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Accounting Dimension",
+   "link_count": 0,
    "link_to": "Accounting Dimension",
    "link_type": "DocType",
    "onboard": 0,
@@ -909,6 +1003,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Budget Variance Report",
+   "link_count": 0,
    "link_to": "Budget Variance Report",
    "link_type": "Report",
    "onboard": 0,
@@ -919,6 +1014,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Monthly Distribution",
+   "link_count": 0,
    "link_to": "Monthly Distribution",
    "link_type": "DocType",
    "onboard": 0,
@@ -928,6 +1024,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Opening and Closing",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -936,6 +1033,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Opening Invoice Creation Tool",
+   "link_count": 0,
    "link_to": "Opening Invoice Creation Tool",
    "link_type": "DocType",
    "onboard": 0,
@@ -946,6 +1044,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Chart of Accounts Importer",
+   "link_count": 0,
    "link_to": "Chart of Accounts Importer",
    "link_type": "DocType",
    "onboard": 0,
@@ -956,6 +1055,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Period Closing Voucher",
+   "link_count": 0,
    "link_to": "Period Closing Voucher",
    "link_type": "DocType",
    "onboard": 0,
@@ -965,6 +1065,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Taxes",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -973,6 +1074,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Sales Taxes and Charges Template",
+   "link_count": 0,
    "link_to": "Sales Taxes and Charges Template",
    "link_type": "DocType",
    "onboard": 0,
@@ -983,6 +1085,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Purchase Taxes and Charges Template",
+   "link_count": 0,
    "link_to": "Purchase Taxes and Charges Template",
    "link_type": "DocType",
    "onboard": 0,
@@ -993,6 +1096,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Item Tax Template",
+   "link_count": 0,
    "link_to": "Item Tax Template",
    "link_type": "DocType",
    "onboard": 0,
@@ -1003,6 +1107,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Tax Category",
+   "link_count": 0,
    "link_to": "Tax Category",
    "link_type": "DocType",
    "onboard": 0,
@@ -1013,6 +1118,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Tax Rule",
+   "link_count": 0,
    "link_to": "Tax Rule",
    "link_type": "DocType",
    "onboard": 0,
@@ -1023,6 +1129,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Tax Withholding Category",
+   "link_count": 0,
    "link_to": "Tax Withholding Category",
    "link_type": "DocType",
    "onboard": 0,
@@ -1032,6 +1139,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Profitability",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -1040,6 +1148,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Gross Profit",
+   "link_count": 0,
    "link_to": "Gross Profit",
    "link_type": "Report",
    "onboard": 0,
@@ -1050,6 +1159,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Profitability Analysis",
+   "link_count": 0,
    "link_to": "Profitability Analysis",
    "link_type": "Report",
    "onboard": 0,
@@ -1060,6 +1170,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Sales Invoice Trends",
+   "link_count": 0,
    "link_to": "Sales Invoice Trends",
    "link_type": "Report",
    "onboard": 0,
@@ -1070,20 +1181,26 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Purchase Invoice Trends",
+   "link_count": 0,
    "link_to": "Purchase Invoice Trends",
    "link_type": "Report",
    "onboard": 0,
    "type": "Link"
   }
  ],
- "modified": "2021-06-10 03:17:31.427945",
+ "modified": "2021-08-05 12:15:52.872470",
  "modified_by": "Administrator",
  "module": "Accounts",
  "name": "Accounting",
  "onboarding": "Accounts",
  "owner": "Administrator",
+ "parent_page": "",
  "pin_to_bottom": 0,
  "pin_to_top": 0,
+ "public": 1,
+ "restrict_to_domain": "",
+ "roles": [],
+ "sequence_id": 2,
  "shortcuts": [
   {
    "label": "Chart of Accounts",
@@ -1130,5 +1247,6 @@
    "link_to": "Accounts",
    "type": "Dashboard"
   }
- ]
+ ],
+ "title": "Accounting"
 }
\ No newline at end of file
diff --git a/erpnext/agriculture/workspace/agriculture/agriculture.json b/erpnext/agriculture/workspace/agriculture/agriculture.json
index 2cc2524..633777e 100644
--- a/erpnext/agriculture/workspace/agriculture/agriculture.json
+++ b/erpnext/agriculture/workspace/agriculture/agriculture.json
@@ -1,22 +1,27 @@
 {
- "category": "Domains",
+ "category": "",
  "charts": [],
+ "content": "[{\"type\": \"header\", \"data\": {\"text\": \"Reports & Masters\", \"level\": 4, \"col\": 12}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Crops & Lands\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Analytics\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Diseases & Fertilizers\", \"col\": 4}}]",
  "creation": "2020-03-02 17:23:34.339274",
  "developer_mode_only": 0,
  "disable_user_customization": 0,
  "docstatus": 0,
  "doctype": "Workspace",
+ "extends": "",
  "extends_another_page": 0,
+ "for_user": "",
  "hide_custom": 0,
  "icon": "agriculture",
  "idx": 0,
- "is_standard": 1,
+ "is_default": 0,
+ "is_standard": 0,
  "label": "Agriculture",
  "links": [
   {
    "hidden": 0,
    "is_query_report": 0,
    "label": "Crops & Lands",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -25,6 +30,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Crop",
+   "link_count": 0,
    "link_to": "Crop",
    "link_type": "DocType",
    "onboard": 1,
@@ -35,6 +41,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Crop Cycle",
+   "link_count": 0,
    "link_to": "Crop Cycle",
    "link_type": "DocType",
    "onboard": 1,
@@ -45,6 +52,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Location",
+   "link_count": 0,
    "link_to": "Location",
    "link_type": "DocType",
    "onboard": 1,
@@ -54,6 +62,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Analytics",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -62,6 +71,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Plant Analysis",
+   "link_count": 0,
    "link_to": "Plant Analysis",
    "link_type": "DocType",
    "onboard": 0,
@@ -72,6 +82,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Soil Analysis",
+   "link_count": 0,
    "link_to": "Soil Analysis",
    "link_type": "DocType",
    "onboard": 0,
@@ -82,6 +93,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Water Analysis",
+   "link_count": 0,
    "link_to": "Water Analysis",
    "link_type": "DocType",
    "onboard": 0,
@@ -92,6 +104,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Soil Texture",
+   "link_count": 0,
    "link_to": "Soil Texture",
    "link_type": "DocType",
    "onboard": 0,
@@ -102,6 +115,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Weather",
+   "link_count": 0,
    "link_to": "Weather",
    "link_type": "DocType",
    "onboard": 0,
@@ -112,6 +126,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Agriculture Analysis Criteria",
+   "link_count": 0,
    "link_to": "Agriculture Analysis Criteria",
    "link_type": "DocType",
    "onboard": 0,
@@ -121,6 +136,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Diseases & Fertilizers",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -129,6 +145,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Disease",
+   "link_count": 0,
    "link_to": "Disease",
    "link_type": "DocType",
    "onboard": 1,
@@ -139,19 +156,26 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Fertilizer",
+   "link_count": 0,
    "link_to": "Fertilizer",
    "link_type": "DocType",
    "onboard": 1,
    "type": "Link"
   }
  ],
- "modified": "2020-12-01 13:38:38.477493",
+ "modified": "2021-08-05 12:15:54.595197",
  "modified_by": "Administrator",
  "module": "Agriculture",
  "name": "Agriculture",
+ "onboarding": "",
  "owner": "Administrator",
+ "parent_page": "",
  "pin_to_bottom": 0,
  "pin_to_top": 0,
+ "public": 1,
  "restrict_to_domain": "Agriculture",
- "shortcuts": []
+ "roles": [],
+ "sequence_id": 3,
+ "shortcuts": [],
+ "title": "Agriculture"
 }
\ No newline at end of file
diff --git a/erpnext/assets/doctype/asset/asset.py b/erpnext/assets/doctype/asset/asset.py
index 66f0bdc..7afb43b 100644
--- a/erpnext/assets/doctype/asset/asset.py
+++ b/erpnext/assets/doctype/asset/asset.py
@@ -56,12 +56,12 @@
 		if self.is_existing_asset and self.purchase_invoice:
 			frappe.throw(_("Purchase Invoice cannot be made against an existing asset {0}").format(self.name))
 
-	def prepare_depreciation_data(self):
+	def prepare_depreciation_data(self, date_of_sale=None):
 		if self.calculate_depreciation:
 			self.value_after_depreciation = 0
 			self.set_depreciation_rate()
-			self.make_depreciation_schedule()
-			self.set_accumulated_depreciation()
+			self.make_depreciation_schedule(date_of_sale)
+			self.set_accumulated_depreciation(date_of_sale)
 		else:
 			self.finance_books = []
 			self.value_after_depreciation = (flt(self.gross_purchase_amount) -
@@ -167,7 +167,7 @@
 			d.rate_of_depreciation = flt(self.get_depreciation_rate(d, on_validate=True),
 				d.precision("rate_of_depreciation"))
 
-	def make_depreciation_schedule(self):
+	def make_depreciation_schedule(self, date_of_sale):
 		if 'Manual' not in [d.depreciation_method for d in self.finance_books] and not self.schedules:
 			self.schedules = []
 
@@ -176,16 +176,16 @@
 
 		for d in self.get('finance_books'):
 			self.validate_asset_finance_books(d)
-			
+
 			start = self.clear_depreciation_schedule()
 
 			# value_after_depreciation - current Asset value
 			if d.value_after_depreciation:
 				value_after_depreciation = (flt(d.value_after_depreciation) -
-					flt(self.opening_accumulated_depreciation)) 
+					flt(self.opening_accumulated_depreciation))
 			else:
 				value_after_depreciation = (flt(self.gross_purchase_amount) -
-					flt(self.opening_accumulated_depreciation)) 
+					flt(self.opening_accumulated_depreciation))
 
 			d.value_after_depreciation = value_after_depreciation
 
@@ -212,6 +212,21 @@
 					# so monthly schedule date is calculated by removing 11 months from it
 					monthly_schedule_date = add_months(schedule_date, - d.frequency_of_depreciation + 1)
 
+				# if asset is being sold
+				if date_of_sale:
+					from_date = self.get_from_date(d.finance_book)
+					depreciation_amount, days, months = self.get_pro_rata_amt(d, depreciation_amount,
+						from_date, date_of_sale)
+
+					self.append("schedules", {
+						"schedule_date": date_of_sale,
+						"depreciation_amount": depreciation_amount,
+						"depreciation_method": d.depreciation_method,
+						"finance_book": d.finance_book,
+						"finance_book_id": d.idx
+					})
+					break
+
 				# For first row
 				if has_pro_rata and n==0:
 					depreciation_amount, days, months = self.get_pro_rata_amt(d, depreciation_amount,
@@ -303,6 +318,21 @@
 				break
 		return start
 
+	def get_from_date(self, finance_book):
+		if not self.get('schedules'):
+			return self.available_for_use_date
+
+		if len(self.finance_books) == 1:
+			return self.schedules[-1].schedule_date
+
+		from_date = ""
+		for schedule in self.get('schedules'):
+			if schedule.finance_book == finance_book:
+				from_date = schedule.schedule_date
+
+		if from_date:
+			return from_date
+		return self.available_for_use_date
 
 	# if it returns True, depreciation_amount will not be equal for the first and last rows
 	def check_is_pro_rata(self, row):
@@ -357,7 +387,7 @@
 			frappe.throw(_("Depreciation Row {0}: Next Depreciation Date cannot be before Available-for-use Date")
 				.format(row.idx))
 
-	def set_accumulated_depreciation(self, ignore_booked_entry = False):
+	def set_accumulated_depreciation(self, date_of_sale=None, ignore_booked_entry = False):
 		straight_line_idx = [d.idx for d in self.get("schedules") if d.depreciation_method == 'Straight Line']
 		finance_books = []
 
@@ -365,7 +395,7 @@
 			if ignore_booked_entry and d.journal_entry:
 				continue
 
-			if d.finance_book_id not in finance_books:
+			if int(d.finance_book_id) not in finance_books:
 				accumulated_depreciation = flt(self.opening_accumulated_depreciation)
 				value_after_depreciation = flt(self.get_value_after_depreciation(d.finance_book_id))
 				finance_books.append(int(d.finance_book_id))
@@ -374,7 +404,7 @@
 			value_after_depreciation -= flt(depreciation_amount)
 
 			# for the last row, if depreciation method = Straight Line
-			if straight_line_idx and i == max(straight_line_idx) - 1:
+			if straight_line_idx and i == max(straight_line_idx) - 1 and not date_of_sale:
 				book = self.get('finance_books')[cint(d.finance_book_id) - 1]
 				depreciation_amount += flt(value_after_depreciation -
 					flt(book.expected_value_after_useful_life), d.precision("depreciation_amount"))
@@ -801,4 +831,4 @@
 	else:
 		depreciation_amount = flt(depreciable_value * (flt(row.rate_of_depreciation) / 100))
 
-	return depreciation_amount
\ No newline at end of file
+	return depreciation_amount
diff --git a/erpnext/assets/doctype/asset_movement/test_asset_movement.py b/erpnext/assets/doctype/asset_movement/test_asset_movement.py
index cddee5f..2b2d2b4 100644
--- a/erpnext/assets/doctype/asset_movement/test_asset_movement.py
+++ b/erpnext/assets/doctype/asset_movement/test_asset_movement.py
@@ -15,6 +15,7 @@
 
 class TestAssetMovement(unittest.TestCase):
 	def setUp(self):
+		frappe.db.set_value("Company", "_Test Company", "capital_work_in_progress_account", "CWIP Account - _TC")
 		create_asset_data()
 		make_location()
 
@@ -45,12 +46,12 @@
 				'location_name': 'Test Location 2'
 			}).insert()
 
-		movement1 = create_asset_movement(purpose = 'Transfer', company = asset.company, 
+		movement1 = create_asset_movement(purpose = 'Transfer', company = asset.company,
 			assets = [{ 'asset': asset.name , 'source_location': 'Test Location', 'target_location': 'Test Location 2'}],
 			reference_doctype = 'Purchase Receipt', reference_name = pr.name)
 		self.assertEqual(frappe.db.get_value("Asset", asset.name, "location"), "Test Location 2")
 
-		movement2 = create_asset_movement(purpose = 'Transfer', company = asset.company, 
+		create_asset_movement(purpose = 'Transfer', company = asset.company,
 			assets = [{ 'asset': asset.name , 'source_location': 'Test Location 2', 'target_location': 'Test Location'}],
 			reference_doctype = 'Purchase Receipt', reference_name = pr.name)
 		self.assertEqual(frappe.db.get_value("Asset", asset.name, "location"), "Test Location")
@@ -59,18 +60,18 @@
 		self.assertEqual(frappe.db.get_value("Asset", asset.name, "location"), "Test Location")
 
 		employee = make_employee("testassetmovemp@example.com", company="_Test Company")
-		movement3 = create_asset_movement(purpose = 'Issue', company = asset.company, 
+		create_asset_movement(purpose = 'Issue', company = asset.company,
 			assets = [{ 'asset': asset.name , 'source_location': 'Test Location', 'to_employee': employee}],
 			reference_doctype = 'Purchase Receipt', reference_name = pr.name)
-		
+
 		# after issuing asset should belong to an employee not at a location
 		self.assertEqual(frappe.db.get_value("Asset", asset.name, "location"), None)
 		self.assertEqual(frappe.db.get_value("Asset", asset.name, "custodian"), employee)
-	
+
 	def test_last_movement_cancellation(self):
 		pr = make_purchase_receipt(item_code="Macbook Pro",
 			qty=1, rate=100000.0, location="Test Location")
-		
+
 		asset_name = frappe.db.get_value("Asset", {"purchase_receipt": pr.name}, 'name')
 		asset = frappe.get_doc('Asset', asset_name)
 		asset.calculate_depreciation = 1
@@ -85,17 +86,17 @@
 		})
 		if asset.docstatus == 0:
 			asset.submit()
-		
+
 		if not frappe.db.exists("Location", "Test Location 2"):
 			frappe.get_doc({
 				'doctype': 'Location',
 				'location_name': 'Test Location 2'
 			}).insert()
-		
+
 		movement = frappe.get_doc({'doctype': 'Asset Movement', 'reference_name': pr.name })
 		self.assertRaises(frappe.ValidationError, movement.cancel)
 
-		movement1 = create_asset_movement(purpose = 'Transfer', company = asset.company, 
+		movement1 = create_asset_movement(purpose = 'Transfer', company = asset.company,
 			assets = [{ 'asset': asset.name , 'source_location': 'Test Location', 'target_location': 'Test Location 2'}],
 			reference_doctype = 'Purchase Receipt', reference_name = pr.name)
 		self.assertEqual(frappe.db.get_value("Asset", asset.name, "location"), "Test Location 2")
diff --git a/erpnext/assets/workspace/assets/assets.json b/erpnext/assets/workspace/assets/assets.json
index c401581..dfbf1a3 100644
--- a/erpnext/assets/workspace/assets/assets.json
+++ b/erpnext/assets/workspace/assets/assets.json
@@ -1,27 +1,32 @@
 {
- "category": "Modules",
+ "category": "",
  "charts": [
   {
    "chart_name": "Asset Value Analytics",
    "label": "Asset Value Analytics"
   }
  ],
+ "content": "[{\"type\": \"onboarding\", \"data\": {\"onboarding_name\":\"Assets\", \"col\": 12}}, {\"type\": \"chart\", \"data\": {\"chart_name\": \"Asset Value Analytics\", \"col\": 12}}, {\"type\": \"spacer\", \"data\": {\"col\": 12}}, {\"type\": \"header\", \"data\": {\"text\": \"Your Shortcuts\", \"level\": 4, \"col\": 12}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Asset\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Asset Category\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Fixed Asset Register\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Dashboard\", \"col\": 4}}, {\"type\": \"spacer\", \"data\": {\"col\": 12}}, {\"type\": \"header\", \"data\": {\"text\": \"Reports & Masters\", \"level\": 4, \"col\": 12}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Assets\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Maintenance\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Reports\", \"col\": 4}}]",
  "creation": "2020-03-02 15:43:27.634865",
  "developer_mode_only": 0,
  "disable_user_customization": 0,
  "docstatus": 0,
  "doctype": "Workspace",
+ "extends": "",
  "extends_another_page": 0,
+ "for_user": "",
  "hide_custom": 0,
  "icon": "assets",
  "idx": 0,
- "is_standard": 1,
+ "is_default": 0,
+ "is_standard": 0,
  "label": "Assets",
  "links": [
   {
    "hidden": 0,
    "is_query_report": 0,
    "label": "Assets",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -30,6 +35,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Asset",
+   "link_count": 0,
    "link_to": "Asset",
    "link_type": "DocType",
    "onboard": 1,
@@ -40,6 +46,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Location",
+   "link_count": 0,
    "link_to": "Location",
    "link_type": "DocType",
    "onboard": 1,
@@ -50,6 +57,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Asset Category",
+   "link_count": 0,
    "link_to": "Asset Category",
    "link_type": "DocType",
    "onboard": 1,
@@ -60,6 +68,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Asset Movement",
+   "link_count": 0,
    "link_to": "Asset Movement",
    "link_type": "DocType",
    "onboard": 0,
@@ -69,6 +78,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Maintenance",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -77,6 +87,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Asset Maintenance Team",
+   "link_count": 0,
    "link_to": "Asset Maintenance Team",
    "link_type": "DocType",
    "onboard": 1,
@@ -87,6 +98,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Asset Maintenance",
+   "link_count": 0,
    "link_to": "Asset Maintenance",
    "link_type": "DocType",
    "onboard": 1,
@@ -97,6 +109,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Asset Maintenance Log",
+   "link_count": 0,
    "link_to": "Asset Maintenance Log",
    "link_type": "DocType",
    "onboard": 0,
@@ -107,6 +120,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Asset Value Adjustment",
+   "link_count": 0,
    "link_to": "Asset Value Adjustment",
    "link_type": "DocType",
    "onboard": 0,
@@ -117,6 +131,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Asset Repair",
+   "link_count": 0,
    "link_to": "Asset Repair",
    "link_type": "DocType",
    "onboard": 0,
@@ -126,6 +141,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Reports",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -134,6 +150,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Asset Depreciation Ledger",
+   "link_count": 0,
    "link_to": "Asset Depreciation Ledger",
    "link_type": "Report",
    "onboard": 0,
@@ -144,6 +161,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Asset Depreciations and Balances",
+   "link_count": 0,
    "link_to": "Asset Depreciations and Balances",
    "link_type": "Report",
    "onboard": 0,
@@ -154,20 +172,26 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Asset Maintenance",
+   "link_count": 0,
    "link_to": "Asset Maintenance",
    "link_type": "Report",
    "onboard": 0,
    "type": "Link"
   }
  ],
- "modified": "2020-12-01 13:38:37.977119",
+ "modified": "2021-08-05 12:15:54.839452",
  "modified_by": "Administrator",
  "module": "Assets",
  "name": "Assets",
  "onboarding": "Assets",
  "owner": "Administrator",
+ "parent_page": "",
  "pin_to_bottom": 0,
  "pin_to_top": 0,
+ "public": 1,
+ "restrict_to_domain": "",
+ "roles": [],
+ "sequence_id": 4,
  "shortcuts": [
   {
    "label": "Asset",
@@ -189,5 +213,6 @@
    "link_to": "Asset",
    "type": "Dashboard"
   }
- ]
+ ],
+ "title": "Assets"
 }
\ No newline at end of file
diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.py b/erpnext/buying/doctype/purchase_order/purchase_order.py
index eaa502f..a0b1e07 100644
--- a/erpnext/buying/doctype/purchase_order/purchase_order.py
+++ b/erpnext/buying/doctype/purchase_order/purchase_order.py
@@ -447,10 +447,11 @@
 		target.flags.ignore_permissions = ignore_permissions
 		set_missing_values(source, target)
 		#Get the advance paid Journal Entries in Purchase Invoice Advance
-
 		if target.get("allocate_advances_automatically"):
 			target.set_advances()
 
+		target.set_payment_schedule()
+
 	def update_item(obj, target, source_parent):
 		target.amount = flt(obj.amount) - flt(obj.billed_amt)
 		target.base_amount = target.amount * flt(source_parent.conversion_rate)
@@ -470,6 +471,7 @@
 				"party_account_currency": "party_account_currency",
 				"supplier_warehouse":"supplier_warehouse"
 			},
+			"field_no_map" : ["payment_terms_template"],
 			"validation": {
 				"docstatus": ["=", 1],
 			}
@@ -489,12 +491,6 @@
 		},
 	}
 
-	if frappe.get_single("Accounts Settings").automatically_fetch_payment_terms == 1:
-		fields["Payment Schedule"] = {
-			"doctype": "Payment Schedule",
-			"add_if_empty": True
-		}
-
 	doc = get_mapped_doc("Purchase Order", source_name,	fields,
 		target_doc, postprocess, ignore_permissions=ignore_permissions)
 
diff --git a/erpnext/buying/doctype/purchase_order/test_purchase_order.py b/erpnext/buying/doctype/purchase_order/test_purchase_order.py
index 8563b97..d668c76 100644
--- a/erpnext/buying/doctype/purchase_order/test_purchase_order.py
+++ b/erpnext/buying/doctype/purchase_order/test_purchase_order.py
@@ -484,6 +484,9 @@
 
 
 	def test_make_purchase_invoice_with_terms(self):
+		from erpnext.selling.doctype.sales_order.test_sales_order import automatically_fetch_payment_terms, compare_payment_schedules
+		
+		automatically_fetch_payment_terms()
 		po = create_purchase_order(do_not_save=True)
 
 		self.assertRaises(frappe.ValidationError, make_pi_from_po, po.name)
@@ -509,6 +512,7 @@
 		self.assertEqual(getdate(pi.payment_schedule[0].due_date), getdate(po.transaction_date))
 		self.assertEqual(pi.payment_schedule[1].payment_amount, 2500.0)
 		self.assertEqual(getdate(pi.payment_schedule[1].due_date), add_days(getdate(po.transaction_date), 30))
+		automatically_fetch_payment_terms(enable=0)
 
 	def test_subcontracting(self):
 		po = create_purchase_order(item_code="_Test FG Item", is_subcontracted="Yes")
@@ -632,14 +636,18 @@
 			else:
 				raise Exception
 
-	def test_terms_does_not_copy(self):
-		po = create_purchase_order()
+	def test_terms_are_not_copied_if_automatically_fetch_payment_terms_is_unchecked(self):
+		po = create_purchase_order(do_not_save=1)
+		po.payment_terms_template = '_Test Payment Term Template'
+		po.save()
+		po.submit()
 
-		self.assertTrue(po.get('payment_schedule'))
-
+		frappe.db.set_value('Company', '_Test Company', 'payment_terms', '_Test Payment Term Template 1')
 		pi = make_pi_from_po(po.name)
+		pi.save()
 
-		self.assertFalse(pi.get('payment_schedule'))
+		self.assertEqual(pi.get('payment_terms_template'), '_Test Payment Term Template 1')
+		frappe.db.set_value('Company', '_Test Company', 'payment_terms', '')
 
 	def test_terms_copied(self):
 		po = create_purchase_order(do_not_save=1)
@@ -968,8 +976,27 @@
 		# To test if the PO does NOT have a Blanket Order
 		self.assertEqual(po_doc.items[0].blanket_order, None)
 
+	def test_payment_terms_are_fetched_when_creating_purchase_invoice(self):
+		from erpnext.accounts.doctype.payment_entry.test_payment_entry import create_payment_terms_template
+		from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice import make_purchase_invoice
+		from erpnext.selling.doctype.sales_order.test_sales_order import automatically_fetch_payment_terms, compare_payment_schedules
 
+		automatically_fetch_payment_terms()
 
+		po = create_purchase_order(qty=10, rate=100, do_not_save=1)
+		create_payment_terms_template()
+		po.payment_terms_template = 'Test Receivable Template'
+		po.submit()
+
+		pi = make_purchase_invoice(qty=10, rate=100, do_not_save=1)
+		pi.items[0].purchase_order = po.name
+		pi.items[0].po_detail = po.items[0].name
+		pi.insert()
+
+		# self.assertEqual(po.payment_terms_template, pi.payment_terms_template)
+		compare_payment_schedules(self, po, pi)
+
+		automatically_fetch_payment_terms(enable=0)
 
 def make_pr_against_po(po, received_qty=0):
 	pr = make_purchase_receipt(po)
diff --git a/erpnext/buying/print_format/drop_shipping_format/drop_shipping_format.json b/erpnext/buying/print_format/drop_shipping_format/drop_shipping_format.json
index 0c7cad6..2e2a048 100644
--- a/erpnext/buying/print_format/drop_shipping_format/drop_shipping_format.json
+++ b/erpnext/buying/print_format/drop_shipping_format/drop_shipping_format.json
@@ -13,6 +13,6 @@
  "name": "Drop Shipping Format", 
  "owner": "Administrator", 
  "print_format_builder": 0, 
- "print_format_type": "Server", 
+ "print_format_type": "Jinja", 
  "standard": "Yes"
 }
\ No newline at end of file
diff --git a/erpnext/buying/workspace/buying/buying.json b/erpnext/buying/workspace/buying/buying.json
index 6c9c0f3..6c91e81 100644
--- a/erpnext/buying/workspace/buying/buying.json
+++ b/erpnext/buying/workspace/buying/buying.json
@@ -1,6 +1,6 @@
 {
  "cards_label": "",
- "category": "Modules",
+ "category": "",
  "charts": [
   {
    "chart_name": "Purchase Order Trends",
@@ -8,22 +8,27 @@
   }
  ],
  "charts_label": "",
+ "content": "[{\"type\": \"onboarding\", \"data\": {\"onboarding_name\":\"Buying\", \"col\": 12}}, {\"type\": \"chart\", \"data\": {\"chart_name\": \"Purchase Order Trends\", \"col\": 12}}, {\"type\": \"spacer\", \"data\": {\"col\": 12}}, {\"type\": \"header\", \"data\": {\"text\": \"Your Shortcuts\", \"level\": 4, \"col\": 12}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Item\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Material Request\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Purchase Order\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Purchase Analytics\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Purchase Order Analysis\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Dashboard\", \"col\": 4}}, {\"type\": \"spacer\", \"data\": {\"col\": 12}}, {\"type\": \"header\", \"data\": {\"text\": \"Reports & Masters\", \"level\": 4, \"col\": 12}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Buying\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Items & Pricing\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Settings\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Supplier\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Supplier Scorecard\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Key Reports\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Other Reports\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Regional\", \"col\": 4}}]",
  "creation": "2020-01-28 11:50:26.195467",
  "developer_mode_only": 0,
  "disable_user_customization": 0,
  "docstatus": 0,
  "doctype": "Workspace",
+ "extends": "",
  "extends_another_page": 0,
+ "for_user": "",
  "hide_custom": 0,
  "icon": "buying",
  "idx": 0,
- "is_standard": 1,
+ "is_default": 0,
+ "is_standard": 0,
  "label": "Buying",
  "links": [
   {
    "hidden": 0,
    "is_query_report": 0,
    "label": "Buying",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -32,6 +37,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Material Request",
+   "link_count": 0,
    "link_to": "Material Request",
    "link_type": "DocType",
    "onboard": 1,
@@ -42,6 +48,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Purchase Order",
+   "link_count": 0,
    "link_to": "Purchase Order",
    "link_type": "DocType",
    "onboard": 1,
@@ -52,6 +59,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Purchase Invoice",
+   "link_count": 0,
    "link_to": "Purchase Invoice",
    "link_type": "DocType",
    "onboard": 1,
@@ -62,6 +70,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Request for Quotation",
+   "link_count": 0,
    "link_to": "Request for Quotation",
    "link_type": "DocType",
    "onboard": 1,
@@ -72,6 +81,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Supplier Quotation",
+   "link_count": 0,
    "link_to": "Supplier Quotation",
    "link_type": "DocType",
    "onboard": 0,
@@ -81,6 +91,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Items & Pricing",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -89,6 +100,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Item",
+   "link_count": 0,
    "link_to": "Item",
    "link_type": "DocType",
    "onboard": 1,
@@ -99,6 +111,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Item Price",
+   "link_count": 0,
    "link_to": "Item Price",
    "link_type": "DocType",
    "onboard": 1,
@@ -109,6 +122,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Price List",
+   "link_count": 0,
    "link_to": "Price List",
    "link_type": "DocType",
    "onboard": 1,
@@ -119,6 +133,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Product Bundle",
+   "link_count": 0,
    "link_to": "Product Bundle",
    "link_type": "DocType",
    "onboard": 0,
@@ -129,6 +144,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Item Group",
+   "link_count": 0,
    "link_to": "Item Group",
    "link_type": "DocType",
    "onboard": 0,
@@ -139,6 +155,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Promotional Scheme",
+   "link_count": 0,
    "link_to": "Promotional Scheme",
    "link_type": "DocType",
    "onboard": 0,
@@ -149,6 +166,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Pricing Rule",
+   "link_count": 0,
    "link_to": "Pricing Rule",
    "link_type": "DocType",
    "onboard": 0,
@@ -158,6 +176,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Settings",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -166,6 +185,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Buying Settings",
+   "link_count": 0,
    "link_to": "Buying Settings",
    "link_type": "DocType",
    "onboard": 0,
@@ -176,6 +196,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Purchase Taxes and Charges Template",
+   "link_count": 0,
    "link_to": "Purchase Taxes and Charges Template",
    "link_type": "DocType",
    "onboard": 0,
@@ -186,6 +207,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Terms and Conditions Template",
+   "link_count": 0,
    "link_to": "Terms and Conditions",
    "link_type": "DocType",
    "onboard": 0,
@@ -195,6 +217,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Supplier",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -203,6 +226,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Supplier",
+   "link_count": 0,
    "link_to": "Supplier",
    "link_type": "DocType",
    "onboard": 1,
@@ -213,6 +237,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Supplier Group",
+   "link_count": 0,
    "link_to": "Supplier Group",
    "link_type": "DocType",
    "onboard": 0,
@@ -223,6 +248,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Contact",
+   "link_count": 0,
    "link_to": "Contact",
    "link_type": "DocType",
    "onboard": 0,
@@ -233,6 +259,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Address",
+   "link_count": 0,
    "link_to": "Address",
    "link_type": "DocType",
    "onboard": 0,
@@ -242,6 +269,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Supplier Scorecard",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -250,6 +278,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Supplier Scorecard",
+   "link_count": 0,
    "link_to": "Supplier Scorecard",
    "link_type": "DocType",
    "onboard": 0,
@@ -260,6 +289,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Supplier Scorecard Variable",
+   "link_count": 0,
    "link_to": "Supplier Scorecard Variable",
    "link_type": "DocType",
    "onboard": 0,
@@ -270,6 +300,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Supplier Scorecard Criteria",
+   "link_count": 0,
    "link_to": "Supplier Scorecard Criteria",
    "link_type": "DocType",
    "onboard": 0,
@@ -280,6 +311,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Supplier Scorecard Standing",
+   "link_count": 0,
    "link_to": "Supplier Scorecard Standing",
    "link_type": "DocType",
    "onboard": 0,
@@ -289,6 +321,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Key Reports",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -297,6 +330,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Purchase Analytics",
+   "link_count": 0,
    "link_to": "Purchase Analytics",
    "link_type": "Report",
    "onboard": 1,
@@ -307,6 +341,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Purchase Order Analysis",
+   "link_count": 0,
    "link_to": "Purchase Order Analysis",
    "link_type": "Report",
    "onboard": 1,
@@ -317,6 +352,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Supplier-Wise Sales Analytics",
+   "link_count": 0,
    "link_to": "Supplier-Wise Sales Analytics",
    "link_type": "Report",
    "onboard": 1,
@@ -327,6 +363,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Items to Order and Receive",
+   "link_count": 0,
    "link_to": "Requested Items to Order and Receive",
    "link_type": "Report",
    "onboard": 1,
@@ -337,6 +374,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Purchase Order Trends",
+   "link_count": 0,
    "link_to": "Purchase Order Trends",
    "link_type": "Report",
    "onboard": 1,
@@ -347,6 +385,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Procurement Tracker",
+   "link_count": 0,
    "link_to": "Procurement Tracker",
    "link_type": "Report",
    "onboard": 1,
@@ -356,6 +395,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Other Reports",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -364,6 +404,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Items To Be Requested",
+   "link_count": 0,
    "link_to": "Items To Be Requested",
    "link_type": "Report",
    "onboard": 1,
@@ -374,6 +415,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Item-wise Purchase History",
+   "link_count": 0,
    "link_to": "Item-wise Purchase History",
    "link_type": "Report",
    "onboard": 1,
@@ -384,6 +426,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Purchase Receipt Trends",
+   "link_count": 0,
    "link_to": "Purchase Receipt Trends",
    "link_type": "Report",
    "onboard": 0,
@@ -394,6 +437,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Purchase Invoice Trends",
+   "link_count": 0,
    "link_to": "Purchase Invoice Trends",
    "link_type": "Report",
    "onboard": 0,
@@ -404,6 +448,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Subcontracted Raw Materials To Be Transferred",
+   "link_count": 0,
    "link_to": "Subcontracted Raw Materials To Be Transferred",
    "link_type": "Report",
    "onboard": 0,
@@ -414,6 +459,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Subcontracted Item To Be Received",
+   "link_count": 0,
    "link_to": "Subcontracted Item To Be Received",
    "link_type": "Report",
    "onboard": 0,
@@ -424,6 +470,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Supplier Quotation Comparison",
+   "link_count": 0,
    "link_to": "Supplier Quotation Comparison",
    "link_type": "Report",
    "onboard": 1,
@@ -434,6 +481,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Material Requests for which Supplier Quotations are not created",
+   "link_count": 0,
    "link_to": "Material Requests for which Supplier Quotations are not created",
    "link_type": "Report",
    "onboard": 0,
@@ -444,6 +492,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Supplier Addresses And Contacts",
+   "link_count": 0,
    "link_to": "Address And Contacts",
    "link_type": "Report",
    "onboard": 0,
@@ -453,6 +502,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Regional",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -461,20 +511,26 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Import Supplier Invoice",
+   "link_count": 0,
    "link_to": "Import Supplier Invoice",
    "link_type": "DocType",
    "onboard": 0,
    "type": "Link"
   }
  ],
- "modified": "2020-12-01 13:38:38.615167",
+ "modified": "2021-08-05 12:15:56.218427",
  "modified_by": "Administrator",
  "module": "Buying",
  "name": "Buying",
  "onboarding": "Buying",
  "owner": "Administrator",
+ "parent_page": "",
  "pin_to_bottom": 0,
  "pin_to_top": 0,
+ "public": 1,
+ "restrict_to_domain": "",
+ "roles": [],
+ "sequence_id": 6,
  "shortcuts": [
   {
    "color": "Green",
@@ -516,5 +572,6 @@
    "type": "Dashboard"
   }
  ],
- "shortcuts_label": ""
+ "shortcuts_label": "",
+ "title": "Buying"
 }
\ No newline at end of file
diff --git a/erpnext/change_log/v13/v13_9_0.md b/erpnext/change_log/v13/v13_9_0.md
new file mode 100644
index 0000000..e527666
--- /dev/null
+++ b/erpnext/change_log/v13/v13_9_0.md
@@ -0,0 +1,46 @@
+# Version 13.9.0 Release Notes
+
+### Features & Enhancements
+- Organizational Chart ([#26261](https://github.com/frappe/erpnext/pull/26261))
+- Enable discount accounting ([#26579](https://github.com/frappe/erpnext/pull/26579))
+- Added multi-select fields in promotional scheme to create multiple pricing rules ([#25622](https://github.com/frappe/erpnext/pull/25622))
+- Over transfer allowance for material transfers ([#26814](https://github.com/frappe/erpnext/pull/26814))
+- Enhancements in Tax Withholding Category ([#26661](https://github.com/frappe/erpnext/pull/26661))
+
+### Fixes
+- Sales Return cancellation if linked with Payment Entry ([#26883](https://github.com/frappe/erpnext/pull/26883))
+- Production plan not fetching sales order of a variant ([#25845](https://github.com/frappe/erpnext/pull/25845))
+- Stock Analytics Report must consider warehouse during calculation ([#26908](https://github.com/frappe/erpnext/pull/26908))
+- Incorrect date difference calculation ([#26805](https://github.com/frappe/erpnext/pull/26805))
+- Tax calculation for Recurring additional salary ([#24206](https://github.com/frappe/erpnext/pull/24206))
+- Cannot cancel payment entry if linked with invoices ([#26703](https://github.com/frappe/erpnext/pull/26703))
+- Included company in link document type filters for contact ([#26576](https://github.com/frappe/erpnext/pull/26576))
+- Fetch Payment Terms from linked Sales/Purchase Order ([#26723](https://github.com/frappe/erpnext/pull/26723))
+- Let all System Managers be able to delete Company transactions ([#26819](https://github.com/frappe/erpnext/pull/26819))
+- Bank remittance report issue ([#26398](https://github.com/frappe/erpnext/pull/26398))
+- Faulty Gl Entry for Asset LCVs ([#26803](https://github.com/frappe/erpnext/pull/26803))
+- Clean Serial No input on Server Side ([#26878](https://github.com/frappe/erpnext/pull/26878))
+- Supplier invoice importer fix v13 ([#26633](https://github.com/frappe/erpnext/pull/26633))
+- POS payment modes displayed wrong total ([#26808](https://github.com/frappe/erpnext/pull/26808))
+- Fetching of item tax from hsn code ([#26736](https://github.com/frappe/erpnext/pull/26736))
+- Cannot cancel invoice if IRN cancelled on portal ([#26879](https://github.com/frappe/erpnext/pull/26879))
+- Validate python expressions ([#26856](https://github.com/frappe/erpnext/pull/26856))
+- POS Item Cart non-stop scroll issue ([#26693](https://github.com/frappe/erpnext/pull/26693))
+- Add mandatory depends on condition for export type field ([#26958](https://github.com/frappe/erpnext/pull/26958))
+- Cannot generate IRNs for standalone credit notes ([#26824](https://github.com/frappe/erpnext/pull/26824))
+- Added progress bar in Repost Item Valuation to check the status of reposting ([#26630](https://github.com/frappe/erpnext/pull/26630))
+- TDS calculation for first threshold breach for TDS category 194Q ([#26710](https://github.com/frappe/erpnext/pull/26710))
+- Student category mapping from the program enrollment tool ([#26739](https://github.com/frappe/erpnext/pull/26739))
+- Cost center & account validation in Sales/Purchase Taxes and Charges ([#26881](https://github.com/frappe/erpnext/pull/26881))
+- Reset weight_per_unit on replacing Item ([#26791](https://github.com/frappe/erpnext/pull/26791))
+- Do not fetch fully return issued purchase receipts ([#26825](https://github.com/frappe/erpnext/pull/26825))
+- Incorrect amount in work order required items table.  ([#26585](https://github.com/frappe/erpnext/pull/26585))
+- Additional discount calculations in Invoices ([#26553](https://github.com/frappe/erpnext/pull/26553))
+- Refactored Asset Repair ([#26415](https://github.com/frappe/erpnext/pull/25798))
+- Exchange rate revaluation posting date and precision fixes ([#26650](https://github.com/frappe/erpnext/pull/26650))
+- POS Invoice consolidated Sales Invoice field set to no copy ([#26768](https://github.com/frappe/erpnext/pull/26768))
+- Consider grand total for threshold check ([#26683](https://github.com/frappe/erpnext/pull/26683))
+- Budget variance missing values ([#26966](https://github.com/frappe/erpnext/pull/26966))
+- GL Entries for exchange gain loss ([#26728](https://github.com/frappe/erpnext/pull/26728))
+- Add missing cess amount in GSTR-3B report ([#26544](https://github.com/frappe/erpnext/pull/26544))
+- GST Reports timeout issue ([#26575](https://github.com/frappe/erpnext/pull/26575))
\ No newline at end of file
diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py
index bc8e4ce..4c79a5c 100644
--- a/erpnext/controllers/accounts_controller.py
+++ b/erpnext/controllers/accounts_controller.py
@@ -813,6 +813,89 @@
 							tax_map[tax.account_head] -= allocated_amount
 							allocated_tax_map[tax.account_head] -= allocated_amount
 
+	def get_amount_and_base_amount(self, item, enable_discount_accounting):
+		amount = item.net_amount
+		base_amount = item.base_net_amount
+
+		if enable_discount_accounting and self.get('discount_amount') and self.get('additional_discount_account'):
+			amount = item.amount
+			base_amount = item.base_amount
+
+		return amount, base_amount
+
+	def get_tax_amounts(self, tax, enable_discount_accounting):
+		amount = tax.tax_amount_after_discount_amount
+		base_amount = tax.base_tax_amount_after_discount_amount
+
+		if enable_discount_accounting and self.get('discount_amount') and self.get('additional_discount_account') \
+			and self.get('apply_discount_on') == 'Grand Total':
+			amount = tax.tax_amount
+			base_amount = tax.base_tax_amount
+
+		return amount, base_amount
+
+	def make_discount_gl_entries(self, gl_entries):
+		enable_discount_accounting = cint(frappe.db.get_single_value('Accounts Settings', 'enable_discount_accounting'))
+
+		if enable_discount_accounting:
+			if self.doctype == "Purchase Invoice":
+				dr_or_cr = "credit"
+				rev_dr_cr = "debit"
+				supplier_or_customer = self.supplier
+	
+			else:
+				dr_or_cr = "debit"
+				rev_dr_cr = "credit"
+				supplier_or_customer = self.customer
+
+			for item in self.get("items"):
+				if item.get('discount_amount') and item.get('discount_account'):
+					discount_amount = item.discount_amount * item.qty
+					if self.doctype == "Purchase Invoice":
+						income_or_expense_account = (item.expense_account
+							if (not item.enable_deferred_expense or self.is_return) 
+							else item.deferred_expense_account)
+					else:
+						income_or_expense_account = (item.income_account
+							if (not item.enable_deferred_revenue or self.is_return) 
+							else item.deferred_revenue_account)
+
+					account_currency = get_account_currency(item.discount_account)
+					gl_entries.append(
+						self.get_gl_dict({
+							"account": item.discount_account,
+							"against": supplier_or_customer,
+							dr_or_cr: flt(discount_amount, item.precision('discount_amount')),
+							dr_or_cr + "_in_account_currency": flt(discount_amount * self.get('conversion_rate'), 
+								item.precision('discount_amount')),
+							"cost_center": item.cost_center,
+							"project": item.project
+						}, account_currency, item=item)
+					)
+
+					account_currency = get_account_currency(income_or_expense_account)
+					gl_entries.append(
+						self.get_gl_dict({
+							"account": income_or_expense_account,
+							"against": supplier_or_customer,
+							rev_dr_cr: flt(discount_amount, item.precision('discount_amount')),
+							rev_dr_cr + "_in_account_currency": flt(discount_amount * self.get('conversion_rate'), 
+								item.precision('discount_amount')),
+							"cost_center": item.cost_center,
+							"project": item.project or self.project
+						}, account_currency, item=item)
+					)
+
+			if self.get('discount_amount') and self.get('additional_discount_account'):
+				gl_entries.append(
+					self.get_gl_dict({
+						"account": self.additional_discount_account,
+						"against": supplier_or_customer,
+						dr_or_cr: self.discount_amount,
+						"cost_center": self.cost_center
+					}, item=self)
+				)		
+										
 	def allocate_advance_taxes(self, gl_entries):
 		tax_map = self.get_tax_map()
 		for pe in self.get("advances"):
@@ -1096,6 +1179,8 @@
 		if self.doctype in ("Sales Invoice", "Purchase Invoice"):
 			base_grand_total = base_grand_total - flt(self.base_write_off_amount)
 			grand_total = grand_total - flt(self.write_off_amount)
+			po_or_so, doctype, fieldname = self.get_order_details()
+			automatically_fetch_payment_terms = cint(frappe.db.get_single_value('Accounts Settings', 'automatically_fetch_payment_terms'))
 
 		if self.get("total_advance"):
 			if party_account_currency == self.company_currency:
@@ -1106,22 +1191,86 @@
 				base_grand_total = flt(grand_total * self.get("conversion_rate"), self.precision("base_grand_total"))
 
 		if not self.get("payment_schedule"):
-			if self.get("payment_terms_template"):
+			if self.doctype in ["Sales Invoice", "Purchase Invoice"] and automatically_fetch_payment_terms \
+				and self.linked_order_has_payment_terms(po_or_so, fieldname, doctype):
+				self.fetch_payment_terms_from_order(po_or_so, doctype)
+				if self.get('payment_terms_template'):
+					self.ignore_default_payment_terms_template = 1
+			elif self.get("payment_terms_template"):
 				data = get_payment_terms(self.payment_terms_template, posting_date, grand_total, base_grand_total)
 				for item in data:
 					self.append("payment_schedule", item)
-			else:
+			elif self.doctype not in ["Purchase Receipt"]:
 				data = dict(due_date=due_date, invoice_portion=100, payment_amount=grand_total, base_payment_amount=base_grand_total)
 				self.append("payment_schedule", data)
-		else:
-			for d in self.get("payment_schedule"):
-				if d.invoice_portion:
-					d.payment_amount = flt(grand_total * flt(d.invoice_portion / 100), d.precision('payment_amount'))
-					d.base_payment_amount = flt(base_grand_total * flt(d.invoice_portion / 100), d.precision('base_payment_amount'))
-					d.outstanding = d.payment_amount
-				elif not d.invoice_portion:
-					d.base_payment_amount = flt(base_grand_total * self.get("conversion_rate"), d.precision('base_payment_amount'))
 
+		for d in self.get("payment_schedule"):
+			if d.invoice_portion:
+				d.payment_amount = flt(grand_total * flt(d.invoice_portion / 100), d.precision('payment_amount'))
+				d.base_payment_amount = flt(base_grand_total * flt(d.invoice_portion / 100), d.precision('base_payment_amount'))
+				d.outstanding = d.payment_amount
+			elif not d.invoice_portion:
+				d.base_payment_amount = flt(base_grand_total * self.get("conversion_rate"), d.precision('base_payment_amount'))
+
+
+	def get_order_details(self):
+		if self.doctype == "Sales Invoice":
+			po_or_so = self.get('items')[0].get('sales_order')
+			po_or_so_doctype = "Sales Order"
+			po_or_so_doctype_name = "sales_order"
+
+		else:
+			po_or_so = self.get('items')[0].get('purchase_order')
+			po_or_so_doctype = "Purchase Order"
+			po_or_so_doctype_name = "purchase_order"
+		
+		return po_or_so, po_or_so_doctype, po_or_so_doctype_name
+
+	def linked_order_has_payment_terms(self, po_or_so, fieldname, doctype):
+		if po_or_so and self.all_items_have_same_po_or_so(po_or_so, fieldname):
+			if self.linked_order_has_payment_terms_template(po_or_so, doctype):
+				return True
+			elif self.linked_order_has_payment_schedule(po_or_so):
+				return True
+		
+		return False
+
+	def all_items_have_same_po_or_so(self, po_or_so, fieldname):
+		for item in self.get('items'):
+			if item.get(fieldname) != po_or_so:
+				return False
+		
+		return True
+
+	def linked_order_has_payment_terms_template(self, po_or_so, doctype):
+		return frappe.get_value(doctype, po_or_so, 'payment_terms_template')
+
+	def linked_order_has_payment_schedule(self, po_or_so):
+		return frappe.get_all('Payment Schedule', filters={'parent': po_or_so})
+
+	def fetch_payment_terms_from_order(self, po_or_so, po_or_so_doctype):
+		"""
+			Fetch Payment Terms from Purchase/Sales Order on creating a new Purchase/Sales Invoice.
+		"""
+		po_or_so = frappe.get_cached_doc(po_or_so_doctype, po_or_so)
+
+		self.payment_schedule = []
+		self.payment_terms_template = po_or_so.payment_terms_template
+
+		for schedule in po_or_so.payment_schedule:
+			payment_schedule = {
+				'payment_term': schedule.payment_term,
+				'due_date': schedule.due_date,
+				'invoice_portion': schedule.invoice_portion,
+				'mode_of_payment': schedule.mode_of_payment,
+				'description': schedule.description
+			}
+
+			if schedule.discount_type == 'Percentage':
+				payment_schedule['discount_type'] = schedule.discount_type
+				payment_schedule['discount'] = schedule.discount
+
+			self.append("payment_schedule", payment_schedule)
 
 	def set_due_date(self):
 		due_dates = [d.due_date for d in self.get("payment_schedule") if d.due_date]
@@ -1829,4 +1978,4 @@
 
 @erpnext.allow_regional
 def validate_einvoice_fields(doc):
-	pass
+	pass
\ No newline at end of file
diff --git a/erpnext/controllers/buying_controller.py b/erpnext/controllers/buying_controller.py
index 6a550e0..974ade3 100644
--- a/erpnext/controllers/buying_controller.py
+++ b/erpnext/controllers/buying_controller.py
@@ -72,7 +72,8 @@
 		# set contact and address details for supplier, if they are not mentioned
 		if getattr(self, "supplier", None):
 			self.update_if_missing(get_party_details(self.supplier, party_type="Supplier", ignore_permissions=self.flags.ignore_permissions,
-			doctype=self.doctype, company=self.company, party_address=self.supplier_address, shipping_address=self.get('shipping_address')))
+			doctype=self.doctype, company=self.company, party_address=self.supplier_address, shipping_address=self.get('shipping_address'),
+			fetch_payment_terms_template= not self.get('ignore_default_payment_terms_template')))
 
 		self.set_missing_item_details(for_validate)
 
diff --git a/erpnext/controllers/status_updater.py b/erpnext/controllers/status_updater.py
index 943f7aa..b1f89b0 100644
--- a/erpnext/controllers/status_updater.py
+++ b/erpnext/controllers/status_updater.py
@@ -3,7 +3,7 @@
 
 from __future__ import unicode_literals
 import frappe
-from frappe.utils import flt, comma_or, nowdate, getdate
+from frappe.utils import flt, comma_or, nowdate, getdate, now
 from frappe import _
 from frappe.model.document import Document
 
@@ -336,10 +336,14 @@
 				target.notify_update()
 
 	def _update_modified(self, args, update_modified):
-		args['update_modified'] = ''
-		if update_modified:
-			args['update_modified'] = ', modified = now(), modified_by = {0}'\
-				.format(frappe.db.escape(frappe.session.user))
+		if not update_modified:
+			args['update_modified'] = ''
+			return
+
+		args['update_modified'] = ', modified = {0}, modified_by = {1}'.format(
+			frappe.db.escape(now()),
+			frappe.db.escape(frappe.session.user)
+		)
 
 	def update_billing_status_for_zero_amount_refdoc(self, ref_dt):
 		ref_fieldname = frappe.scrub(ref_dt)
diff --git a/erpnext/crm/workspace/crm/crm.json b/erpnext/crm/workspace/crm/crm.json
index b4fb7d8..c363395 100644
--- a/erpnext/crm/workspace/crm/crm.json
+++ b/erpnext/crm/workspace/crm/crm.json
@@ -1,26 +1,31 @@
 {
- "category": "Modules",
+ "category": "",
  "charts": [
   {
    "chart_name": "Territory Wise Sales"
   }
  ],
+ "content": "[{\"type\": \"onboarding\", \"data\": {\"onboarding_name\":\"CRM\", \"col\": 12}}, {\"type\": \"chart\", \"data\": {\"chart_name\": null, \"col\": 12}}, {\"type\": \"spacer\", \"data\": {\"col\": 12}}, {\"type\": \"header\", \"data\": {\"text\": \"Your Shortcuts\", \"level\": 4, \"col\": 12}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Lead\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Opportunity\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Customer\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Sales Analytics\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Dashboard\", \"col\": 4}}, {\"type\": \"spacer\", \"data\": {\"col\": 12}}, {\"type\": \"header\", \"data\": {\"text\": \"Reports & Masters\", \"level\": 4, \"col\": 12}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Sales Pipeline\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Reports\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Maintenance\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Campaign\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Settings\", \"col\": 4}}]",
  "creation": "2020-01-23 14:48:30.183272",
  "developer_mode_only": 0,
  "disable_user_customization": 0,
  "docstatus": 0,
  "doctype": "Workspace",
+ "extends": "",
  "extends_another_page": 0,
+ "for_user": "",
  "hide_custom": 0,
  "icon": "crm",
  "idx": 0,
- "is_standard": 1,
+ "is_default": 0,
+ "is_standard": 0,
  "label": "CRM",
  "links": [
   {
    "hidden": 0,
    "is_query_report": 0,
    "label": "Sales Pipeline",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -29,6 +34,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Lead",
+   "link_count": 0,
    "link_to": "Lead",
    "link_type": "DocType",
    "onboard": 1,
@@ -39,6 +45,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Opportunity",
+   "link_count": 0,
    "link_to": "Opportunity",
    "link_type": "DocType",
    "onboard": 1,
@@ -49,6 +56,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Customer",
+   "link_count": 0,
    "link_to": "Customer",
    "link_type": "DocType",
    "onboard": 1,
@@ -59,6 +67,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Contact",
+   "link_count": 0,
    "link_to": "Contact",
    "link_type": "DocType",
    "onboard": 1,
@@ -69,6 +78,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Communication",
+   "link_count": 0,
    "link_to": "Communication",
    "link_type": "DocType",
    "onboard": 0,
@@ -79,6 +89,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Lead Source",
+   "link_count": 0,
    "link_to": "Lead Source",
    "link_type": "DocType",
    "onboard": 0,
@@ -89,6 +100,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Contract",
+   "link_count": 0,
    "link_to": "Contract",
    "link_type": "DocType",
    "onboard": 0,
@@ -99,6 +111,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Appointment",
+   "link_count": 0,
    "link_to": "Appointment",
    "link_type": "DocType",
    "onboard": 0,
@@ -109,6 +122,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Newsletter",
+   "link_count": 0,
    "link_to": "Newsletter",
    "link_type": "DocType",
    "onboard": 0,
@@ -118,6 +132,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Reports",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -126,6 +141,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Lead Details",
+   "link_count": 0,
    "link_to": "Lead Details",
    "link_type": "Report",
    "onboard": 1,
@@ -136,6 +152,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Sales Funnel",
+   "link_count": 0,
    "link_to": "sales-funnel",
    "link_type": "Page",
    "onboard": 1,
@@ -146,6 +163,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Prospects Engaged But Not Converted",
+   "link_count": 0,
    "link_to": "Prospects Engaged But Not Converted",
    "link_type": "Report",
    "onboard": 1,
@@ -156,6 +174,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "First Response Time for Opportunity",
+   "link_count": 0,
    "link_to": "First Response Time for Opportunity",
    "link_type": "Report",
    "onboard": 0,
@@ -166,6 +185,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Inactive Customers",
+   "link_count": 0,
    "link_to": "Inactive Customers",
    "link_type": "Report",
    "onboard": 0,
@@ -176,6 +196,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Campaign Efficiency",
+   "link_count": 0,
    "link_to": "Campaign Efficiency",
    "link_type": "Report",
    "onboard": 0,
@@ -186,6 +207,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Lead Owner Efficiency",
+   "link_count": 0,
    "link_to": "Lead Owner Efficiency",
    "link_type": "Report",
    "onboard": 0,
@@ -195,6 +217,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Maintenance",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -203,6 +226,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Maintenance Schedule",
+   "link_count": 0,
    "link_to": "Maintenance Schedule",
    "link_type": "DocType",
    "onboard": 1,
@@ -213,6 +237,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Maintenance Visit",
+   "link_count": 0,
    "link_to": "Maintenance Visit",
    "link_type": "DocType",
    "onboard": 0,
@@ -223,6 +248,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Warranty Claim",
+   "link_count": 0,
    "link_to": "Warranty Claim",
    "link_type": "DocType",
    "onboard": 0,
@@ -232,6 +258,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Campaign",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -240,6 +267,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Campaign",
+   "link_count": 0,
    "link_to": "Campaign",
    "link_type": "DocType",
    "onboard": 0,
@@ -250,6 +278,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Email Campaign",
+   "link_count": 0,
    "link_to": "Email Campaign",
    "link_type": "DocType",
    "onboard": 0,
@@ -260,6 +289,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Social Media Post",
+   "link_count": 0,
    "link_to": "Social Media Post",
    "link_type": "DocType",
    "onboard": 0,
@@ -269,6 +299,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Settings",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -277,6 +308,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Customer Group",
+   "link_count": 0,
    "link_to": "Customer Group",
    "link_type": "DocType",
    "onboard": 1,
@@ -287,6 +319,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Territory",
+   "link_count": 0,
    "link_to": "Territory",
    "link_type": "DocType",
    "onboard": 1,
@@ -297,6 +330,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Sales Person",
+   "link_count": 0,
    "link_to": "Sales Person",
    "link_type": "DocType",
    "onboard": 1,
@@ -307,6 +341,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "SMS Center",
+   "link_count": 0,
    "link_to": "SMS Center",
    "link_type": "DocType",
    "onboard": 0,
@@ -317,6 +352,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "SMS Log",
+   "link_count": 0,
    "link_to": "SMS Log",
    "link_type": "DocType",
    "onboard": 0,
@@ -327,6 +363,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "SMS Settings",
+   "link_count": 0,
    "link_to": "SMS Settings",
    "link_type": "DocType",
    "onboard": 0,
@@ -337,6 +374,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Email Group",
+   "link_count": 0,
    "link_to": "Email Group",
    "link_type": "DocType",
    "onboard": 0,
@@ -347,6 +385,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Twitter Settings",
+   "link_count": 0,
    "link_to": "Twitter Settings",
    "link_type": "DocType",
    "onboard": 0,
@@ -357,20 +396,26 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "LinkedIn Settings",
+   "link_count": 0,
    "link_to": "LinkedIn Settings",
    "link_type": "DocType",
    "onboard": 0,
    "type": "Link"
   }
  ],
- "modified": "2020-12-01 13:38:36.871352",
+ "modified": "2021-08-05 12:15:56.913091",
  "modified_by": "Administrator",
  "module": "CRM",
  "name": "CRM",
  "onboarding": "CRM",
  "owner": "Administrator",
+ "parent_page": "",
  "pin_to_bottom": 0,
  "pin_to_top": 0,
+ "public": 1,
+ "restrict_to_domain": "",
+ "roles": [],
+ "sequence_id": 7,
  "shortcuts": [
   {
    "color": "Blue",
@@ -403,5 +448,6 @@
    "link_to": "CRM",
    "type": "Dashboard"
   }
- ]
+ ],
+ "title": "CRM"
 }
\ No newline at end of file
diff --git a/erpnext/education/workspace/education/education.json b/erpnext/education/workspace/education/education.json
index bf74961..c58ddd6 100644
--- a/erpnext/education/workspace/education/education.json
+++ b/erpnext/education/workspace/education/education.json
@@ -1,27 +1,32 @@
 {
- "category": "Domains",
+ "category": "",
  "charts": [
   {
    "chart_name": "Program Enrollments",
    "label": "Program Enrollments"
   }
  ],
+ "content": "[{\"type\": \"onboarding\", \"data\": {\"onboarding_name\":\"Education\", \"col\": 12}}, {\"type\": \"chart\", \"data\": {\"chart_name\": \"Program Enrollments\", \"col\": 12}}, {\"type\": \"spacer\", \"data\": {\"col\": 12}}, {\"type\": \"header\", \"data\": {\"text\": \"Your Shortcuts\", \"level\": 4, \"col\": 12}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Student\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Instructor\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Program\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Course\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Fees\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Student Monthly Attendance Sheet\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Course Scheduling Tool\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Student Attendance Tool\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Dashboard\", \"col\": 4}}, {\"type\": \"spacer\", \"data\": {\"col\": 12}}, {\"type\": \"header\", \"data\": {\"text\": \"Reports & Masters\", \"level\": 4, \"col\": 12}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Student and Instructor\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Masters\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Content Masters\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Settings\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Admission\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Fees\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Schedule\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Attendance\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"LMS Activity\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Assessment\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Assessment Reports\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Tools\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Other Reports\", \"col\": 4}}]",
  "creation": "2020-03-02 17:22:57.066401",
  "developer_mode_only": 0,
  "disable_user_customization": 0,
  "docstatus": 0,
  "doctype": "Workspace",
+ "extends": "",
  "extends_another_page": 0,
+ "for_user": "",
  "hide_custom": 0,
  "icon": "education",
  "idx": 0,
- "is_standard": 1,
+ "is_default": 0,
+ "is_standard": 0,
  "label": "Education",
  "links": [
   {
    "hidden": 0,
    "is_query_report": 0,
    "label": "Student and Instructor",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -30,6 +35,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Student",
+   "link_count": 0,
    "link_to": "Student",
    "link_type": "DocType",
    "onboard": 1,
@@ -40,6 +46,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Instructor",
+   "link_count": 0,
    "link_to": "Instructor",
    "link_type": "DocType",
    "onboard": 1,
@@ -50,6 +57,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Guardian",
+   "link_count": 0,
    "link_to": "Guardian",
    "link_type": "DocType",
    "onboard": 0,
@@ -60,6 +68,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Student Group",
+   "link_count": 0,
    "link_to": "Student Group",
    "link_type": "DocType",
    "onboard": 0,
@@ -70,6 +79,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Student Log",
+   "link_count": 0,
    "link_to": "Student Log",
    "link_type": "DocType",
    "onboard": 0,
@@ -79,6 +89,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Masters",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -87,6 +98,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Program",
+   "link_count": 0,
    "link_to": "Program",
    "link_type": "DocType",
    "onboard": 0,
@@ -97,6 +109,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Course",
+   "link_count": 0,
    "link_to": "Course",
    "link_type": "DocType",
    "onboard": 1,
@@ -107,6 +120,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Topic",
+   "link_count": 0,
    "link_to": "Topic",
    "link_type": "DocType",
    "onboard": 0,
@@ -117,6 +131,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Room",
+   "link_count": 0,
    "link_to": "Room",
    "link_type": "DocType",
    "onboard": 1,
@@ -126,6 +141,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Content Masters",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -134,6 +150,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Article",
+   "link_count": 0,
    "link_to": "Article",
    "link_type": "DocType",
    "onboard": 0,
@@ -144,6 +161,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Video",
+   "link_count": 0,
    "link_to": "Video",
    "link_type": "DocType",
    "onboard": 0,
@@ -154,6 +172,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Quiz",
+   "link_count": 0,
    "link_to": "Quiz",
    "link_type": "DocType",
    "onboard": 0,
@@ -163,6 +182,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Settings",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -171,6 +191,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Education Settings",
+   "link_count": 0,
    "link_to": "Education Settings",
    "link_type": "DocType",
    "onboard": 0,
@@ -181,6 +202,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Student Category",
+   "link_count": 0,
    "link_to": "Student Category",
    "link_type": "DocType",
    "onboard": 0,
@@ -191,6 +213,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Student Batch Name",
+   "link_count": 0,
    "link_to": "Student Batch Name",
    "link_type": "DocType",
    "onboard": 0,
@@ -201,6 +224,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Grading Scale",
+   "link_count": 0,
    "link_to": "Grading Scale",
    "link_type": "DocType",
    "onboard": 1,
@@ -211,6 +235,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Academic Term",
+   "link_count": 0,
    "link_to": "Academic Term",
    "link_type": "DocType",
    "onboard": 0,
@@ -221,6 +246,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Academic Year",
+   "link_count": 0,
    "link_to": "Academic Year",
    "link_type": "DocType",
    "onboard": 0,
@@ -230,6 +256,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Admission",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -238,6 +265,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Student Applicant",
+   "link_count": 0,
    "link_to": "Student Applicant",
    "link_type": "DocType",
    "onboard": 0,
@@ -248,6 +276,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Student Admission",
+   "link_count": 0,
    "link_to": "Student Admission",
    "link_type": "DocType",
    "onboard": 0,
@@ -258,6 +287,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Program Enrollment",
+   "link_count": 0,
    "link_to": "Program Enrollment",
    "link_type": "DocType",
    "onboard": 0,
@@ -268,6 +298,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Course Enrollment",
+   "link_count": 0,
    "link_to": "Course Enrollment",
    "link_type": "DocType",
    "onboard": 0,
@@ -277,6 +308,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Fees",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -285,6 +317,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Fee Structure",
+   "link_count": 0,
    "link_to": "Fee Structure",
    "link_type": "DocType",
    "onboard": 0,
@@ -295,6 +328,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Fee Category",
+   "link_count": 0,
    "link_to": "Fee Category",
    "link_type": "DocType",
    "onboard": 0,
@@ -305,6 +339,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Fee Schedule",
+   "link_count": 0,
    "link_to": "Fee Schedule",
    "link_type": "DocType",
    "onboard": 0,
@@ -315,6 +350,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Fees",
+   "link_count": 0,
    "link_to": "Fees",
    "link_type": "DocType",
    "onboard": 0,
@@ -325,6 +361,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Student Fee Collection Report",
+   "link_count": 0,
    "link_to": "Student Fee Collection",
    "link_type": "Report",
    "onboard": 0,
@@ -335,6 +372,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Program wise Fee Collection Report",
+   "link_count": 0,
    "link_to": "Program wise Fee Collection",
    "link_type": "Report",
    "onboard": 0,
@@ -344,6 +382,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Schedule",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -352,6 +391,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Course Schedule",
+   "link_count": 0,
    "link_to": "Course Schedule",
    "link_type": "DocType",
    "onboard": 0,
@@ -362,6 +402,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Course Scheduling Tool",
+   "link_count": 0,
    "link_to": "Course Scheduling Tool",
    "link_type": "DocType",
    "onboard": 0,
@@ -371,6 +412,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Attendance",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -379,6 +421,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Student Attendance",
+   "link_count": 0,
    "link_to": "Student Attendance",
    "link_type": "DocType",
    "onboard": 0,
@@ -389,6 +432,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Student Leave Application",
+   "link_count": 0,
    "link_to": "Student Leave Application",
    "link_type": "DocType",
    "onboard": 0,
@@ -399,6 +443,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Student Monthly Attendance Sheet",
+   "link_count": 0,
    "link_to": "Student Monthly Attendance Sheet",
    "link_type": "Report",
    "onboard": 0,
@@ -409,6 +454,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Absent Student Report",
+   "link_count": 0,
    "link_to": "Absent Student Report",
    "link_type": "Report",
    "onboard": 0,
@@ -419,6 +465,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Student Batch-Wise Attendance",
+   "link_count": 0,
    "link_to": "Student Batch-Wise Attendance",
    "link_type": "Report",
    "onboard": 0,
@@ -428,6 +475,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "LMS Activity",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -436,6 +484,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Course Enrollment",
+   "link_count": 0,
    "link_to": "Course Enrollment",
    "link_type": "DocType",
    "onboard": 0,
@@ -446,6 +495,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Course Activity",
+   "link_count": 0,
    "link_to": "Course Activity",
    "link_type": "DocType",
    "onboard": 0,
@@ -456,6 +506,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Quiz Activity",
+   "link_count": 0,
    "link_to": "Quiz Activity",
    "link_type": "DocType",
    "onboard": 0,
@@ -465,6 +516,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Assessment",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -473,6 +525,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Assessment Plan",
+   "link_count": 0,
    "link_to": "Assessment Plan",
    "link_type": "DocType",
    "onboard": 0,
@@ -483,6 +536,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Assessment Group",
+   "link_count": 0,
    "link_to": "Assessment Group",
    "link_type": "DocType",
    "onboard": 0,
@@ -493,6 +547,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Assessment Result",
+   "link_count": 0,
    "link_to": "Assessment Result",
    "link_type": "DocType",
    "onboard": 0,
@@ -503,6 +558,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Assessment Criteria",
+   "link_count": 0,
    "link_to": "Assessment Criteria",
    "link_type": "DocType",
    "onboard": 0,
@@ -512,6 +568,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Assessment Reports",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -520,6 +577,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Course wise Assessment Report",
+   "link_count": 0,
    "link_to": "Course wise Assessment Report",
    "link_type": "Report",
    "onboard": 0,
@@ -530,6 +588,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Final Assessment Grades",
+   "link_count": 0,
    "link_to": "Final Assessment Grades",
    "link_type": "Report",
    "onboard": 0,
@@ -540,6 +599,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Assessment Plan Status",
+   "link_count": 0,
    "link_to": "Assessment Plan Status",
    "link_type": "Report",
    "onboard": 0,
@@ -550,6 +610,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Student Report Generation Tool",
+   "link_count": 0,
    "link_to": "Student Report Generation Tool",
    "link_type": "DocType",
    "onboard": 0,
@@ -559,6 +620,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Tools",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -567,6 +629,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Student Attendance Tool",
+   "link_count": 0,
    "link_to": "Student Attendance Tool",
    "link_type": "DocType",
    "onboard": 0,
@@ -577,6 +640,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Assessment Result Tool",
+   "link_count": 0,
    "link_to": "Assessment Result Tool",
    "link_type": "DocType",
    "onboard": 0,
@@ -587,6 +651,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Student Group Creation Tool",
+   "link_count": 0,
    "link_to": "Student Group Creation Tool",
    "link_type": "DocType",
    "onboard": 0,
@@ -597,6 +662,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Program Enrollment Tool",
+   "link_count": 0,
    "link_to": "Program Enrollment Tool",
    "link_type": "DocType",
    "onboard": 0,
@@ -607,6 +673,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Course Scheduling Tool",
+   "link_count": 0,
    "link_to": "Course Scheduling Tool",
    "link_type": "DocType",
    "onboard": 0,
@@ -616,6 +683,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Other Reports",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -624,21 +692,26 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Student and Guardian Contact Details",
+   "link_count": 0,
    "link_to": "Student and Guardian Contact Details",
    "link_type": "Report",
    "onboard": 0,
    "type": "Link"
   }
  ],
- "modified": "2020-12-01 13:38:37.448989",
+ "modified": "2021-08-05 12:15:57.929275",
  "modified_by": "Administrator",
  "module": "Education",
  "name": "Education",
  "onboarding": "Education",
  "owner": "Administrator",
+ "parent_page": "",
  "pin_to_bottom": 0,
  "pin_to_top": 0,
+ "public": 1,
  "restrict_to_domain": "Education",
+ "roles": [],
+ "sequence_id": 9,
  "shortcuts": [
   {
    "color": "Grey",
@@ -697,5 +770,6 @@
    "link_to": "Education",
    "type": "Dashboard"
   }
- ]
+ ],
+ "title": "Education"
 }
\ No newline at end of file
diff --git a/erpnext/erpnext_integrations/workspace/erpnext_integrations/erpnext_integrations.json b/erpnext/erpnext_integrations/workspace/erpnext_integrations/erpnext_integrations.json
index 24b8e48..9f9204a 100644
--- a/erpnext/erpnext_integrations/workspace/erpnext_integrations/erpnext_integrations.json
+++ b/erpnext/erpnext_integrations/workspace/erpnext_integrations/erpnext_integrations.json
@@ -1,22 +1,27 @@
 {
- "category": "Modules",
+ "category": "",
  "charts": [],
+ "content": "[{\"type\": \"header\", \"data\": {\"text\": \"Reports & Masters\", \"level\": 4, \"col\": 12}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Marketplace\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Payments\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Settings\", \"col\": 4}}]",
  "creation": "2020-08-20 19:30:48.138801",
  "developer_mode_only": 0,
  "disable_user_customization": 0,
  "docstatus": 0,
  "doctype": "Workspace",
- "extends": "Integrations",
- "extends_another_page": 1,
- "hide_custom": 1,
+ "extends": "",
+ "extends_another_page": 0,
+ "for_user": "",
+ "hide_custom": 0,
+ "icon": "integration",
  "idx": 0,
- "is_standard": 1,
+ "is_default": 0,
+ "is_standard": 0,
  "label": "ERPNext Integrations",
  "links": [
   {
    "hidden": 0,
    "is_query_report": 0,
    "label": "Marketplace",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -25,6 +30,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Woocommerce Settings",
+   "link_count": 0,
    "link_to": "Woocommerce Settings",
    "link_type": "DocType",
    "onboard": 0,
@@ -35,15 +41,28 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Amazon MWS Settings",
+   "link_count": 0,
    "link_to": "Amazon MWS Settings",
    "link_type": "DocType",
    "onboard": 0,
    "type": "Link"
   },
   {
+   "dependencies": "",
+   "hidden": 0,
+   "is_query_report": 0,
+   "label": "Shopify Settings",
+   "link_count": 0,
+   "link_to": "Shopify Settings",
+   "link_type": "DocType",
+   "onboard": 0,
+   "type": "Link"
+  },
+  {
    "hidden": 0,
    "is_query_report": 0,
    "label": "Payments",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -52,6 +71,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "GoCardless Settings",
+   "link_count": 0,
    "link_to": "GoCardless Settings",
    "link_type": "DocType",
    "onboard": 0,
@@ -62,6 +82,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "M-Pesa Settings",
+   "link_count": 0,
    "link_to": "Mpesa Settings",
    "link_type": "DocType",
    "onboard": 0,
@@ -71,6 +92,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Settings",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -79,6 +101,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Plaid Settings",
+   "link_count": 0,
    "link_to": "Plaid Settings",
    "link_type": "DocType",
    "onboard": 0,
@@ -89,18 +112,26 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Exotel Settings",
+   "link_count": 0,
    "link_to": "Exotel Settings",
    "link_type": "DocType",
    "onboard": 0,
    "type": "Link"
   }
  ],
- "modified": "2020-12-01 13:38:35.846528",
+ "modified": "2021-08-05 12:15:58.740246",
  "modified_by": "Administrator",
  "module": "ERPNext Integrations",
  "name": "ERPNext Integrations",
+ "onboarding": "",
  "owner": "Administrator",
+ "parent_page": "",
  "pin_to_bottom": 0,
  "pin_to_top": 0,
- "shortcuts": []
+ "public": 1,
+ "restrict_to_domain": "",
+ "roles": [],
+ "sequence_id": 10,
+ "shortcuts": [],
+ "title": "ERPNext Integrations"
 }
diff --git a/erpnext/erpnext_integrations/workspace/erpnext_integrations_settings/erpnext_integrations_settings.json b/erpnext/erpnext_integrations/workspace/erpnext_integrations_settings/erpnext_integrations_settings.json
index d656b3c..fd4afb8 100644
--- a/erpnext/erpnext_integrations/workspace/erpnext_integrations_settings/erpnext_integrations_settings.json
+++ b/erpnext/erpnext_integrations/workspace/erpnext_integrations_settings/erpnext_integrations_settings.json
@@ -1,22 +1,27 @@
 {
- "category": "Modules",
+ "category": "",
  "charts": [],
+ "content": "[{\"type\": \"header\", \"data\": {\"text\": \"Reports & Masters\", \"level\": 4, \"col\": 12}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Integrations Settings\", \"col\": 4}}]",
  "creation": "2020-07-31 10:38:54.021237",
  "developer_mode_only": 0,
  "disable_user_customization": 0,
  "docstatus": 0,
  "doctype": "Workspace",
- "extends": "Settings",
- "extends_another_page": 1,
+ "extends": "",
+ "extends_another_page": 0,
+ "for_user": "",
  "hide_custom": 0,
+ "icon": "setting",
  "idx": 0,
- "is_standard": 1,
+ "is_default": 0,
+ "is_standard": 0,
  "label": "ERPNext Integrations Settings",
  "links": [
   {
    "hidden": 0,
    "is_query_report": 0,
    "label": "Integrations Settings",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -25,6 +30,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Woocommerce Settings",
+   "link_count": 0,
    "link_to": "Woocommerce Settings",
    "link_type": "DocType",
    "onboard": 0,
@@ -34,7 +40,19 @@
    "dependencies": "",
    "hidden": 0,
    "is_query_report": 0,
+   "label": "Shopify Settings",
+   "link_count": 0,
+   "link_to": "Shopify Settings",
+   "link_type": "DocType",
+   "onboard": 0,
+   "type": "Link"
+  },
+  {
+   "dependencies": "",
+   "hidden": 0,
+   "is_query_report": 0,
    "label": "Amazon MWS Settings",
+   "link_count": 0,
    "link_to": "Amazon MWS Settings",
    "link_type": "DocType",
    "onboard": 0,
@@ -45,6 +63,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Plaid Settings",
+   "link_count": 0,
    "link_to": "Plaid Settings",
    "link_type": "DocType",
    "onboard": 0,
@@ -55,18 +74,26 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Exotel Settings",
+   "link_count": 0,
    "link_to": "Exotel Settings",
    "link_type": "DocType",
    "onboard": 0,
    "type": "Link"
   }
  ],
- "modified": "2020-12-01 13:38:34.732552",
+ "modified": "2021-08-05 12:15:58.951704",
  "modified_by": "Administrator",
  "module": "ERPNext Integrations",
  "name": "ERPNext Integrations Settings",
+ "onboarding": "",
  "owner": "Administrator",
+ "parent_page": "",
  "pin_to_bottom": 0,
  "pin_to_top": 0,
- "shortcuts": []
+ "public": 1,
+ "restrict_to_domain": "",
+ "roles": [],
+ "sequence_id": 11,
+ "shortcuts": [],
+ "title": "ERPNext Integrations Settings"
 }
diff --git a/erpnext/healthcare/doctype/appointment_type_service_item/appointment_type_service_item.json b/erpnext/healthcare/doctype/appointment_type_service_item/appointment_type_service_item.json
index 5ff68cd..ccae129 100644
--- a/erpnext/healthcare/doctype/appointment_type_service_item/appointment_type_service_item.json
+++ b/erpnext/healthcare/doctype/appointment_type_service_item/appointment_type_service_item.json
@@ -48,13 +48,13 @@
    "fieldname": "inpatient_visit_charge",
    "fieldtype": "Currency",
    "in_list_view": 1,
-   "label": "Inpatient Visit Charge Item"
+   "label": "Inpatient Visit Charge"
   }
  ],
  "index_web_pages_for_search": 1,
  "istable": 1,
  "links": [],
- "modified": "2021-01-22 09:35:26.503443",
+ "modified": "2021-08-17 06:05:02.240812",
  "modified_by": "Administrator",
  "module": "Healthcare",
  "name": "Appointment Type Service Item",
diff --git a/erpnext/healthcare/print_format/encounter_print/encounter_print.json b/erpnext/healthcare/print_format/encounter_print/encounter_print.json
index ec1e0f2..3c90adb 100644
--- a/erpnext/healthcare/print_format/encounter_print/encounter_print.json
+++ b/erpnext/healthcare/print_format/encounter_print/encounter_print.json
@@ -16,7 +16,7 @@
  "name": "Encounter Print",
  "owner": "Administrator",
  "print_format_builder": 0,
- "print_format_type": "Server",
+ "print_format_type": "Jinja",
  "show_section_headings": 0,
  "standard": "Yes"
 }
\ No newline at end of file
diff --git a/erpnext/healthcare/print_format/sample_id_print/sample_id_print.json b/erpnext/healthcare/print_format/sample_id_print/sample_id_print.json
index e99ce70..4819e6d 100644
--- a/erpnext/healthcare/print_format/sample_id_print/sample_id_print.json
+++ b/erpnext/healthcare/print_format/sample_id_print/sample_id_print.json
@@ -16,7 +16,7 @@
  "name": "Sample ID Print", 
  "owner": "Administrator",
  "print_format_builder": 0,
- "print_format_type": "Server",
+ "print_format_type": "Jinja",
  "show_section_headings": 0,
  "standard": "Yes"
 }
diff --git a/erpnext/healthcare/workspace/healthcare/healthcare.json b/erpnext/healthcare/workspace/healthcare/healthcare.json
index b93dda2..55132f3 100644
--- a/erpnext/healthcare/workspace/healthcare/healthcare.json
+++ b/erpnext/healthcare/workspace/healthcare/healthcare.json
@@ -1,5 +1,5 @@
 {
- "category": "Domains",
+ "category": "",
  "charts": [
   {
    "chart_name": "Patient Appointments",
@@ -7,22 +7,27 @@
   }
  ],
  "charts_label": "",
+ "content": "[{\"type\": \"onboarding\", \"data\": {\"onboarding_name\":\"Healthcare\", \"col\": 12}}, {\"type\": \"chart\", \"data\": {\"chart_name\": \"Patient Appointments\", \"col\": 12}}, {\"type\": \"spacer\", \"data\": {\"col\": 12}}, {\"type\": \"header\", \"data\": {\"text\": \"Your Shortcuts\", \"level\": 4, \"col\": 12}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Patient Appointment\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Patient\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Healthcare Service Unit\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Healthcare Practitioner\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Patient History\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Dashboard\", \"col\": 4}}, {\"type\": \"spacer\", \"data\": {\"col\": 12}}, {\"type\": \"header\", \"data\": {\"text\": \"Reports & Masters\", \"level\": 4, \"col\": 12}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Masters\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Consultation Setup\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Consultation\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Settings\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Laboratory Setup\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Laboratory\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Rehabilitation and Physiotherapy\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Records and History\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Reports\", \"col\": 4}}]",
  "creation": "2020-03-02 17:23:17.919682",
  "developer_mode_only": 0,
  "disable_user_customization": 0,
  "docstatus": 0,
  "doctype": "Workspace",
+ "extends": "",
  "extends_another_page": 0,
+ "for_user": "",
  "hide_custom": 0,
  "icon": "healthcare",
  "idx": 0,
- "is_standard": 1,
+ "is_default": 0,
+ "is_standard": 0,
  "label": "Healthcare",
  "links": [
   {
    "hidden": 0,
    "is_query_report": 0,
    "label": "Masters",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -31,6 +36,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Patient",
+   "link_count": 0,
    "link_to": "Patient",
    "link_type": "DocType",
    "onboard": 1,
@@ -41,6 +47,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Healthcare Practitioner",
+   "link_count": 0,
    "link_to": "Healthcare Practitioner",
    "link_type": "DocType",
    "onboard": 1,
@@ -51,6 +58,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Practitioner Schedule",
+   "link_count": 0,
    "link_to": "Practitioner Schedule",
    "link_type": "DocType",
    "onboard": 1,
@@ -61,6 +69,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Medical Department",
+   "link_count": 0,
    "link_to": "Medical Department",
    "link_type": "DocType",
    "onboard": 0,
@@ -71,6 +80,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Healthcare Service Unit Type",
+   "link_count": 0,
    "link_to": "Healthcare Service Unit Type",
    "link_type": "DocType",
    "onboard": 0,
@@ -81,6 +91,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Healthcare Service Unit",
+   "link_count": 0,
    "link_to": "Healthcare Service Unit",
    "link_type": "DocType",
    "onboard": 0,
@@ -91,6 +102,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Medical Code Standard",
+   "link_count": 0,
    "link_to": "Medical Code Standard",
    "link_type": "DocType",
    "onboard": 0,
@@ -101,6 +113,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Medical Code",
+   "link_count": 0,
    "link_to": "Medical Code",
    "link_type": "DocType",
    "onboard": 0,
@@ -110,6 +123,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Consultation Setup",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -118,6 +132,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Appointment Type",
+   "link_count": 0,
    "link_to": "Appointment Type",
    "link_type": "DocType",
    "onboard": 0,
@@ -128,6 +143,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Clinical Procedure Template",
+   "link_count": 0,
    "link_to": "Clinical Procedure Template",
    "link_type": "DocType",
    "onboard": 0,
@@ -138,6 +154,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Prescription Dosage",
+   "link_count": 0,
    "link_to": "Prescription Dosage",
    "link_type": "DocType",
    "onboard": 0,
@@ -148,6 +165,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Prescription Duration",
+   "link_count": 0,
    "link_to": "Prescription Duration",
    "link_type": "DocType",
    "onboard": 0,
@@ -158,6 +176,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Antibiotic",
+   "link_count": 0,
    "link_to": "Antibiotic",
    "link_type": "DocType",
    "onboard": 0,
@@ -167,6 +186,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Consultation",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -175,6 +195,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Patient Appointment",
+   "link_count": 0,
    "link_to": "Patient Appointment",
    "link_type": "DocType",
    "onboard": 0,
@@ -185,6 +206,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Clinical Procedure",
+   "link_count": 0,
    "link_to": "Clinical Procedure",
    "link_type": "DocType",
    "onboard": 0,
@@ -195,6 +217,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Patient Encounter",
+   "link_count": 0,
    "link_to": "Patient Encounter",
    "link_type": "DocType",
    "onboard": 0,
@@ -205,6 +228,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Vital Signs",
+   "link_count": 0,
    "link_to": "Vital Signs",
    "link_type": "DocType",
    "onboard": 0,
@@ -215,6 +239,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Complaint",
+   "link_count": 0,
    "link_to": "Complaint",
    "link_type": "DocType",
    "onboard": 0,
@@ -225,6 +250,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Diagnosis",
+   "link_count": 0,
    "link_to": "Diagnosis",
    "link_type": "DocType",
    "onboard": 0,
@@ -235,6 +261,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Fee Validity",
+   "link_count": 0,
    "link_to": "Fee Validity",
    "link_type": "DocType",
    "onboard": 0,
@@ -244,6 +271,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Settings",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -252,6 +280,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Healthcare Settings",
+   "link_count": 0,
    "link_to": "Healthcare Settings",
    "link_type": "DocType",
    "onboard": 1,
@@ -261,6 +290,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Laboratory Setup",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -269,6 +299,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Lab Test Template",
+   "link_count": 0,
    "link_to": "Lab Test Template",
    "link_type": "DocType",
    "onboard": 0,
@@ -279,6 +310,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Lab Test Sample",
+   "link_count": 0,
    "link_to": "Lab Test Sample",
    "link_type": "DocType",
    "onboard": 0,
@@ -289,6 +321,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Lab Test UOM",
+   "link_count": 0,
    "link_to": "Lab Test UOM",
    "link_type": "DocType",
    "onboard": 0,
@@ -299,6 +332,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Sensitivity",
+   "link_count": 0,
    "link_to": "Sensitivity",
    "link_type": "DocType",
    "onboard": 0,
@@ -308,6 +342,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Laboratory",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -316,6 +351,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Lab Test",
+   "link_count": 0,
    "link_to": "Lab Test",
    "link_type": "DocType",
    "onboard": 0,
@@ -326,6 +362,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Sample Collection",
+   "link_count": 0,
    "link_to": "Sample Collection",
    "link_type": "DocType",
    "onboard": 0,
@@ -336,6 +373,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Dosage Form",
+   "link_count": 0,
    "link_to": "Dosage Form",
    "link_type": "DocType",
    "onboard": 0,
@@ -345,6 +383,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Rehabilitation and Physiotherapy",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -353,6 +392,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Exercise Type",
+   "link_count": 0,
    "link_to": "Exercise Type",
    "link_type": "DocType",
    "onboard": 1,
@@ -363,6 +403,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Therapy Type",
+   "link_count": 0,
    "link_to": "Therapy Type",
    "link_type": "DocType",
    "onboard": 1,
@@ -373,6 +414,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Therapy Plan",
+   "link_count": 0,
    "link_to": "Therapy Plan",
    "link_type": "DocType",
    "onboard": 0,
@@ -383,6 +425,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Therapy Session",
+   "link_count": 0,
    "link_to": "Therapy Session",
    "link_type": "DocType",
    "onboard": 0,
@@ -393,6 +436,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Patient Assessment Template",
+   "link_count": 0,
    "link_to": "Patient Assessment Template",
    "link_type": "DocType",
    "onboard": 0,
@@ -403,6 +447,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Patient Assessment",
+   "link_count": 0,
    "link_to": "Patient Assessment",
    "link_type": "DocType",
    "onboard": 0,
@@ -412,6 +457,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Records and History",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -420,6 +466,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Patient History",
+   "link_count": 0,
    "link_to": "patient_history",
    "link_type": "Page",
    "onboard": 0,
@@ -430,6 +477,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Patient Progress",
+   "link_count": 0,
    "link_to": "patient-progress",
    "link_type": "Page",
    "onboard": 0,
@@ -440,6 +488,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Patient Medical Record",
+   "link_count": 0,
    "link_to": "Patient Medical Record",
    "link_type": "DocType",
    "onboard": 0,
@@ -450,6 +499,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Inpatient Record",
+   "link_count": 0,
    "link_to": "Inpatient Record",
    "link_type": "DocType",
    "onboard": 0,
@@ -459,6 +509,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Reports",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -467,6 +518,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Patient Appointment Analytics",
+   "link_count": 0,
    "link_to": "Patient Appointment Analytics",
    "link_type": "Report",
    "onboard": 0,
@@ -477,21 +529,26 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Lab Test Report",
+   "link_count": 0,
    "link_to": "Lab Test Report",
    "link_type": "Report",
    "onboard": 0,
    "type": "Link"
   }
  ],
- "modified": "2020-12-01 13:38:34.841396",
+ "modified": "2021-08-05 12:15:59.434612",
  "modified_by": "Administrator",
  "module": "Healthcare",
  "name": "Healthcare",
  "onboarding": "Healthcare",
  "owner": "Administrator",
+ "parent_page": "",
  "pin_to_bottom": 0,
  "pin_to_top": 0,
+ "public": 1,
  "restrict_to_domain": "Healthcare",
+ "roles": [],
+ "sequence_id": 13,
  "shortcuts": [
   {
    "color": "Orange",
@@ -532,5 +589,6 @@
    "link_to": "Healthcare",
    "type": "Dashboard"
   }
- ]
+ ],
+ "title": "Healthcare"
 }
\ No newline at end of file
diff --git a/erpnext/hr/doctype/attendance/attendance.py b/erpnext/hr/doctype/attendance/attendance.py
index f79f0fe..c1a7c8f 100644
--- a/erpnext/hr/doctype/attendance/attendance.py
+++ b/erpnext/hr/doctype/attendance/attendance.py
@@ -135,7 +135,7 @@
 def mark_bulk_attendance(data):
 	import json
 	from pprint import pprint
-	if isinstance(data, frappe.string_types):
+	if isinstance(data, str):
 		data = json.loads(data)
 	data = frappe._dict(data)
 	company = frappe.get_value('Employee', data.employee, 'company')
diff --git a/erpnext/hr/doctype/attendance_request/test_attendance_request.py b/erpnext/hr/doctype/attendance_request/test_attendance_request.py
index 3c42bd9..9e668aa 100644
--- a/erpnext/hr/doctype/attendance_request/test_attendance_request.py
+++ b/erpnext/hr/doctype/attendance_request/test_attendance_request.py
@@ -15,7 +15,11 @@
 		for doctype in ["Attendance Request", "Attendance"]:
 			frappe.db.sql("delete from `tab{doctype}`".format(doctype=doctype))
 
+	def tearDown(self):
+		frappe.db.rollback()
+
 	def test_on_duty_attendance_request(self):
+		"Test creation/updation of Attendace from Attendance Request, on duty."
 		today = nowdate()
 		employee = get_employee()
 		attendance_request = frappe.new_doc("Attendance Request")
@@ -26,17 +30,36 @@
 		attendance_request.company = "_Test Company"
 		attendance_request.insert()
 		attendance_request.submit()
-		attendance = frappe.get_doc('Attendance', {
-			'employee': employee.name,
-			'attendance_date': date(date.today().year, 1, 1),
-			'docstatus': 1
-		})
-		self.assertEqual(attendance.status, 'Present')
+
+		attendance = frappe.db.get_value(
+			"Attendance",
+			filters={
+				"attendance_request": attendance_request.name,
+				"attendance_date": date(date.today().year, 1, 1)
+			},
+			fieldname=["status", "docstatus"],
+			as_dict=True
+		)
+		self.assertEqual(attendance.status, "Present")
+		self.assertEqual(attendance.docstatus, 1)
+
+		# cancelling attendance request cancels linked attendances
 		attendance_request.cancel()
-		attendance.reload()
-		self.assertEqual(attendance.docstatus, 2)
+
+		# cancellation alters docname
+		# fetch attendance value again to avoid stale docname
+		attendance_docstatus = frappe.db.get_value(
+			"Attendance",
+			filters={
+				"attendance_request": attendance_request.name,
+				"attendance_date": date(date.today().year, 1, 1)
+			},
+			fieldname="docstatus"
+		)
+		self.assertEqual(attendance_docstatus, 2)
 
 	def test_work_from_home_attendance_request(self):
+		"Test creation/updation of Attendace from Attendance Request, work from home."
 		today = nowdate()
 		employee = get_employee()
 		attendance_request = frappe.new_doc("Attendance Request")
@@ -47,15 +70,30 @@
 		attendance_request.company = "_Test Company"
 		attendance_request.insert()
 		attendance_request.submit()
-		attendance = frappe.get_doc('Attendance', {
-			'employee': employee.name,
-			'attendance_date': date(date.today().year, 1, 1),
-			'docstatus': 1
-		})
-		self.assertEqual(attendance.status, 'Work From Home')
+
+		attendance_status = frappe.db.get_value(
+			"Attendance",
+			filters={
+				"attendance_request": attendance_request.name,
+				"attendance_date": date(date.today().year, 1, 1)
+			},
+			fieldname="status"
+		)
+		self.assertEqual(attendance_status, 'Work From Home')
+
 		attendance_request.cancel()
-		attendance.reload()
-		self.assertEqual(attendance.docstatus, 2)
+
+		# cancellation alters docname
+		# fetch attendance value again to avoid stale docname
+		attendance_docstatus = frappe.db.get_value(
+			"Attendance",
+			filters={
+				"attendance_request": attendance_request.name,
+				"attendance_date": date(date.today().year, 1, 1)
+			},
+			fieldname="docstatus"
+		)
+		self.assertEqual(attendance_docstatus, 2)
 
 def get_employee():
 	return frappe.get_doc("Employee", "_T-Employee-00001")
diff --git a/erpnext/hr/doctype/leave_type/leave_type.json b/erpnext/hr/doctype/leave_type/leave_type.json
index fc577ef..8f2ae6e 100644
--- a/erpnext/hr/doctype/leave_type/leave_type.json
+++ b/erpnext/hr/doctype/leave_type/leave_type.json
@@ -214,7 +214,7 @@
  "icon": "fa fa-flag",
  "idx": 1,
  "links": [],
- "modified": "2021-03-02 11:22:33.776320",
+ "modified": "2021-08-12 16:10:36.464690",
  "modified_by": "Administrator",
  "module": "HR",
  "name": "Leave Type",
@@ -248,5 +248,6 @@
   }
  ],
  "sort_field": "modified",
- "sort_order": "DESC"
+ "sort_order": "DESC",
+ "track_changes": 1
 }
\ No newline at end of file
diff --git a/erpnext/hr/doctype/shift_request/test_shift_request.py b/erpnext/hr/doctype/shift_request/test_shift_request.py
index 9c0d8e3..3525540 100644
--- a/erpnext/hr/doctype/shift_request/test_shift_request.py
+++ b/erpnext/hr/doctype/shift_request/test_shift_request.py
@@ -15,24 +15,35 @@
 		for doctype in ["Shift Request", "Shift Assignment"]:
 			frappe.db.sql("delete from `tab{doctype}`".format(doctype=doctype))
 
+	def tearDown(self):
+		frappe.db.rollback()
+
 	def test_make_shift_request(self):
+		"Test creation/updation of Shift Assignment from Shift Request."
 		department = frappe.get_value("Employee", "_T-Employee-00001", 'department')
 		set_shift_approver(department)
 		approver = frappe.db.sql("""select approver from `tabDepartment Approver` where parent= %s and parentfield = 'shift_request_approver'""", (department))[0][0]
 
 		shift_request = make_shift_request(approver)
 
-		shift_assignments = frappe.db.sql('''
-				SELECT shift_request, employee
-				FROM `tabShift Assignment`
-				WHERE shift_request = '{0}'
-			'''.format(shift_request.name), as_dict=1)
-		for d in shift_assignments:
-			employee = d.get('employee')
-			self.assertEqual(shift_request.employee, employee)
-			shift_request.cancel()
-			shift_assignment_doc = frappe.get_doc("Shift Assignment", {"shift_request": d.get('shift_request')})
-			self.assertEqual(shift_assignment_doc.docstatus, 2)
+		# Only one shift assignment is created against a shift request
+		shift_assignment = frappe.db.get_value(
+			"Shift Assignment",
+			filters={"shift_request": shift_request.name},
+			fieldname=["employee", "docstatus"],
+			as_dict=True
+		)
+		self.assertEqual(shift_request.employee, shift_assignment.employee)
+		self.assertEqual(shift_assignment.docstatus, 1)
+
+		shift_request.cancel()
+
+		shift_assignment_docstatus = frappe.db.get_value(
+			"Shift Assignment",
+			filters={"shift_request": shift_request.name},
+			fieldname="docstatus"
+		)
+		self.assertEqual(shift_assignment_docstatus, 2)
 
 	def test_shift_request_approver_perms(self):
 		employee = frappe.get_doc("Employee", "_T-Employee-00001")
diff --git a/erpnext/hr/doctype/training_event/test_training_event.py b/erpnext/hr/doctype/training_event/test_training_event.py
index 313f90e..9b32136 100644
--- a/erpnext/hr/doctype/training_event/test_training_event.py
+++ b/erpnext/hr/doctype/training_event/test_training_event.py
@@ -11,21 +11,34 @@
 class TestTrainingEvent(unittest.TestCase):
 	def setUp(self):
 		create_training_program("Basic Training")
-		self.employee = make_employee("robert_loan@trainig.com")
-		self.employee2 = make_employee("suzie.tan@trainig.com")
+		employee = make_employee("robert_loan@trainig.com")
+		employee2 = make_employee("suzie.tan@trainig.com")
+		self.attendees = [
+			{"employee": employee},
+			{"employee": employee2}
+		]
 
-	def test_create_training_event(self):
-		if not frappe.db.get_value("Training Event", "Basic Training Event"):
-			frappe.get_doc({
-				"doctype": "Training Event",
-				"event_name": "Basic Training Event",
-				"training_program": "Basic Training",
-				"location": "Union Square",
-				"start_time": add_days(today(), 5),
-				"end_time": add_days(today(), 6),
-				"introduction": "Welcome to the Basic Training Event",
-				"employees": get_attendees(self.employee, self.employee2)
-			}).insert()
+	def test_training_event_status_update(self):
+		training_event = create_training_event(self.attendees)
+		training_event.submit()
+
+		training_event.event_status = "Completed"
+		training_event.save()
+		training_event.reload()
+
+		for entry in training_event.employees:
+			self.assertEqual(entry.status, "Completed")
+
+		training_event.event_status = "Scheduled"
+		training_event.save()
+		training_event.reload()
+
+		for entry in training_event.employees:
+			self.assertEqual(entry.status, "Open")
+
+	def tearDown(self):
+		frappe.db.rollback()
+
 
 def create_training_program(training_program):
 	if not frappe.db.get_value("Training Program", training_program):
@@ -35,8 +48,14 @@
 			"description": training_program
 		}).insert()
 
-def get_attendees(employee, employee2):
-	return [
-		{"employee": employee},
-		{"employee": employee2}
-	]
\ No newline at end of file
+def create_training_event(attendees):
+	return frappe.get_doc({
+		"doctype": "Training Event",
+		"event_name": "Basic Training Event",
+		"training_program": "Basic Training",
+		"location": "Union Square",
+		"start_time": add_days(today(), 5),
+		"end_time": add_days(today(), 6),
+		"introduction": "Welcome to the Basic Training Event",
+		"employees": attendees
+	}).insert()
\ No newline at end of file
diff --git a/erpnext/hr/doctype/training_event/training_event.py b/erpnext/hr/doctype/training_event/training_event.py
index 5064f03..e2c30cb 100644
--- a/erpnext/hr/doctype/training_event/training_event.py
+++ b/erpnext/hr/doctype/training_event/training_event.py
@@ -14,10 +14,25 @@
 		self.set_employee_emails()
 		self.validate_period()
 
+	def on_update_after_submit(self):
+		self.set_status_for_attendees()
+
 	def set_employee_emails(self):
 		self.employee_emails = ', '.join(get_employee_emails([d.employee
 			for d in self.employees]))
 
 	def validate_period(self):
 		if time_diff_in_seconds(self.end_time, self.start_time) <= 0:
-			frappe.throw(_('End time cannot be before start time'))
\ No newline at end of file
+			frappe.throw(_('End time cannot be before start time'))
+
+	def set_status_for_attendees(self):
+		if self.event_status == 'Completed':
+			for employee in self.employees:
+				if employee.attendance == 'Present' and employee.status != 'Feedback Submitted':
+					employee.status = 'Completed'
+
+		elif self.event_status == 'Scheduled':
+			for employee in self.employees:
+				employee.status = 'Open'
+
+		self.db_update_all()
diff --git a/erpnext/hr/doctype/training_feedback/test_training_feedback.py b/erpnext/hr/doctype/training_feedback/test_training_feedback.py
index 3455998..c30a3ad 100644
--- a/erpnext/hr/doctype/training_feedback/test_training_feedback.py
+++ b/erpnext/hr/doctype/training_feedback/test_training_feedback.py
@@ -5,8 +5,63 @@
 
 import frappe
 import unittest
-
-# test_records = frappe.get_test_records('Training Feedback')
-
+from erpnext.payroll.doctype.salary_structure.test_salary_structure import make_employee
+from erpnext.hr.doctype.training_event.test_training_event import create_training_program, create_training_event
 class TestTrainingFeedback(unittest.TestCase):
-	pass
+	def setUp(self):
+		create_training_program("Basic Training")
+		self.employee = make_employee("robert_loan@trainig.com")
+		self.employee2 = make_employee("suzie.tan@trainig.com")
+		self.attendees = [{"employee": self.employee}]
+
+	def test_employee_validations_for_feedback(self):
+		training_event = create_training_event(self.attendees)
+		training_event.submit()
+
+		training_event.event_status = "Completed"
+		training_event.save()
+		training_event.reload()
+
+		# should not allow creating feedback since employee2 was not part of the event
+		feedback = create_training_feedback(training_event.name, self.employee2)
+		self.assertRaises(frappe.ValidationError, feedback.save)
+
+		# cannot record feedback for absent employee
+		employee = frappe.db.get_value("Training Event Employee", {
+			"parent": training_event.name,
+			"employee": self.employee
+		}, "name")
+
+		frappe.db.set_value("Training Event Employee", employee, "attendance", "Absent")
+		feedback = create_training_feedback(training_event.name, self.employee)
+		self.assertRaises(frappe.ValidationError, feedback.save)
+
+	def test_training_feedback_status(self):
+		training_event = create_training_event(self.attendees)
+		training_event.submit()
+
+		training_event.event_status = "Completed"
+		training_event.save()
+		training_event.reload()
+
+		feedback = create_training_feedback(training_event.name, self.employee)
+		feedback.submit()
+
+		status = frappe.db.get_value("Training Event Employee", {
+			"parent": training_event.name,
+			"employee": self.employee
+		}, "status")
+
+		self.assertEqual(status, "Feedback Submitted")
+
+	def tearDown(self):
+		frappe.db.rollback()
+
+
+def create_training_feedback(event, employee):
+	return frappe.get_doc({
+		"doctype": "Training Feedback",
+		"training_event": event,
+		"employee": employee,
+		"feedback": "Test"
+	})
\ No newline at end of file
diff --git a/erpnext/hr/doctype/training_feedback/training_feedback.py b/erpnext/hr/doctype/training_feedback/training_feedback.py
index 1a33450..0d32de7 100644
--- a/erpnext/hr/doctype/training_feedback/training_feedback.py
+++ b/erpnext/hr/doctype/training_feedback/training_feedback.py
@@ -11,15 +11,35 @@
 	def validate(self):
 		training_event = frappe.get_doc("Training Event", self.training_event)
 		if training_event.docstatus != 1:
-			frappe.throw(_('{0} must be submitted').format(_('Training Event')))
+			frappe.throw(_("{0} must be submitted").format(_("Training Event")))
+
+		emp_event_details = frappe.db.get_value("Training Event Employee", {
+			"parent": self.training_event,
+			"employee": self.employee
+		}, ["name", "attendance"], as_dict=True)
+
+		if not emp_event_details:
+			frappe.throw(_("Employee {0} not found in Training Event Participants.").format(
+				frappe.bold(self.employee_name)))
+
+		if emp_event_details.attendance == "Absent":
+			frappe.throw(_("Feedback cannot be recorded for an absent Employee."))
 
 	def on_submit(self):
-		training_event = frappe.get_doc("Training Event", self.training_event)
-		event_status = None
-		for e in training_event.employees:
-			if e.employee == self.employee:
-				event_status = 'Feedback Submitted'
-				break
+		employee = frappe.db.get_value("Training Event Employee", {
+			"parent": self.training_event,
+			"employee": self.employee
+		})
 
-		if event_status:
-			frappe.db.set_value("Training Event", self.training_event, "event_status", event_status)
+		if employee:
+			frappe.db.set_value("Training Event Employee", employee, "status", "Feedback Submitted")
+
+	def on_cancel(self):
+		employee = frappe.db.get_value("Training Event Employee", {
+			"parent": self.training_event,
+			"employee": self.employee
+		})
+
+		if employee:
+			frappe.db.set_value("Training Event Employee", employee, "status", "Completed")
+
diff --git a/erpnext/hr/page/organizational_chart/__init__.py b/erpnext/hr/page/organizational_chart/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/erpnext/hr/page/organizational_chart/__init__.py
diff --git a/erpnext/hr/page/organizational_chart/organizational_chart.js b/erpnext/hr/page/organizational_chart/organizational_chart.js
new file mode 100644
index 0000000..08f2c94
--- /dev/null
+++ b/erpnext/hr/page/organizational_chart/organizational_chart.js
@@ -0,0 +1,21 @@
+frappe.pages['organizational-chart'].on_page_load = function(wrapper) {
+	frappe.ui.make_app_page({
+		parent: wrapper,
+		title: __('Organizational Chart'),
+		single_column: true
+	});
+
+	$(wrapper).bind('show', () => {
+		frappe.require('hierarchy-chart.bundle.js', () => {
+			let organizational_chart = undefined;
+			let method = 'erpnext.hr.page.organizational_chart.organizational_chart.get_children';
+
+			if (frappe.is_mobile()) {
+				organizational_chart = new erpnext.HierarchyChartMobile('Employee', wrapper, method);
+			} else {
+				organizational_chart = new erpnext.HierarchyChart('Employee', wrapper, method);
+			}
+			organizational_chart.show();
+		});
+	});
+};
\ No newline at end of file
diff --git a/erpnext/hr/page/organizational_chart/organizational_chart.json b/erpnext/hr/page/organizational_chart/organizational_chart.json
new file mode 100644
index 0000000..d802781
--- /dev/null
+++ b/erpnext/hr/page/organizational_chart/organizational_chart.json
@@ -0,0 +1,26 @@
+{
+ "content": null,
+ "creation": "2021-05-25 10:53:10.107241",
+ "docstatus": 0,
+ "doctype": "Page",
+ "idx": 0,
+ "modified": "2021-05-25 10:53:18.201931",
+ "modified_by": "Administrator",
+ "module": "HR",
+ "name": "organizational-chart",
+ "owner": "Administrator",
+ "page_name": "Organizational Chart",
+ "roles": [
+  {
+   "role": "HR User"
+  },
+  {
+   "role": "HR Manager"
+  }
+ ],
+ "script": null,
+ "standard": "Yes",
+ "style": null,
+ "system_page": 0,
+ "title": "Organizational Chart"
+}
\ No newline at end of file
diff --git a/erpnext/hr/page/organizational_chart/organizational_chart.py b/erpnext/hr/page/organizational_chart/organizational_chart.py
new file mode 100644
index 0000000..2983198
--- /dev/null
+++ b/erpnext/hr/page/organizational_chart/organizational_chart.py
@@ -0,0 +1,48 @@
+from __future__ import unicode_literals
+import frappe
+
+@frappe.whitelist()
+def get_children(parent=None, company=None, exclude_node=None):
+	filters = [['status', '!=', 'Left']]
+	if company and company != 'All Companies':
+		filters.append(['company', '=', company])
+
+	if parent and company and parent != company:
+		filters.append(['reports_to', '=', parent])
+	else:
+		filters.append(['reports_to', '=', ''])
+
+	if exclude_node:
+		filters.append(['name', '!=', exclude_node])
+
+	employees = frappe.get_list('Employee',
+		fields=['employee_name as name', 'name as id', 'reports_to', 'image', 'designation as title'],
+		filters=filters,
+		order_by='name'
+	)
+
+	for employee in employees:
+		is_expandable = frappe.db.count('Employee', filters={'reports_to': employee.get('id')})
+		employee.connections = get_connections(employee.id)
+		employee.expandable = 1 if is_expandable else 0
+
+	return employees
+
+
+def get_connections(employee):
+	num_connections = 0
+
+	nodes_to_expand = frappe.get_list('Employee', filters=[
+			['reports_to', '=', employee]
+		])
+	num_connections += len(nodes_to_expand)
+
+	while nodes_to_expand:
+		parent = nodes_to_expand.pop(0)
+		descendants = frappe.get_list('Employee', filters=[
+			['reports_to', '=', parent.name]
+		])
+		num_connections += len(descendants)
+		nodes_to_expand.extend(descendants)
+
+	return num_connections
\ No newline at end of file
diff --git a/erpnext/hr/print_format/job_offer/job_offer.json b/erpnext/hr/print_format/job_offer/job_offer.json
index 3fc2bcf..0a92230 100644
--- a/erpnext/hr/print_format/job_offer/job_offer.json
+++ b/erpnext/hr/print_format/job_offer/job_offer.json
@@ -15,7 +15,7 @@
  "name": "Job Offer", 
  "owner": "Administrator", 
  "print_format_builder": 0, 
- "print_format_type": "Server", 
+ "print_format_type": "Jinja", 
  "show_section_headings": 0, 
  "standard": "Yes"
 }
\ No newline at end of file
diff --git a/erpnext/hr/workspace/hr/hr.json b/erpnext/hr/workspace/hr/hr.json
index 4500ba4..575fa7b 100644
--- a/erpnext/hr/workspace/hr/hr.json
+++ b/erpnext/hr/workspace/hr/hr.json
@@ -1,28 +1,32 @@
 {
- "category": "Modules",
+ "category": "",
  "charts": [
   {
    "chart_name": "Outgoing Salary",
    "label": "Outgoing Salary"
   }
  ],
+ "content": "[{\"type\": \"onboarding\", \"data\": {\"onboarding_name\":\"Human Resource\", \"col\": 12}}, {\"type\": \"chart\", \"data\": {\"chart_name\": \"Outgoing Salary\", \"col\": 12}}, {\"type\": \"spacer\", \"data\": {\"col\": 12}}, {\"type\": \"header\", \"data\": {\"text\": \"Your Shortcuts\", \"level\": 4, \"col\": 12}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Employee\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Leave Application\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Attendance\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Job Applicant\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Monthly Attendance Sheet\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Dashboard\", \"col\": 4}}, {\"type\": \"spacer\", \"data\": {\"col\": 12}}, {\"type\": \"header\", \"data\": {\"text\": \"Reports & Masters\", \"level\": 4, \"col\": 12}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Employee\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Employee Lifecycle\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Shift Management\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Leaves\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Attendance\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Expense Claims\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Settings\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Fleet Management\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Recruitment\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Loans\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Training\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Performance\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Key Reports\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Other Reports\", \"col\": 4}}]",
  "creation": "2020-03-02 15:48:58.322521",
  "developer_mode_only": 0,
  "disable_user_customization": 0,
  "docstatus": 0,
  "doctype": "Workspace",
+ "extends": "",
  "extends_another_page": 0,
+ "for_user": "",
  "hide_custom": 0,
  "icon": "hr",
  "idx": 0,
  "is_default": 0,
- "is_standard": 1,
+ "is_standard": 0,
  "label": "HR",
  "links": [
   {
    "hidden": 0,
    "is_query_report": 0,
    "label": "Employee",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -31,6 +35,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Employee",
+   "link_count": 0,
    "link_to": "Employee",
    "link_type": "DocType",
    "onboard": 1,
@@ -41,6 +46,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Employment Type",
+   "link_count": 0,
    "link_to": "Employment Type",
    "link_type": "DocType",
    "onboard": 0,
@@ -51,6 +57,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Branch",
+   "link_count": 0,
    "link_to": "Branch",
    "link_type": "DocType",
    "onboard": 0,
@@ -61,6 +68,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Department",
+   "link_count": 0,
    "link_to": "Department",
    "link_type": "DocType",
    "onboard": 0,
@@ -71,6 +79,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Designation",
+   "link_count": 0,
    "link_to": "Designation",
    "link_type": "DocType",
    "onboard": 0,
@@ -81,6 +90,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Employee Grade",
+   "link_count": 0,
    "link_to": "Employee Grade",
    "link_type": "DocType",
    "onboard": 0,
@@ -91,6 +101,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Employee Group",
+   "link_count": 0,
    "link_to": "Employee Group",
    "link_type": "DocType",
    "onboard": 0,
@@ -101,6 +112,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Employee Health Insurance",
+   "link_count": 0,
    "link_to": "Employee Health Insurance",
    "link_type": "DocType",
    "onboard": 0,
@@ -110,6 +122,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Employee Lifecycle",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -118,6 +131,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Employee Onboarding",
+   "link_count": 0,
    "link_to": "Employee Onboarding",
    "link_type": "DocType",
    "onboard": 0,
@@ -128,6 +142,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Employee Skill Map",
+   "link_count": 0,
    "link_to": "Employee Skill Map",
    "link_type": "DocType",
    "onboard": 0,
@@ -138,6 +153,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Employee Promotion",
+   "link_count": 0,
    "link_to": "Employee Promotion",
    "link_type": "DocType",
    "onboard": 0,
@@ -148,6 +164,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Employee Transfer",
+   "link_count": 0,
    "link_to": "Employee Transfer",
    "link_type": "DocType",
    "onboard": 0,
@@ -157,6 +174,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Grievance Type",
+   "link_count": 0,
    "link_to": "Grievance Type",
    "link_type": "DocType",
    "onboard": 0,
@@ -166,6 +184,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Employee Grievance",
+   "link_count": 0,
    "link_to": "Employee Grievance",
    "link_type": "DocType",
    "onboard": 0,
@@ -176,6 +195,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Employee Separation",
+   "link_count": 0,
    "link_to": "Employee Separation",
    "link_type": "DocType",
    "onboard": 0,
@@ -186,6 +206,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Employee Onboarding Template",
+   "link_count": 0,
    "link_to": "Employee Onboarding Template",
    "link_type": "DocType",
    "onboard": 0,
@@ -196,6 +217,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Employee Separation Template",
+   "link_count": 0,
    "link_to": "Employee Separation Template",
    "link_type": "DocType",
    "onboard": 0,
@@ -205,6 +227,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Shift Management",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -213,6 +236,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Shift Type",
+   "link_count": 0,
    "link_to": "Shift Type",
    "link_type": "DocType",
    "onboard": 0,
@@ -223,6 +247,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Shift Request",
+   "link_count": 0,
    "link_to": "Shift Request",
    "link_type": "DocType",
    "onboard": 0,
@@ -233,6 +258,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Shift Assignment",
+   "link_count": 0,
    "link_to": "Shift Assignment",
    "link_type": "DocType",
    "onboard": 0,
@@ -242,6 +268,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Leaves",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -250,6 +277,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Holiday List",
+   "link_count": 0,
    "link_to": "Holiday List",
    "link_type": "DocType",
    "onboard": 0,
@@ -260,6 +288,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Leave Type",
+   "link_count": 0,
    "link_to": "Leave Type",
    "link_type": "DocType",
    "onboard": 0,
@@ -270,6 +299,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Leave Period",
+   "link_count": 0,
    "link_to": "Leave Period",
    "link_type": "DocType",
    "onboard": 0,
@@ -280,6 +310,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Leave Policy",
+   "link_count": 0,
    "link_to": "Leave Policy",
    "link_type": "DocType",
    "onboard": 0,
@@ -290,6 +321,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Leave Policy Assignment",
+   "link_count": 0,
    "link_to": "Leave Policy Assignment",
    "link_type": "DocType",
    "onboard": 0,
@@ -300,6 +332,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Leave Application",
+   "link_count": 0,
    "link_to": "Leave Application",
    "link_type": "DocType",
    "onboard": 0,
@@ -310,6 +343,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Leave Allocation",
+   "link_count": 0,
    "link_to": "Leave Allocation",
    "link_type": "DocType",
    "onboard": 0,
@@ -320,6 +354,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Leave Encashment",
+   "link_count": 0,
    "link_to": "Leave Encashment",
    "link_type": "DocType",
    "onboard": 0,
@@ -330,6 +365,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Leave Block List",
+   "link_count": 0,
    "link_to": "Leave Block List",
    "link_type": "DocType",
    "onboard": 0,
@@ -340,6 +376,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Compensatory Leave Request",
+   "link_count": 0,
    "link_to": "Compensatory Leave Request",
    "link_type": "DocType",
    "onboard": 0,
@@ -349,6 +386,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Attendance",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -357,6 +395,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Employee Attendance Tool",
+   "link_count": 0,
    "link_to": "Employee Attendance Tool",
    "link_type": "DocType",
    "onboard": 1,
@@ -367,6 +406,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Attendance",
+   "link_count": 0,
    "link_to": "Attendance",
    "link_type": "DocType",
    "onboard": 1,
@@ -377,6 +417,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Attendance Request",
+   "link_count": 0,
    "link_to": "Attendance Request",
    "link_type": "DocType",
    "onboard": 0,
@@ -387,6 +428,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Upload Attendance",
+   "link_count": 0,
    "link_to": "Upload Attendance",
    "link_type": "DocType",
    "onboard": 0,
@@ -397,6 +439,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Employee Checkin",
+   "link_count": 0,
    "link_to": "Employee Checkin",
    "link_type": "DocType",
    "onboard": 0,
@@ -406,6 +449,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Expense Claims",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -414,6 +458,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Expense Claim",
+   "link_count": 0,
    "link_to": "Expense Claim",
    "link_type": "DocType",
    "onboard": 0,
@@ -424,6 +469,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Employee Advance",
+   "link_count": 0,
    "link_to": "Employee Advance",
    "link_type": "DocType",
    "onboard": 0,
@@ -433,6 +479,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Travel Request",
+   "link_count": 0,
    "link_to": "Travel Request",
    "link_type": "DocType",
    "onboard": 0,
@@ -442,6 +489,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Settings",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -450,6 +498,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "HR Settings",
+   "link_count": 0,
    "link_to": "HR Settings",
    "link_type": "DocType",
    "onboard": 0,
@@ -460,6 +509,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Daily Work Summary Group",
+   "link_count": 0,
    "link_to": "Daily Work Summary Group",
    "link_type": "DocType",
    "onboard": 0,
@@ -470,6 +520,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Team Updates",
+   "link_count": 0,
    "link_to": "team-updates",
    "link_type": "Page",
    "onboard": 0,
@@ -479,6 +530,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Fleet Management",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -486,6 +538,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Driver",
+   "link_count": 0,
    "link_to": "Driver",
    "link_type": "DocType",
    "onboard": 0,
@@ -496,6 +549,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Vehicle",
+   "link_count": 0,
    "link_to": "Vehicle",
    "link_type": "DocType",
    "onboard": 0,
@@ -506,6 +560,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Vehicle Log",
+   "link_count": 0,
    "link_to": "Vehicle Log",
    "link_type": "DocType",
    "onboard": 0,
@@ -516,6 +571,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Vehicle Expenses",
+   "link_count": 0,
    "link_to": "Vehicle Expenses",
    "link_type": "Report",
    "onboard": 0,
@@ -525,6 +581,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Recruitment",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -533,6 +590,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Job Opening",
+   "link_count": 0,
    "link_to": "Job Opening",
    "link_type": "DocType",
    "onboard": 1,
@@ -542,6 +600,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Employee Referral",
+   "link_count": 0,
    "link_to": "Employee Referral",
    "link_type": "DocType",
    "onboard": 0,
@@ -552,6 +611,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Job Applicant",
+   "link_count": 0,
    "link_to": "Job Applicant",
    "link_type": "DocType",
    "onboard": 1,
@@ -562,6 +622,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Job Offer",
+   "link_count": 0,
    "link_to": "Job Offer",
    "link_type": "DocType",
    "onboard": 1,
@@ -572,6 +633,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Staffing Plan",
+   "link_count": 0,
    "link_to": "Staffing Plan",
    "link_type": "DocType",
    "onboard": 0,
@@ -581,6 +643,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Appointment Letter",
+   "link_count": 0,
    "link_to": "Appointment Letter",
    "link_type": "DocType",
    "onboard": 0,
@@ -590,6 +653,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Appointment Letter Template",
+   "link_count": 0,
    "link_to": "Appointment Letter Template",
    "link_type": "DocType",
    "onboard": 0,
@@ -599,6 +663,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Loans",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -607,6 +672,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Loan Application",
+   "link_count": 0,
    "link_to": "Loan Application",
    "link_type": "DocType",
    "onboard": 0,
@@ -617,6 +683,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Loan",
+   "link_count": 0,
    "link_to": "Loan",
    "link_type": "DocType",
    "onboard": 0,
@@ -627,6 +694,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Loan Type",
+   "link_count": 0,
    "link_to": "Loan Type",
    "link_type": "DocType",
    "onboard": 0,
@@ -636,6 +704,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Training",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -644,6 +713,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Training Program",
+   "link_count": 0,
    "link_to": "Training Program",
    "link_type": "DocType",
    "onboard": 0,
@@ -654,6 +724,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Training Event",
+   "link_count": 0,
    "link_to": "Training Event",
    "link_type": "DocType",
    "onboard": 0,
@@ -664,6 +735,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Training Result",
+   "link_count": 0,
    "link_to": "Training Result",
    "link_type": "DocType",
    "onboard": 0,
@@ -674,6 +746,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Training Feedback",
+   "link_count": 0,
    "link_to": "Training Feedback",
    "link_type": "DocType",
    "onboard": 0,
@@ -683,6 +756,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Performance",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -691,6 +765,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Appraisal",
+   "link_count": 0,
    "link_to": "Appraisal",
    "link_type": "DocType",
    "onboard": 0,
@@ -701,6 +776,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Appraisal Template",
+   "link_count": 0,
    "link_to": "Appraisal Template",
    "link_type": "DocType",
    "onboard": 0,
@@ -711,6 +787,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Energy Point Rule",
+   "link_count": 0,
    "link_to": "Energy Point Rule",
    "link_type": "DocType",
    "onboard": 0,
@@ -721,6 +798,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Energy Point Log",
+   "link_count": 0,
    "link_to": "Energy Point Log",
    "link_type": "DocType",
    "onboard": 0,
@@ -730,6 +808,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Key Reports",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -738,6 +817,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Monthly Attendance Sheet",
+   "link_count": 0,
    "link_to": "Monthly Attendance Sheet",
    "link_type": "Report",
    "onboard": 0,
@@ -748,6 +828,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Recruitment Analytics",
+   "link_count": 0,
    "link_to": "Recruitment Analytics",
    "link_type": "Report",
    "onboard": 0,
@@ -758,6 +839,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Employee Analytics",
+   "link_count": 0,
    "link_to": "Employee Analytics",
    "link_type": "Report",
    "onboard": 0,
@@ -768,6 +850,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Employee Leave Balance",
+   "link_count": 0,
    "link_to": "Employee Leave Balance",
    "link_type": "Report",
    "onboard": 0,
@@ -778,6 +861,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Employee Leave Balance Summary",
+   "link_count": 0,
    "link_to": "Employee Leave Balance Summary",
    "link_type": "Report",
    "onboard": 0,
@@ -788,6 +872,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Employee Advance Summary",
+   "link_count": 0,
    "link_to": "Employee Advance Summary",
    "link_type": "Report",
    "onboard": 0,
@@ -797,6 +882,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Other Reports",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -805,6 +891,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Employee Information",
+   "link_count": 0,
    "link_to": "Employee Information",
    "link_type": "Report",
    "onboard": 0,
@@ -815,6 +902,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Employee Birthday",
+   "link_count": 0,
    "link_to": "Employee Birthday",
    "link_type": "Report",
    "onboard": 0,
@@ -825,6 +913,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Employees Working on a Holiday",
+   "link_count": 0,
    "link_to": "Employees working on a holiday",
    "link_type": "Report",
    "onboard": 0,
@@ -835,20 +924,26 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Daily Work Summary Replies",
+   "link_count": 0,
    "link_to": "Daily Work Summary Replies",
    "link_type": "Report",
    "onboard": 0,
    "type": "Link"
   }
  ],
- "modified": "2021-05-13 17:19:40.524444",
+ "modified": "2021-08-05 12:15:59.842918",
  "modified_by": "Administrator",
  "module": "HR",
  "name": "HR",
  "onboarding": "Human Resource",
  "owner": "Administrator",
+ "parent_page": "",
  "pin_to_bottom": 0,
  "pin_to_top": 0,
+ "public": 1,
+ "restrict_to_domain": "",
+ "roles": [],
+ "sequence_id": 14,
  "shortcuts": [
   {
    "color": "Green",
@@ -889,5 +984,6 @@
    "stats_filter": "{\n    \"status\": \"Open\"\n}",
    "type": "Dashboard"
   }
- ]
+ ],
+ "title": "HR"
 }
\ No newline at end of file
diff --git a/erpnext/loan_management/workspace/loan_management/loan_management.json b/erpnext/loan_management/workspace/loan_management/loan_management.json
index d0b67f7..ca528ec 100644
--- a/erpnext/loan_management/workspace/loan_management/loan_management.json
+++ b/erpnext/loan_management/workspace/loan_management/loan_management.json
@@ -1,23 +1,27 @@
 {
- "category": "Modules",
+ "category": "",
  "charts": [],
+ "content": "[{\"type\": \"header\", \"data\": {\"text\": \"Your Shortcuts\", \"level\": 4, \"col\": 12}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Loan Application\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Loan\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Dashboard\", \"col\": 4}}, {\"type\": \"spacer\", \"data\": {\"col\": 12}}, {\"type\": \"header\", \"data\": {\"text\": \"Reports & Masters\", \"level\": 4, \"col\": 12}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Loan\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Loan Processes\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Disbursement and Repayment\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Loan Security\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Reports\", \"col\": 4}}]",
  "creation": "2020-03-12 16:35:55.299820",
  "developer_mode_only": 0,
  "disable_user_customization": 0,
  "docstatus": 0,
  "doctype": "Workspace",
+ "extends": "",
  "extends_another_page": 0,
+ "for_user": "",
  "hide_custom": 0,
  "icon": "loan",
  "idx": 0,
  "is_default": 0,
- "is_standard": 1,
+ "is_standard": 0,
  "label": "Loans",
  "links": [
   {
    "hidden": 0,
    "is_query_report": 0,
    "label": "Loan",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -26,6 +30,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Loan Type",
+   "link_count": 0,
    "link_to": "Loan Type",
    "link_type": "DocType",
    "onboard": 0,
@@ -36,6 +41,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Loan Application",
+   "link_count": 0,
    "link_to": "Loan Application",
    "link_type": "DocType",
    "onboard": 0,
@@ -46,6 +52,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Loan",
+   "link_count": 0,
    "link_to": "Loan",
    "link_type": "DocType",
    "onboard": 0,
@@ -55,6 +62,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Loan Processes",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -63,6 +71,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Process Loan Security Shortfall",
+   "link_count": 0,
    "link_to": "Process Loan Security Shortfall",
    "link_type": "DocType",
    "onboard": 0,
@@ -73,6 +82,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Process Loan Interest Accrual",
+   "link_count": 0,
    "link_to": "Process Loan Interest Accrual",
    "link_type": "DocType",
    "onboard": 0,
@@ -82,6 +92,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Disbursement and Repayment",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -90,6 +101,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Loan Disbursement",
+   "link_count": 0,
    "link_to": "Loan Disbursement",
    "link_type": "DocType",
    "onboard": 0,
@@ -100,6 +112,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Loan Repayment",
+   "link_count": 0,
    "link_to": "Loan Repayment",
    "link_type": "DocType",
    "onboard": 0,
@@ -110,6 +123,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Loan Write Off",
+   "link_count": 0,
    "link_to": "Loan Write Off",
    "link_type": "DocType",
    "onboard": 0,
@@ -120,6 +134,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Loan Interest Accrual",
+   "link_count": 0,
    "link_to": "Loan Interest Accrual",
    "link_type": "DocType",
    "onboard": 0,
@@ -129,6 +144,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Loan Security",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -137,6 +153,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Loan Security Type",
+   "link_count": 0,
    "link_to": "Loan Security Type",
    "link_type": "DocType",
    "onboard": 0,
@@ -147,6 +164,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Loan Security Price",
+   "link_count": 0,
    "link_to": "Loan Security Price",
    "link_type": "DocType",
    "onboard": 0,
@@ -157,6 +175,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Loan Security",
+   "link_count": 0,
    "link_to": "Loan Security",
    "link_type": "DocType",
    "onboard": 0,
@@ -167,6 +186,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Loan Security Pledge",
+   "link_count": 0,
    "link_to": "Loan Security Pledge",
    "link_type": "DocType",
    "onboard": 0,
@@ -177,6 +197,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Loan Security Unpledge",
+   "link_count": 0,
    "link_to": "Loan Security Unpledge",
    "link_type": "DocType",
    "onboard": 0,
@@ -187,6 +208,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Loan Security Shortfall",
+   "link_count": 0,
    "link_to": "Loan Security Shortfall",
    "link_type": "DocType",
    "onboard": 0,
@@ -196,6 +218,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Reports",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -204,6 +227,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Loan Repayment and Closure",
+   "link_count": 0,
    "link_to": "Loan Repayment and Closure",
    "link_type": "Report",
    "onboard": 0,
@@ -214,19 +238,26 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Loan Security Status",
+   "link_count": 0,
    "link_to": "Loan Security Status",
    "link_type": "Report",
    "onboard": 0,
    "type": "Link"
   }
  ],
- "modified": "2021-05-25 17:31:53.586508",
+ "modified": "2021-08-05 12:18:13.350904",
  "modified_by": "Administrator",
  "module": "Loan Management",
  "name": "Loans",
+ "onboarding": "",
  "owner": "Administrator",
+ "parent_page": "",
  "pin_to_bottom": 0,
  "pin_to_top": 0,
+ "public": 1,
+ "restrict_to_domain": "",
+ "roles": [],
+ "sequence_id": 16,
  "shortcuts": [
   {
    "color": "Green",
@@ -247,5 +278,6 @@
    "link_to": "Loan Dashboard",
    "type": "Dashboard"
   }
- ]
+ ],
+ "title": "Loans"
 }
\ No newline at end of file
diff --git a/erpnext/manufacturing/doctype/production_plan/production_plan.py b/erpnext/manufacturing/doctype/production_plan/production_plan.py
index 6a024f2..8c27d6c 100644
--- a/erpnext/manufacturing/doctype/production_plan/production_plan.py
+++ b/erpnext/manufacturing/doctype/production_plan/production_plan.py
@@ -109,6 +109,15 @@
 		so_mr_list = [d.get(field) for d in self.get(table) if d.get(field)]
 		return so_mr_list
 
+	def get_bom_item(self):
+		"""Check if Item or if its Template has a BOM."""
+		bom_item = None
+		has_bom = frappe.db.exists({'doctype': 'BOM', 'item': self.item_code, 'docstatus': 1})
+		if not has_bom:
+			template_item = frappe.db.get_value('Item', self.item_code, ['variant_of'])
+			bom_item = "bom.item = {0}".format(frappe.db.escape(template_item)) if template_item else bom_item
+		return bom_item
+
 	def get_so_items(self):
 		# Check for empty table or empty rows
 		if not self.get("sales_orders") or not self.get_so_mr_list("sales_order", "sales_orders"):
@@ -117,16 +126,26 @@
 		so_list = self.get_so_mr_list("sales_order", "sales_orders")
 
 		item_condition = ""
-		if self.item_code:
+		bom_item = "bom.item = so_item.item_code"
+		if self.item_code and frappe.db.exists('Item', self.item_code):
+			bom_item = self.get_bom_item() or bom_item
 			item_condition = ' and so_item.item_code = {0}'.format(frappe.db.escape(self.item_code))
 
-		items = frappe.db.sql("""select distinct parent, item_code, warehouse,
-			(qty - work_order_qty) * conversion_factor as pending_qty, description, name
-			from `tabSales Order Item` so_item
-			where parent in (%s) and docstatus = 1 and qty > work_order_qty
-			and exists (select name from `tabBOM` bom where bom.item=so_item.item_code
-					and bom.is_active = 1) %s""" % \
-			(", ".join(["%s"] * len(so_list)), item_condition), tuple(so_list), as_dict=1)
+		items = frappe.db.sql("""
+			select
+				distinct parent, item_code, warehouse,
+				(qty - work_order_qty) * conversion_factor as pending_qty,
+				description, name
+			from
+				`tabSales Order Item` so_item
+			where
+				parent in (%s) and docstatus = 1 and qty > work_order_qty
+				and exists (select name from `tabBOM` bom where %s
+				and bom.is_active = 1) %s""" %
+			(", ".join(["%s"] * len(so_list)),
+			bom_item,
+			item_condition),
+			tuple(so_list), as_dict=1)
 
 		if self.item_code:
 			item_condition = ' and so_item.item_code = {0}'.format(frappe.db.escape(self.item_code))
@@ -683,6 +702,7 @@
 
 def get_sales_orders(self):
 	so_filter = item_filter = ""
+	bom_item = "bom.item = so_item.item_code"
 	if self.from_date:
 		so_filter += " and so.transaction_date >= %(from_date)s"
 	if self.to_date:
@@ -694,7 +714,8 @@
 	if self.sales_order_status:
 		so_filter += "and so.status = %(sales_order_status)s"
 
-	if self.item_code:
+	if self.item_code and frappe.db.exists('Item', self.item_code):
+		bom_item = self.get_bom_item() or bom_item
 		item_filter += " and so_item.item_code = %(item)s"
 
 	open_so = frappe.db.sql("""
@@ -704,13 +725,13 @@
 			and so.docstatus = 1 and so.status not in ("Stopped", "Closed")
 			and so.company = %(company)s
 			and so_item.qty > so_item.work_order_qty {0} {1}
-			and (exists (select name from `tabBOM` bom where bom.item=so_item.item_code
+			and (exists (select name from `tabBOM` bom where {2}
 					and bom.is_active = 1)
 				or exists (select name from `tabPacked Item` pi
 					where pi.parent = so.name and pi.parent_item = so_item.item_code
 						and exists (select name from `tabBOM` bom where bom.item=pi.item_code
 							and bom.is_active = 1)))
-		""".format(so_filter, item_filter), {
+		""".format(so_filter, item_filter, bom_item), {
 			"from_date": self.from_date,
 			"to_date": self.to_date,
 			"customer": self.customer,
diff --git a/erpnext/manufacturing/doctype/production_plan/test_production_plan.py b/erpnext/manufacturing/doctype/production_plan/test_production_plan.py
index 93e6d7a..af8de8e 100644
--- a/erpnext/manufacturing/doctype/production_plan/test_production_plan.py
+++ b/erpnext/manufacturing/doctype/production_plan/test_production_plan.py
@@ -11,6 +11,7 @@
 from erpnext.stock.doctype.stock_reconciliation.test_stock_reconciliation import create_stock_reconciliation
 from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order
 from erpnext.manufacturing.doctype.production_plan.production_plan import get_items_for_material_requests, get_warehouse_list
+from erpnext.controllers.item_variant import create_variant
 
 class TestProductionPlan(unittest.TestCase):
 	def setUp(self):
@@ -271,6 +272,60 @@
 
 		self.assertEqual(warehouses, expected_warehouses)
 
+	def test_get_sales_order_with_variant(self):
+		if not frappe.db.exists('Item', {"item_code": 'PIV'}):
+			item = create_item('PIV', valuation_rate = 100)
+			variant_settings = {
+				"attributes": [
+					{
+						"attribute": "Colour"
+					},
+				],
+				"has_variants": 1
+			}
+			item.update(variant_settings)
+			item.save()
+			parent_bom = make_bom(item = 'PIV', raw_materials = ['PIV'])
+		if not frappe.db.exists('BOM', {"item": 'PIV'}):
+			parent_bom = make_bom(item = 'PIV', raw_materials = ['PIV'])
+		else:
+			parent_bom = frappe.get_doc('BOM', {"item": 'PIV'})
+
+		if not frappe.db.exists('Item', {"item_code": 'PIV-RED'}):
+			variant = create_variant("PIV", {"Colour": "Red"})
+			variant.save()
+			variant_bom = make_bom(item = variant.item_code, raw_materials = [variant.item_code])
+		else:
+			variant = frappe.get_doc('Item', 'PIV-RED')
+		if not frappe.db.exists('BOM', {"item": 'PIV-RED'}):
+			variant_bom = make_bom(item = variant.item_code, raw_materials = [variant.item_code])
+
+		"""Testing when item variant has a BOM"""
+		so = make_sales_order(item_code="PIV-RED", qty=5)
+		pln = frappe.new_doc('Production Plan')
+		pln.company = so.company
+		pln.get_items_from = 'Sales Order'
+		pln.item_code = 'PIV-RED'
+		pln.get_open_sales_orders()
+		self.assertEqual(pln.sales_orders[0].sales_order, so.name)
+		pln.get_so_items()
+		self.assertEqual(pln.po_items[0].item_code, 'PIV-RED')
+		self.assertEqual(pln.po_items[0].bom_no, variant_bom.name)
+		so.cancel()
+		frappe.delete_doc('Sales Order', so.name)
+		variant_bom.cancel()
+		frappe.delete_doc('BOM', variant_bom.name)
+
+		"""Testing when item variant doesn't have a BOM"""
+		so = make_sales_order(item_code="PIV-RED", qty=5)
+		pln.get_open_sales_orders()
+		self.assertEqual(pln.sales_orders[0].sales_order, so.name)
+		pln.po_items = []
+		pln.get_so_items()
+		self.assertEqual(pln.po_items[0].item_code, 'PIV-RED')
+		self.assertEqual(pln.po_items[0].bom_no, parent_bom.name)
+
+		frappe.db.rollback()
 
 def create_production_plan(**args):
 	args = frappe._dict(args)
diff --git a/erpnext/manufacturing/workspace/manufacturing/manufacturing.json b/erpnext/manufacturing/workspace/manufacturing/manufacturing.json
index a355203..84eabcd 100644
--- a/erpnext/manufacturing/workspace/manufacturing/manufacturing.json
+++ b/erpnext/manufacturing/workspace/manufacturing/manufacturing.json
@@ -1,26 +1,31 @@
 {
- "category": "Domains",
+ "category": "",
  "charts": [
   {
    "chart_name": "Produced Quantity"
   }
  ],
+ "content": "[{\"type\": \"onboarding\", \"data\": {\"onboarding_name\":\"Manufacturing\", \"col\": 12}}, {\"type\": \"chart\", \"data\": {\"chart_name\": null, \"col\": 12}}, {\"type\": \"spacer\", \"data\": {\"col\": 12}}, {\"type\": \"header\", \"data\": {\"text\": \"Your Shortcuts\", \"level\": 4, \"col\": 12}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Item\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"BOM\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Work Order\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Production Plan\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Forecasting\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Work Order Summary\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"BOM Stock Report\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Production Planning Report\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Dashboard\", \"col\": 4}}, {\"type\": \"spacer\", \"data\": {\"col\": 12}}, {\"type\": \"header\", \"data\": {\"text\": \"Reports & Masters\", \"level\": 4, \"col\": 12}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Production\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Bill of Materials\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Reports\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Tools\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Settings\", \"col\": 4}}]",
  "creation": "2020-03-02 17:11:37.032604",
  "developer_mode_only": 0,
  "disable_user_customization": 0,
  "docstatus": 0,
  "doctype": "Workspace",
+ "extends": "",
  "extends_another_page": 0,
+ "for_user": "",
  "hide_custom": 0,
  "icon": "organization",
  "idx": 0,
- "is_standard": 1,
+ "is_default": 0,
+ "is_standard": 0,
  "label": "Manufacturing",
  "links": [
   {
    "hidden": 0,
    "is_query_report": 0,
    "label": "Production",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -29,6 +34,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Work Order",
+   "link_count": 0,
    "link_to": "Work Order",
    "link_type": "DocType",
    "onboard": 1,
@@ -39,6 +45,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Production Plan",
+   "link_count": 0,
    "link_to": "Production Plan",
    "link_type": "DocType",
    "onboard": 1,
@@ -49,6 +56,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Stock Entry",
+   "link_count": 0,
    "link_to": "Stock Entry",
    "link_type": "DocType",
    "onboard": 1,
@@ -59,6 +67,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Job Card",
+   "link_count": 0,
    "link_to": "Job Card",
    "link_type": "DocType",
    "onboard": 0,
@@ -69,6 +78,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Downtime Entry",
+   "link_count": 0,
    "link_to": "Downtime Entry",
    "link_type": "DocType",
    "onboard": 0,
@@ -78,6 +88,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Bill of Materials",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -86,6 +97,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Item",
+   "link_count": 0,
    "link_to": "Item",
    "link_type": "DocType",
    "onboard": 1,
@@ -96,6 +108,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Bill of Materials",
+   "link_count": 0,
    "link_to": "BOM",
    "link_type": "DocType",
    "onboard": 1,
@@ -106,6 +119,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Workstation",
+   "link_count": 0,
    "link_to": "Workstation",
    "link_type": "DocType",
    "onboard": 0,
@@ -116,6 +130,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Operation",
+   "link_count": 0,
    "link_to": "Operation",
    "link_type": "DocType",
    "onboard": 0,
@@ -126,6 +141,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Routing",
+   "link_count": 0,
    "link_to": "Routing",
    "link_type": "DocType",
    "onboard": 0,
@@ -135,6 +151,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Reports",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -143,6 +160,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Production Planning Report",
+   "link_count": 0,
    "link_to": "Production Planning Report",
    "link_type": "Report",
    "onboard": 0,
@@ -153,6 +171,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Work Order Summary",
+   "link_count": 0,
    "link_to": "Work Order Summary",
    "link_type": "Report",
    "onboard": 0,
@@ -163,6 +182,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Quality Inspection Summary",
+   "link_count": 0,
    "link_to": "Quality Inspection Summary",
    "link_type": "Report",
    "onboard": 0,
@@ -173,6 +193,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Downtime Analysis",
+   "link_count": 0,
    "link_to": "Downtime Analysis",
    "link_type": "Report",
    "onboard": 0,
@@ -183,6 +204,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Job Card Summary",
+   "link_count": 0,
    "link_to": "Job Card Summary",
    "link_type": "Report",
    "onboard": 0,
@@ -193,6 +215,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "BOM Search",
+   "link_count": 0,
    "link_to": "BOM Search",
    "link_type": "Report",
    "onboard": 0,
@@ -203,6 +226,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "BOM Stock Report",
+   "link_count": 0,
    "link_to": "BOM Stock Report",
    "link_type": "Report",
    "onboard": 0,
@@ -213,6 +237,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Production Analytics",
+   "link_count": 0,
    "link_to": "Production Analytics",
    "link_type": "Report",
    "onboard": 0,
@@ -223,6 +248,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "BOM Operations Time",
+   "link_count": 0,
    "link_to": "BOM Operations Time",
    "link_type": "Report",
    "onboard": 0,
@@ -232,6 +258,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Tools",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -240,6 +267,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "BOM Update Tool",
+   "link_count": 0,
    "link_to": "BOM Update Tool",
    "link_type": "DocType",
    "onboard": 0,
@@ -250,6 +278,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "BOM Comparison Tool",
+   "link_count": 0,
    "link_to": "bom-comparison-tool",
    "link_type": "Page",
    "onboard": 0,
@@ -259,6 +288,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Settings",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -267,21 +297,26 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Manufacturing Settings",
+   "link_count": 0,
    "link_to": "Manufacturing Settings",
    "link_type": "DocType",
    "onboard": 0,
    "type": "Link"
   }
  ],
- "modified": "2020-12-01 13:38:39.365928",
+ "modified": "2021-08-05 12:16:00.825741",
  "modified_by": "Administrator",
  "module": "Manufacturing",
  "name": "Manufacturing",
  "onboarding": "Manufacturing",
  "owner": "Administrator",
+ "parent_page": "",
  "pin_to_bottom": 0,
  "pin_to_top": 0,
+ "public": 1,
  "restrict_to_domain": "Manufacturing",
+ "roles": [],
+ "sequence_id": 17,
  "shortcuts": [
   {
    "color": "Green",
@@ -346,5 +381,6 @@
    "restrict_to_domain": "Manufacturing",
    "type": "Dashboard"
   }
- ]
+ ],
+ "title": "Manufacturing"
 }
\ No newline at end of file
diff --git a/erpnext/non_profit/workspace/non_profit/non_profit.json b/erpnext/non_profit/workspace/non_profit/non_profit.json
index 2557d77..e6d4445 100644
--- a/erpnext/non_profit/workspace/non_profit/non_profit.json
+++ b/erpnext/non_profit/workspace/non_profit/non_profit.json
@@ -1,23 +1,27 @@
 {
- "category": "Domains",
+ "category": "",
  "charts": [],
+ "content": "[{\"type\": \"header\", \"data\": {\"text\": \"Your Shortcuts\", \"level\": 4, \"col\": 12}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Member\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Non Profit Settings\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Membership\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Chapter\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Chapter Member\", \"col\": 4}}, {\"type\": \"spacer\", \"data\": {\"col\": 12}}, {\"type\": \"header\", \"data\": {\"text\": \"Reports & Masters\", \"level\": 4, \"col\": 12}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Loan Management\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Grant Application\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Membership\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Volunteer\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Chapter\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Donation\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Tax Exemption Certification (India)\", \"col\": 4}}]",
  "creation": "2020-03-02 17:23:47.811421",
  "developer_mode_only": 0,
  "disable_user_customization": 0,
  "docstatus": 0,
  "doctype": "Workspace",
+ "extends": "",
  "extends_another_page": 0,
+ "for_user": "",
  "hide_custom": 0,
  "icon": "non-profit",
  "idx": 0,
  "is_default": 0,
- "is_standard": 1,
+ "is_standard": 0,
  "label": "Non Profit",
  "links": [
   {
    "hidden": 0,
    "is_query_report": 0,
    "label": "Loan Management",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -26,6 +30,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Loan Type",
+   "link_count": 0,
    "link_to": "Loan Type",
    "link_type": "DocType",
    "onboard": 0,
@@ -36,6 +41,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Loan Application",
+   "link_count": 0,
    "link_to": "Loan Application",
    "link_type": "DocType",
    "onboard": 0,
@@ -46,6 +52,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Loan",
+   "link_count": 0,
    "link_to": "Loan",
    "link_type": "DocType",
    "onboard": 0,
@@ -55,6 +62,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Grant Application",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -63,6 +71,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Grant Application",
+   "link_count": 0,
    "link_to": "Grant Application",
    "link_type": "DocType",
    "onboard": 0,
@@ -72,6 +81,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Membership",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -80,6 +90,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Member",
+   "link_count": 0,
    "link_to": "Member",
    "link_type": "DocType",
    "onboard": 1,
@@ -90,6 +101,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Membership",
+   "link_count": 0,
    "link_to": "Membership",
    "link_type": "DocType",
    "onboard": 1,
@@ -100,6 +112,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Membership Type",
+   "link_count": 0,
    "link_to": "Membership Type",
    "link_type": "DocType",
    "onboard": 0,
@@ -110,6 +123,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Membership Settings",
+   "link_count": 0,
    "link_to": "Non Profit Settings",
    "link_type": "DocType",
    "onboard": 0,
@@ -119,6 +133,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Volunteer",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -127,6 +142,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Volunteer",
+   "link_count": 0,
    "link_to": "Volunteer",
    "link_type": "DocType",
    "onboard": 1,
@@ -137,6 +153,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Volunteer Type",
+   "link_count": 0,
    "link_to": "Volunteer Type",
    "link_type": "DocType",
    "onboard": 0,
@@ -146,6 +163,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Chapter",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -154,6 +172,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Chapter",
+   "link_count": 0,
    "link_to": "Chapter",
    "link_type": "DocType",
    "onboard": 1,
@@ -163,6 +182,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Donation",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -171,6 +191,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Donor",
+   "link_count": 0,
    "link_to": "Donor",
    "link_type": "DocType",
    "onboard": 0,
@@ -181,6 +202,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Donor Type",
+   "link_count": 0,
    "link_to": "Donor Type",
    "link_type": "DocType",
    "onboard": 0,
@@ -190,6 +212,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Donation",
+   "link_count": 0,
    "link_to": "Donation",
    "link_type": "DocType",
    "onboard": 0,
@@ -199,6 +222,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Tax Exemption Certification (India)",
+   "link_count": 0,
    "link_type": "DocType",
    "onboard": 0,
    "type": "Card Break"
@@ -207,20 +231,26 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Tax Exemption 80G Certificate",
+   "link_count": 0,
    "link_to": "Tax Exemption 80G Certificate",
    "link_type": "DocType",
    "onboard": 0,
    "type": "Link"
   }
  ],
- "modified": "2021-03-11 11:38:09.140655",
+ "modified": "2021-08-05 12:16:01.146206",
  "modified_by": "Administrator",
  "module": "Non Profit",
  "name": "Non Profit",
+ "onboarding": "",
  "owner": "Administrator",
+ "parent_page": "",
  "pin_to_bottom": 0,
  "pin_to_top": 0,
+ "public": 1,
  "restrict_to_domain": "Non Profit",
+ "roles": [],
+ "sequence_id": 18,
  "shortcuts": [
   {
    "label": "Member",
@@ -247,5 +277,6 @@
    "link_to": "Chapter Member",
    "type": "DocType"
   }
- ]
+ ],
+ "title": "Non Profit"
 }
\ No newline at end of file
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index 86356e3..776b41d 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -296,7 +296,8 @@
 erpnext.patches.v13_0.update_amt_in_work_order_required_items
 erpnext.patches.v12_0.show_einvoice_irn_cancelled_field
 erpnext.patches.v13_0.delete_orphaned_tables
-erpnext.patches.v13_0.update_export_type_for_gst
+erpnext.patches.v13_0.update_export_type_for_gst #2021-08-16
 erpnext.patches.v13_0.update_tds_check_field #3
 erpnext.patches.v13_0.add_custom_field_for_south_africa #2
+erpnext.patches.v13_0.update_recipient_email_digest
 erpnext.patches.v13_0.shopify_deprecation_warning
diff --git a/erpnext/patches/v13_0/shopify_deprecation_warning.py b/erpnext/patches/v13_0/shopify_deprecation_warning.py
index 245d1a9..6f199c8 100644
--- a/erpnext/patches/v13_0/shopify_deprecation_warning.py
+++ b/erpnext/patches/v13_0/shopify_deprecation_warning.py
@@ -1,4 +1,5 @@
 import click
+import frappe
 
 
 def execute():
diff --git a/erpnext/patches/v13_0/update_export_type_for_gst.py b/erpnext/patches/v13_0/update_export_type_for_gst.py
index 478a2a6..3e20212 100644
--- a/erpnext/patches/v13_0/update_export_type_for_gst.py
+++ b/erpnext/patches/v13_0/update_export_type_for_gst.py
@@ -8,11 +8,19 @@
 	# Update custom fields
 	fieldname = frappe.db.get_value('Custom Field', {'dt': 'Customer', 'fieldname': 'export_type'})
 	if fieldname:
-		frappe.db.set_value('Custom Field', fieldname, 'default', '')
+		frappe.db.set_value('Custom Field', fieldname, 
+			{
+				'default': '',
+				'mandatory_depends_on': 'eval:in_list(["SEZ", "Overseas", "Deemed Export"], doc.gst_category)'
+			})
 
 	fieldname = frappe.db.get_value('Custom Field', {'dt': 'Supplier', 'fieldname': 'export_type'})
 	if fieldname:
-		frappe.db.set_value('Custom Field', fieldname, 'default', '')
+		frappe.db.set_value('Custom Field', fieldname, 
+			{
+				'default': '',
+				'mandatory_depends_on': 'eval:in_list(["SEZ", "Overseas"], doc.gst_category)'
+			})
 
 	# Update Customer/Supplier Masters
 	frappe.db.sql("""
diff --git a/erpnext/patches/v13_0/update_recipient_email_digest.py b/erpnext/patches/v13_0/update_recipient_email_digest.py
new file mode 100644
index 0000000..d9aa03f
--- /dev/null
+++ b/erpnext/patches/v13_0/update_recipient_email_digest.py
@@ -0,0 +1,21 @@
+# Copyright (c) 2020, Frappe and Contributors
+# License: GNU General Public License v3. See license.txt
+
+from __future__ import unicode_literals
+import frappe
+
+def execute():
+    frappe.reload_doc("setup", "doctype", "Email Digest")
+    frappe.reload_doc("setup", "doctype", "Email Digest Recipient")
+    email_digests = frappe.db.get_list('Email Digest', fields=['name', 'recipient_list'])
+    for email_digest in email_digests:
+        if email_digest.recipient_list:
+            for recipient in email_digest.recipient_list.split("\n"):
+                doc = frappe.get_doc({
+                    'doctype': 'Email Digest Recipient',
+                    'parenttype': 'Email Digest',
+                    'parentfield': 'recipients',
+                    'parent': email_digest.name,
+                    'recipient': recipient
+                })
+                doc.insert()
diff --git a/erpnext/patches/v13_0/update_returned_qty_in_pr_dn.py b/erpnext/patches/v13_0/update_returned_qty_in_pr_dn.py
index 7f42cd9..409f4da 100644
--- a/erpnext/patches/v13_0/update_returned_qty_in_pr_dn.py
+++ b/erpnext/patches/v13_0/update_returned_qty_in_pr_dn.py
@@ -1,8 +1,7 @@
-# Copyright (c) 2019, Frappe and Contributors
+# Copyright (c) 2021, Frappe and Contributors
 # License: GNU General Public License v3. See license.txt
-
-from __future__ import unicode_literals
 import frappe
+from erpnext.controllers.status_updater import OverAllowanceError
 
 def execute():
 	frappe.reload_doc('stock', 'doctype', 'purchase_receipt')
@@ -14,9 +13,15 @@
 		for return_doc in frappe.get_all(doctype, filters={'is_return' : 1, 'docstatus' : 1}):
 			# Update original receipt/delivery document from return
 			return_doc = frappe.get_cached_doc(doctype, return_doc.name)
-			return_doc.update_prevdoc_status()
+			try:
+				return_doc.update_prevdoc_status()
+			except OverAllowanceError:
+				frappe.db.rollback()
+				continue
+
 			return_against = frappe.get_doc(doctype, return_doc.return_against)
 			return_against.update_billing_status()
+			frappe.db.commit()
 
 	# Set received qty in stock uom in PR, as returned qty is checked against it
 	frappe.db.sql(""" update `tabPurchase Receipt Item`
diff --git a/erpnext/payroll/doctype/additional_salary/additional_salary.py b/erpnext/payroll/doctype/additional_salary/additional_salary.py
index b978cbe..381f399 100644
--- a/erpnext/payroll/doctype/additional_salary/additional_salary.py
+++ b/erpnext/payroll/doctype/additional_salary/additional_salary.py
@@ -112,11 +112,11 @@
 		no_of_days = date_diff(getdate(end_date), getdate(start_date)) + 1
 		return amount_per_day * no_of_days
 
-@frappe.whitelist()
 def get_additional_salaries(employee, start_date, end_date, component_type):
 	additional_salary_list = frappe.db.sql("""
-		select name, salary_component as component, type, amount, overwrite_salary_structure_amount as overwrite,
-		deduct_full_tax_on_selected_payroll_date, is_recurring
+		select name, salary_component as component, type, amount,
+		overwrite_salary_structure_amount as overwrite,
+		deduct_full_tax_on_selected_payroll_date
 		from `tabAdditional Salary`
 		where employee=%(employee)s
 			and docstatus = 1
diff --git a/erpnext/payroll/doctype/salary_detail/salary_detail.json b/erpnext/payroll/doctype/salary_detail/salary_detail.json
index 97608d7..393f647 100644
--- a/erpnext/payroll/doctype/salary_detail/salary_detail.json
+++ b/erpnext/payroll/doctype/salary_detail/salary_detail.json
@@ -12,7 +12,6 @@
   "year_to_date",
   "section_break_5",
   "additional_salary",
-  "is_recurring_additional_salary",
   "statistical_component",
   "depends_on_payment_days",
   "exempted_from_income_tax",
@@ -236,19 +235,11 @@
    "label": "Year To Date",
    "options": "currency",
    "read_only": 1
-  },
-  {
-   "default": "0",
-   "depends_on": "eval:doc.parenttype=='Salary Slip' && doc.parentfield=='earnings' && doc.additional_salary",
-   "fieldname": "is_recurring_additional_salary",
-   "fieldtype": "Check",
-   "label": "Is Recurring Additional Salary",
-   "read_only": 1
   }
  ],
  "istable": 1,
  "links": [],
- "modified": "2021-03-14 13:39:15.847158",
+ "modified": "2021-01-14 13:39:15.847158",
  "modified_by": "Administrator",
  "module": "Payroll",
  "name": "Salary Detail",
diff --git a/erpnext/payroll/doctype/salary_slip/salary_slip.py b/erpnext/payroll/doctype/salary_slip/salary_slip.py
index f0ca64f..5f5fdd5 100644
--- a/erpnext/payroll/doctype/salary_slip/salary_slip.py
+++ b/erpnext/payroll/doctype/salary_slip/salary_slip.py
@@ -7,12 +7,12 @@
 
 from frappe.utils import add_days, cint, cstr, flt, getdate, rounded, date_diff, money_in_words, formatdate, get_first_day
 from frappe.model.naming import make_autoname
-from frappe.utils.background_jobs import enqueue
 
 from frappe import msgprint, _
 from erpnext.payroll.doctype.payroll_entry.payroll_entry import get_start_end_dates
 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.payroll.doctype.additional_salary.additional_salary import get_additional_salaries
 from erpnext.payroll.doctype.payroll_period.payroll_period import get_period_factor, get_payroll_period
 from erpnext.payroll.doctype.employee_benefit_application.employee_benefit_application import get_benefit_component_amount
@@ -618,8 +618,7 @@
 				get_salary_component_data(additional_salary.component),
 				additional_salary.amount,
 				component_type,
-				additional_salary,
-				is_recurring = additional_salary.is_recurring
+				additional_salary
 			)
 
 	def add_tax_components(self, payroll_period):
@@ -640,7 +639,7 @@
 			tax_row = get_salary_component_data(d)
 			self.update_component_row(tax_row, tax_amount, "deductions")
 
-	def update_component_row(self, component_data, amount, component_type, additional_salary=None, is_recurring = 0):
+	def update_component_row(self, component_data, amount, component_type, additional_salary=None):
 		component_row = None
 		for d in self.get(component_type):
 			if d.salary_component != component_data.salary_component:
@@ -681,7 +680,6 @@
 				component_row.set(attr, component_data.get(attr))
 
 		if additional_salary:
-			component_row.is_recurring_additional_salary = is_recurring
 			if additional_salary.overwrite:
 				component_row.additional_amount = flt(flt(amount) - flt(component_row.get("default_amount", 0)),
 					component_row.precision("additional_amount"))
@@ -719,7 +717,6 @@
 		# get remaining numbers of sub-period (period for which one salary is processed)
 		remaining_sub_periods = get_period_factor(self.employee,
 			self.start_date, self.end_date, self.payroll_frequency, payroll_period)[1]
-
 		# get taxable_earnings, paid_taxes for previous period
 		previous_taxable_earnings = self.get_taxable_earnings_for_prev_period(payroll_period.start_date,
 			self.start_date, tax_slab.allow_tax_exemption)
@@ -879,16 +876,8 @@
 
 			if earning.is_tax_applicable:
 				if additional_amount:
-					if not earning.is_recurring_additional_salary:
-						taxable_earnings += (amount - additional_amount)
-						additional_income += additional_amount
-					else:
-						to_date = frappe.db.get_value("Additional Salary", earning.additional_salary, 'to_date')
-						period = (getdate(to_date).month - getdate(self.start_date).month) + 1
-						if period > 0:
-							taxable_earnings += (amount - additional_amount) * period
-							additional_income += additional_amount * period
-
+					taxable_earnings += (amount - additional_amount)
+					additional_income += additional_amount
 					if earning.deduct_full_tax_on_selected_payroll_date:
 						additional_income_with_full_tax += additional_amount
 					continue
diff --git a/erpnext/payroll/print_format/salary_slip_based_on_timesheet/salary_slip_based_on_timesheet.json b/erpnext/payroll/print_format/salary_slip_based_on_timesheet/salary_slip_based_on_timesheet.json
index ceaf4a6..d5fee6b 100644
--- a/erpnext/payroll/print_format/salary_slip_based_on_timesheet/salary_slip_based_on_timesheet.json
+++ b/erpnext/payroll/print_format/salary_slip_based_on_timesheet/salary_slip_based_on_timesheet.json
@@ -13,6 +13,6 @@
  "name": "Salary Slip based on Timesheet",
  "owner": "Administrator",
  "print_format_builder": 1,
- "print_format_type": "Server",
+ "print_format_type": "Jinja",
  "standard": "Yes"
 }
\ No newline at end of file
diff --git a/erpnext/payroll/print_format/salary_slip_standard/salary_slip_standard.json b/erpnext/payroll/print_format/salary_slip_standard/salary_slip_standard.json
index b01239f..98a4435 100644
--- a/erpnext/payroll/print_format/salary_slip_standard/salary_slip_standard.json
+++ b/erpnext/payroll/print_format/salary_slip_standard/salary_slip_standard.json
@@ -16,7 +16,7 @@
  "name": "Salary Slip Standard",
  "owner": "Administrator",
  "print_format_builder": 1,
- "print_format_type": "Server",
+ "print_format_type": "Jinja",
  "show_section_headings": 0,
  "standard": "Yes"
 }
\ No newline at end of file
diff --git a/erpnext/payroll/workspace/payroll/payroll.json b/erpnext/payroll/workspace/payroll/payroll.json
index 8149730..b55bdc7 100644
--- a/erpnext/payroll/workspace/payroll/payroll.json
+++ b/erpnext/payroll/workspace/payroll/payroll.json
@@ -1,27 +1,32 @@
 {
- "category": "Modules",
+ "category": "",
  "charts": [
   {
    "chart_name": "Outgoing Salary",
    "label": "Outgoing Salary"
   }
  ],
+ "content": "[{\"type\": \"onboarding\", \"data\": {\"onboarding_name\":\"Payroll\", \"col\": 12}}, {\"type\": \"chart\", \"data\": {\"chart_name\": \"Outgoing Salary\", \"col\": 12}}, {\"type\": \"spacer\", \"data\": {\"col\": 12}}, {\"type\": \"header\", \"data\": {\"text\": \"Your Shortcuts\", \"level\": 4, \"col\": 12}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Salary Structure\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Payroll Entry\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Salary Slip\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Income Tax Slab\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Salary Register\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Dashboard\", \"col\": 4}}, {\"type\": \"spacer\", \"data\": {\"col\": 12}}, {\"type\": \"header\", \"data\": {\"text\": \"Reports & Masters\", \"level\": 4, \"col\": 12}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Payroll\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Taxation\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Compensations\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Reports\", \"col\": 4}}]",
  "creation": "2020-05-27 19:54:23.405607",
  "developer_mode_only": 0,
  "disable_user_customization": 0,
  "docstatus": 0,
  "doctype": "Workspace",
+ "extends": "",
  "extends_another_page": 0,
+ "for_user": "",
  "hide_custom": 0,
  "icon": "money-coins-1",
  "idx": 0,
- "is_standard": 1,
+ "is_default": 0,
+ "is_standard": 0,
  "label": "Payroll",
  "links": [
   {
    "hidden": 0,
    "is_query_report": 0,
    "label": "Payroll",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -30,6 +35,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Salary Component",
+   "link_count": 0,
    "link_to": "Salary Component",
    "link_type": "DocType",
    "onboard": 1,
@@ -40,6 +46,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Salary Structure",
+   "link_count": 0,
    "link_to": "Salary Structure",
    "link_type": "DocType",
    "onboard": 1,
@@ -50,6 +57,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Salary Structure Assignment",
+   "link_count": 0,
    "link_to": "Salary Structure Assignment",
    "link_type": "DocType",
    "onboard": 1,
@@ -60,6 +68,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Payroll Entry",
+   "link_count": 0,
    "link_to": "Payroll Entry",
    "link_type": "DocType",
    "onboard": 1,
@@ -70,6 +79,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Salary Slip",
+   "link_count": 0,
    "link_to": "Salary Slip",
    "link_type": "DocType",
    "onboard": 1,
@@ -79,6 +89,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Taxation",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -87,6 +98,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Payroll Period",
+   "link_count": 0,
    "link_to": "Payroll Period",
    "link_type": "DocType",
    "onboard": 1,
@@ -97,6 +109,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Income Tax Slab",
+   "link_count": 0,
    "link_to": "Income Tax Slab",
    "link_type": "DocType",
    "onboard": 1,
@@ -107,6 +120,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Employee Other Income",
+   "link_count": 0,
    "link_to": "Employee Other Income",
    "link_type": "DocType",
    "onboard": 1,
@@ -117,6 +131,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Employee Tax Exemption Declaration",
+   "link_count": 0,
    "link_to": "Employee Tax Exemption Declaration",
    "link_type": "DocType",
    "onboard": 1,
@@ -127,6 +142,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Employee Tax Exemption Proof Submission",
+   "link_count": 0,
    "link_to": "Employee Tax Exemption Proof Submission",
    "link_type": "DocType",
    "onboard": 1,
@@ -137,6 +153,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Employee Tax Exemption Category",
+   "link_count": 0,
    "link_to": "Employee Tax Exemption Category",
    "link_type": "DocType",
    "onboard": 0,
@@ -147,6 +164,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Employee Tax Exemption Sub Category",
+   "link_count": 0,
    "link_to": "Employee Tax Exemption Sub Category",
    "link_type": "DocType",
    "onboard": 0,
@@ -156,6 +174,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Compensations",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -164,6 +183,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Additional Salary",
+   "link_count": 0,
    "link_to": "Additional Salary",
    "link_type": "DocType",
    "onboard": 1,
@@ -174,6 +194,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Retention Bonus",
+   "link_count": 0,
    "link_to": "Retention Bonus",
    "link_type": "DocType",
    "onboard": 1,
@@ -184,6 +205,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Employee Incentive",
+   "link_count": 0,
    "link_to": "Employee Incentive",
    "link_type": "DocType",
    "onboard": 1,
@@ -194,6 +216,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Employee Benefit Application",
+   "link_count": 0,
    "link_to": "Employee Benefit Application",
    "link_type": "DocType",
    "onboard": 0,
@@ -204,6 +227,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Employee Benefit Claim",
+   "link_count": 0,
    "link_to": "Employee Benefit Claim",
    "link_type": "DocType",
    "onboard": 0,
@@ -213,6 +237,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Reports",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -221,6 +246,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Salary Register",
+   "link_count": 0,
    "link_to": "Salary Register",
    "link_type": "Report",
    "onboard": 0,
@@ -231,6 +257,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Salary Payments Based On Payment Mode",
+   "link_count": 0,
    "link_to": "Salary Payments Based On Payment Mode",
    "link_type": "Report",
    "onboard": 0,
@@ -241,6 +268,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Salary Payments via ECS",
+   "link_count": 0,
    "link_to": "Salary Payments via ECS",
    "link_type": "Report",
    "onboard": 0,
@@ -251,6 +279,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Income Tax Deductions",
+   "link_count": 0,
    "link_to": "Income Tax Deductions",
    "link_type": "Report",
    "onboard": 0,
@@ -261,6 +290,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Professional Tax Deductions",
+   "link_count": 0,
    "link_to": "Professional Tax Deductions",
    "link_type": "Report",
    "onboard": 0,
@@ -271,6 +301,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Provident Fund Deductions",
+   "link_count": 0,
    "link_to": "Provident Fund Deductions",
    "link_type": "Report",
    "onboard": 0,
@@ -281,20 +312,26 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Bank Remittance",
+   "link_count": 0,
    "link_to": "Bank Remittance",
    "link_type": "Report",
    "onboard": 0,
    "type": "Link"
   }
  ],
- "modified": "2020-12-01 13:38:37.205628",
+ "modified": "2021-08-05 12:16:01.335324",
  "modified_by": "Administrator",
  "module": "Payroll",
  "name": "Payroll",
  "onboarding": "Payroll",
  "owner": "Administrator",
+ "parent_page": "",
  "pin_to_bottom": 0,
  "pin_to_top": 0,
+ "public": 1,
+ "restrict_to_domain": "",
+ "roles": [],
+ "sequence_id": 19,
  "shortcuts": [
   {
    "label": "Salary Structure",
@@ -329,5 +366,6 @@
    "link_to": "Payroll",
    "type": "Dashboard"
   }
- ]
+ ],
+ "title": "Payroll"
 }
\ No newline at end of file
diff --git a/erpnext/projects/doctype/timesheet/timesheet.json b/erpnext/projects/doctype/timesheet/timesheet.json
index 75f7478..be6771e 100644
--- a/erpnext/projects/doctype/timesheet/timesheet.json
+++ b/erpnext/projects/doctype/timesheet/timesheet.json
@@ -310,6 +310,7 @@
    "read_only": 1
   },
   {
+   "default": "1",
    "fieldname": "exchange_rate",
    "fieldtype": "Float",
    "label": "Exchange Rate"
@@ -319,7 +320,7 @@
  "idx": 1,
  "is_submittable": 1,
  "links": [],
- "modified": "2021-05-18 16:10:08.249619",
+ "modified": "2021-06-09 12:08:53.930200",
  "modified_by": "Administrator",
  "module": "Projects",
  "name": "Timesheet",
diff --git a/erpnext/projects/doctype/timesheet/timesheet.py b/erpnext/projects/doctype/timesheet/timesheet.py
index ae38d4c..a0042eb 100644
--- a/erpnext/projects/doctype/timesheet/timesheet.py
+++ b/erpnext/projects/doctype/timesheet/timesheet.py
@@ -227,7 +227,8 @@
 	return frappe.db.sql("""SELECT tsd.name as name,
 				tsd.parent as parent, tsd.billing_hours as billing_hours,
 				tsd.billing_amount as billing_amount, tsd.activity_type as activity_type,
-				tsd.description as description, ts.currency as currency
+				tsd.description as description, ts.currency as currency,
+				tsd.project_name as project_name
 			FROM `tabTimesheet Detail` tsd
 			INNER JOIN `tabTimesheet` ts ON ts.name = tsd.parent
 			WHERE tsd.parenttype = 'Timesheet'
@@ -236,6 +237,19 @@
 				and tsd.sales_invoice is null""".format(condition), {'project': project, 'parent': parent, 'from_time': from_time, 'to_time': to_time}, as_dict=1)
 
 @frappe.whitelist()
+def get_timesheet_detail_rate(timelog, currency):
+	timelog_detail = frappe.db.sql("""SELECT tsd.billing_amount as billing_amount, 
+		ts.currency as currency FROM `tabTimesheet Detail` tsd 
+		INNER JOIN `tabTimesheet` ts ON ts.name=tsd.parent 
+		WHERE tsd.name = '{0}'""".format(timelog), as_dict = 1)[0]
+
+	if timelog_detail.currency:
+		exchange_rate = get_exchange_rate(timelog_detail.currency, currency)
+
+		return timelog_detail.billing_amount * exchange_rate
+	return timelog_detail.billing_amount
+
+@frappe.whitelist()
 @frappe.validate_and_sanitize_search_inputs
 def get_timesheet(doctype, txt, searchfield, start, page_len, filters):
 	if not filters: filters = {}
diff --git a/erpnext/projects/workspace/projects/projects.json b/erpnext/projects/workspace/projects/projects.json
index c023a73..065f1ed 100644
--- a/erpnext/projects/workspace/projects/projects.json
+++ b/erpnext/projects/workspace/projects/projects.json
@@ -1,28 +1,32 @@
 {
- "category": "Modules",
+ "category": "",
  "charts": [
   {
    "chart_name": "Project Summary",
    "label": "Open Projects"
   }
  ],
+ "content": "[{\"type\": \"chart\", \"data\": {\"chart_name\": \"Open Projects\", \"col\": 12}}, {\"type\": \"spacer\", \"data\": {\"col\": 12}}, {\"type\": \"header\", \"data\": {\"text\": \"Your Shortcuts\", \"level\": 4, \"col\": 12}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Task\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Project\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Timesheet\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Project Billing Summary\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Dashboard\", \"col\": 4}}, {\"type\": \"spacer\", \"data\": {\"col\": 12}}, {\"type\": \"header\", \"data\": {\"text\": \"Reports & Masters\", \"level\": 4, \"col\": 12}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Projects\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Time Tracking\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Reports\", \"col\": 4}}]",
  "creation": "2020-03-02 15:46:04.874669",
  "developer_mode_only": 0,
  "disable_user_customization": 0,
  "docstatus": 0,
  "doctype": "Workspace",
+ "extends": "",
  "extends_another_page": 0,
+ "for_user": "",
  "hide_custom": 0,
  "icon": "project",
  "idx": 0,
  "is_default": 0,
- "is_standard": 1,
+ "is_standard": 0,
  "label": "Projects",
  "links": [
   {
    "hidden": 0,
    "is_query_report": 0,
    "label": "Projects",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -31,6 +35,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Project",
+   "link_count": 0,
    "link_to": "Project",
    "link_type": "DocType",
    "onboard": 1,
@@ -41,6 +46,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Task",
+   "link_count": 0,
    "link_to": "Task",
    "link_type": "DocType",
    "onboard": 1,
@@ -51,6 +57,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Project Template",
+   "link_count": 0,
    "link_to": "Project Template",
    "link_type": "DocType",
    "onboard": 0,
@@ -61,6 +68,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Project Type",
+   "link_count": 0,
    "link_to": "Project Type",
    "link_type": "DocType",
    "onboard": 0,
@@ -71,6 +79,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Project Update",
+   "link_count": 0,
    "link_to": "Project Update",
    "link_type": "DocType",
    "onboard": 0,
@@ -80,6 +89,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Time Tracking",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -88,6 +98,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Timesheet",
+   "link_count": 0,
    "link_to": "Timesheet",
    "link_type": "DocType",
    "onboard": 1,
@@ -98,6 +109,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Activity Type",
+   "link_count": 0,
    "link_to": "Activity Type",
    "link_type": "DocType",
    "onboard": 1,
@@ -108,6 +120,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Activity Cost",
+   "link_count": 0,
    "link_to": "Activity Cost",
    "link_type": "DocType",
    "onboard": 0,
@@ -117,6 +130,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Reports",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -125,6 +139,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Daily Timesheet Summary",
+   "link_count": 0,
    "link_to": "Daily Timesheet Summary",
    "link_type": "Report",
    "onboard": 1,
@@ -135,6 +150,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Employee Hours Utilization",
+   "link_count": 0,
    "link_to": "Employee Hours Utilization Based On Timesheet",
    "link_type": "Report",
    "onboard": 0,
@@ -145,6 +161,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Project Profitability",
+   "link_count": 0,
    "link_to": "Project Profitability",
    "link_type": "Report",
    "onboard": 0,
@@ -155,6 +172,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Project wise Stock Tracking",
+   "link_count": 0,
    "link_to": "Project wise Stock Tracking",
    "link_type": "Report",
    "onboard": 0,
@@ -165,6 +183,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Project Billing Summary",
+   "link_count": 0,
    "link_to": "Project Billing Summary",
    "link_type": "Report",
    "onboard": 0,
@@ -175,19 +194,26 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Delayed Tasks Summary",
+   "link_count": 0,
    "link_to": "Delayed Tasks Summary",
    "link_type": "Report",
    "onboard": 0,
    "type": "Link"
   }
  ],
- "modified": "2021-04-25 16:27:16.548780",
+ "modified": "2021-08-05 12:16:01.540145",
  "modified_by": "Administrator",
  "module": "Projects",
  "name": "Projects",
+ "onboarding": "",
  "owner": "Administrator",
+ "parent_page": "",
  "pin_to_bottom": 0,
  "pin_to_top": 0,
+ "public": 1,
+ "restrict_to_domain": "",
+ "roles": [],
+ "sequence_id": 20,
  "shortcuts": [
   {
    "color": "Blue",
@@ -220,5 +246,6 @@
    "link_to": "Project",
    "type": "Dashboard"
   }
- ]
+ ],
+ "title": "Projects"
 }
\ No newline at end of file
diff --git a/erpnext/public/build.json b/erpnext/public/build.json
index 7a3cb83..3c60e3e 100644
--- a/erpnext/public/build.json
+++ b/erpnext/public/build.json
@@ -3,7 +3,8 @@
 		"public/less/erpnext.less",
 		"public/less/hub.less",
 		"public/scss/call_popup.scss",
-		"public/scss/point-of-sale.scss"
+		"public/scss/point-of-sale.scss",
+		"public/scss/hierarchy_chart.scss"
 	],
 	"css/marketplace.css": [
 		"public/less/hub.less"
@@ -43,7 +44,8 @@
 		"public/js/call_popup/call_popup.js",
 		"public/js/utils/dimension_tree_filter.js",
 		"public/js/telephony.js",
-		"public/js/templates/call_link.html"
+		"public/js/templates/call_link.html",
+		"public/js/templates/node_card.html"
 	],
 	"js/item-dashboard.min.js": [
 		"stock/dashboard/item_dashboard.html",
@@ -66,5 +68,9 @@
 		"public/js/bank_reconciliation_tool/data_table_manager.js",
 		"public/js/bank_reconciliation_tool/number_card.js",
 		"public/js/bank_reconciliation_tool/dialog_manager.js"
+	],
+	"js/hierarchy-chart.min.js": [
+		"public/js/hierarchy_chart/hierarchy_chart_desktop.js",
+		"public/js/hierarchy_chart/hierarchy_chart_mobile.js"
 	]
 }
diff --git a/erpnext/public/js/controllers/taxes_and_totals.js b/erpnext/public/js/controllers/taxes_and_totals.js
index 84697e0..e8f3122 100644
--- a/erpnext/public/js/controllers/taxes_and_totals.js
+++ b/erpnext/public/js/controllers/taxes_and_totals.js
@@ -47,7 +47,10 @@
 
 		if (in_list(["Sales Invoice", "POS Invoice"], this.frm.doc.doctype) && this.frm.doc.is_pos &&
 			this.frm.doc.is_return) {
-			this.update_paid_amount_for_return();
+			if (this.frm.doc.doctype == "Sales Invoice") {
+				this.set_total_amount_to_default_mop();
+			}
+			this.calculate_paid_amount();
 		}
 
 		// Sales person's commission
@@ -67,8 +70,6 @@
 
 	calculate_discount_amount() {
 		if (frappe.meta.get_docfield(this.frm.doc.doctype, "discount_amount")) {
-			this.calculate_item_values();
-			this.calculate_net_total();
 			this.set_discount_amount();
 			this.apply_discount_amount();
 		}
@@ -734,7 +735,7 @@
 		}
 	}
 
-	update_paid_amount_for_return() {
+	set_total_amount_to_default_mop() {
 		var grand_total = this.frm.doc.rounded_total || this.frm.doc.grand_total;
 
 		if(this.frm.doc.party_account_currency == this.frm.doc.currency) {
@@ -747,7 +748,6 @@
 				precision("base_grand_total")
 			);
 		}
-
 		this.frm.doc.payments.find(pay => {
 			if (pay.default) {
 				pay.amount = total_amount_to_pay;
diff --git a/erpnext/public/js/hierarchy-chart.bundle.js b/erpnext/public/js/hierarchy-chart.bundle.js
new file mode 100644
index 0000000..26ab6d9
--- /dev/null
+++ b/erpnext/public/js/hierarchy-chart.bundle.js
@@ -0,0 +1,3 @@
+import "./hierarchy_chart/hierarchy_chart_desktop.js";
+import "./hierarchy_chart/hierarchy_chart_mobile.js";
+import "./templates/node_card.html";
\ No newline at end of file
diff --git a/erpnext/public/js/hierarchy_chart/hierarchy_chart_desktop.js b/erpnext/public/js/hierarchy_chart/hierarchy_chart_desktop.js
new file mode 100644
index 0000000..da050ab
--- /dev/null
+++ b/erpnext/public/js/hierarchy_chart/hierarchy_chart_desktop.js
@@ -0,0 +1,600 @@
+import html2canvas from 'html2canvas';
+erpnext.HierarchyChart = class {
+	/* Options:
+		- doctype
+		- wrapper: wrapper for the hierarchy view
+		- method:
+			- to get the data for each node
+			- this method should return id, name, title, image, and connections for each node
+	*/
+	constructor(doctype, wrapper, method) {
+		this.page = wrapper.page;
+		this.method = method;
+		this.doctype = doctype;
+
+		this.setup_page_style();
+		this.page.main.addClass('frappe-card');
+
+		this.nodes = {};
+		this.setup_node_class();
+	}
+
+	setup_page_style() {
+		this.page.main.css({
+			'min-height': '300px',
+			'max-height': '600px',
+			'overflow': 'auto',
+			'position': 'relative'
+		});
+	}
+
+	setup_node_class() {
+		let me = this;
+		this.Node = class {
+			constructor({
+				id, parent, parent_id, image, name, title, expandable, connections, is_root // eslint-disable-line
+			}) {
+				// to setup values passed via constructor
+				$.extend(this, arguments[0]);
+
+				this.expanded = 0;
+
+				me.nodes[this.id] = this;
+				me.make_node_element(this);
+
+				if (!me.all_nodes_expanded) {
+					me.setup_node_click_action(this);
+				}
+
+				me.setup_edit_node_action(this);
+			}
+		};
+	}
+
+	make_node_element(node) {
+		let node_card = frappe.render_template('node_card', {
+			id: node.id,
+			name: node.name,
+			title: node.title,
+			image: node.image,
+			parent: node.parent_id,
+			connections: node.connections,
+			is_mobile: false
+		});
+
+		node.parent.append(node_card);
+		node.$link = $(`#${node.id}`);
+	}
+
+	show() {
+		frappe.breadcrumbs.add('HR');
+
+		this.setup_actions();
+		if ($(`[data-fieldname="company"]`).length) return;
+		let me = this;
+
+		let company = this.page.add_field({
+			fieldtype: 'Link',
+			options: 'Company',
+			fieldname: 'company',
+			placeholder: __('Select Company'),
+			default: frappe.defaults.get_default('company'),
+			only_select: true,
+			reqd: 1,
+			change: () => {
+				me.company = undefined;
+
+				if (company.get_value() && me.company != company.get_value()) {
+					me.company = company.get_value();
+
+					// svg for connectors
+					me.make_svg_markers();
+					me.setup_hierarchy();
+					me.render_root_nodes();
+					me.all_nodes_expanded = false;
+				}
+			}
+		});
+
+		company.refresh();
+		$(`[data-fieldname="company"]`).trigger('change');
+		$(`[data-fieldname="company"] .link-field`).css('z-index', 2);
+	}
+
+	setup_actions() {
+		let me = this;
+		this.page.clear_inner_toolbar();
+		this.page.add_inner_button(__('Export'), function() {
+			me.export_chart();
+		});
+
+		this.page.add_inner_button(__('Expand All'), function() {
+			me.load_children(me.root_node, true);
+			me.all_nodes_expanded = true;
+
+			me.page.remove_inner_button(__('Expand All'));
+			me.page.add_inner_button(__('Collapse All'), function() {
+				me.setup_hierarchy();
+				me.render_root_nodes();
+				me.all_nodes_expanded = false;
+
+				me.page.remove_inner_button(__('Collapse All'));
+				me.setup_actions();
+			});
+		});
+	}
+
+	export_chart() {
+		frappe.dom.freeze(__('Exporting...'));
+		this.page.main.css({
+			'min-height': '',
+			'max-height': '',
+			'overflow': 'visible',
+			'position': 'fixed',
+			'left': '0',
+			'top': '0'
+		});
+
+		$('.node-card').addClass('exported');
+
+		html2canvas(document.querySelector('#hierarchy-chart-wrapper'), {
+			scrollY: -window.scrollY,
+			scrollX: 0
+		}).then(function(canvas) {
+			// Export the canvas to its data URI representation
+			let dataURL = canvas.toDataURL('image/png');
+
+			// download the image
+			let a = document.createElement('a');
+			a.href = dataURL;
+			a.download = 'hierarchy_chart';
+			a.click();
+		}).finally(() => {
+			frappe.dom.unfreeze();
+		});
+
+		this.setup_page_style();
+		$('.node-card').removeClass('exported');
+	}
+
+	setup_hierarchy() {
+		if (this.$hierarchy)
+			this.$hierarchy.remove();
+
+		$(`#connectors`).empty();
+
+		// setup hierarchy
+		this.$hierarchy = $(
+			`<ul class="hierarchy">
+				<li class="root-level level">
+					<ul class="node-children"></ul>
+				</li>
+			</ul>`);
+
+		this.page.main
+			.find('#hierarchy-chart-wrapper')
+			.append(this.$hierarchy);
+
+		this.nodes = {};
+		this.all_nodes_expanded = false;
+	}
+
+	make_svg_markers() {
+		$('#hierarchy-chart-wrapper').remove();
+
+		this.page.main.append(`
+			<div id="hierarchy-chart-wrapper">
+				<svg id="arrows" width="100%" height="100%">
+					<defs>
+						<marker id="arrowhead-active" viewBox="0 0 10 10" refX="3" refY="5" markerWidth="6" markerHeight="6" orient="auto" fill="var(--blue-500)">
+							<path d="M 0 0 L 10 5 L 0 10 z"></path>
+						</marker>
+						<marker id="arrowhead-collapsed" viewBox="0 0 10 10" refX="3" refY="5" markerWidth="6" markerHeight="6" orient="auto" fill="var(--blue-300)">
+							<path d="M 0 0 L 10 5 L 0 10 z"></path>
+						</marker>
+
+						<marker id="arrowstart-active" viewBox="0 0 10 10" refX="3" refY="5" markerWidth="8" markerHeight="8" orient="auto" fill="var(--blue-500)">
+							<circle cx="4" cy="4" r="3.5" fill="white" stroke="var(--blue-500)"/>
+						</marker>
+						<marker id="arrowstart-collapsed" viewBox="0 0 10 10" refX="3" refY="5" markerWidth="8" markerHeight="8" orient="auto" fill="var(--blue-300)">
+							<circle cx="4" cy="4" r="3.5" fill="white" stroke="var(--blue-300)"/>
+						</marker>
+					</defs>
+					<g id="connectors" fill="none">
+					</g>
+				</svg>
+			</div>`);
+	}
+
+	render_root_nodes(expanded_view=false) {
+		let me = this;
+
+		return frappe.call({
+			method: me.method,
+			args: {
+				company: me.company
+			}
+		}).then(r => {
+			if (r.message.length) {
+				let expand_node = undefined;
+				let node = undefined;
+
+				$.each(r.message, (i, data) => {
+					node = new me.Node({
+						id: data.id,
+						parent: $('<li class="child-node"></li>').appendTo(me.$hierarchy.find('.node-children')),
+						parent_id: undefined,
+						image: data.image,
+						name: data.name,
+						title: data.title,
+						expandable: true,
+						connections: data.connections,
+						is_root: true
+					});
+
+					if (!expand_node && data.connections)
+						expand_node = node;
+				});
+
+				me.root_node = expand_node;
+				if (!expanded_view) {
+					me.expand_node(expand_node);
+				}
+			}
+		});
+	}
+
+	expand_node(node) {
+		const is_sibling = this.selected_node && this.selected_node.parent_id === node.parent_id;
+		this.set_selected_node(node);
+		this.show_active_path(node);
+		this.collapse_previous_level_nodes(node);
+
+		// since the previous node collapses, all connections to that node need to be rebuilt
+		// if a sibling node is clicked, connections don't need to be rebuilt
+		if (!is_sibling) {
+			// rebuild outgoing connections
+			this.refresh_connectors(node.parent_id);
+
+			// rebuild incoming connections
+			let grandparent = $(`#${node.parent_id}`).attr('data-parent');
+			this.refresh_connectors(grandparent);
+		}
+
+		if (node.expandable && !node.expanded) {
+			return this.load_children(node);
+		}
+	}
+
+	collapse_node() {
+		if (this.selected_node.expandable) {
+			this.selected_node.$children.hide();
+			$(`path[data-parent="${this.selected_node.id}"]`).hide();
+			this.selected_node.expanded = false;
+		}
+	}
+
+	show_active_path(node) {
+		// mark node parent on active path
+		$(`#${node.parent_id}`).addClass('active-path');
+	}
+
+	load_children(node, deep=false) {
+		if (!deep) {
+			frappe.run_serially([
+				() => this.get_child_nodes(node.id),
+				(child_nodes) => this.render_child_nodes(node, child_nodes)
+			]);
+		} else {
+			frappe.run_serially([
+				() => frappe.dom.freeze(),
+				() => this.setup_hierarchy(),
+				() => this.render_root_nodes(true),
+				() => this.get_all_nodes(node.id, node.name),
+				(data_list) => this.render_children_of_all_nodes(data_list),
+				() => frappe.dom.unfreeze()
+			]);
+		}
+	}
+
+	get_child_nodes(node_id) {
+		return new Promise(resolve => {
+			frappe.call({
+				method: this.method,
+				args: {
+					parent: node_id,
+					company: this.company
+				}
+			}).then(r => resolve(r.message));
+		});
+	}
+
+	render_child_nodes(node, child_nodes) {
+		const last_level = this.$hierarchy.find('.level:last').index();
+		const current_level = $(`#${node.id}`).parent().parent().parent().index();
+
+		if (last_level === current_level) {
+			this.$hierarchy.append(`
+				<li class="level"></li>
+			`);
+		}
+
+		if (!node.$children) {
+			node.$children = $('<ul class="node-children"></ul>')
+				.hide()
+				.appendTo(this.$hierarchy.find('.level:last'));
+
+			node.$children.empty();
+
+			if (child_nodes) {
+				$.each(child_nodes, (_i, data) => {
+					this.add_node(node, data);
+					setTimeout(() => {
+						this.add_connector(node.id, data.id);
+					}, 250);
+				});
+			}
+		}
+
+		node.$children.show();
+		$(`path[data-parent="${node.id}"]`).show();
+		node.expanded = true;
+	}
+
+	get_all_nodes(node_id, node_name) {
+		return new Promise(resolve => {
+			frappe.call({
+				method: 'erpnext.utilities.hierarchy_chart.get_all_nodes',
+				args: {
+					method: this.method,
+					company: this.company,
+					parent: node_id,
+					parent_name: node_name
+				},
+				callback: (r) => {
+					resolve(r.message);
+				}
+			});
+		});
+	}
+
+	render_children_of_all_nodes(data_list) {
+		let entry = undefined;
+		let node = undefined;
+
+		while (data_list.length) {
+			// to avoid overlapping connectors
+			entry = data_list.shift();
+			node = this.nodes[entry.parent];
+			if (node) {
+				this.render_child_nodes_for_expanded_view(node, entry.data);
+			} else if (data_list.length) {
+				data_list.push(entry);
+			}
+		}
+	}
+
+	render_child_nodes_for_expanded_view(node, child_nodes) {
+		node.$children = $('<ul class="node-children"></ul>');
+
+		const last_level = this.$hierarchy.find('.level:last').index();
+		const node_level = $(`#${node.id}`).parent().parent().parent().index();
+
+		if (last_level === node_level) {
+			this.$hierarchy.append(`
+				<li class="level"></li>
+			`);
+			node.$children.appendTo(this.$hierarchy.find('.level:last'));
+		} else {
+			node.$children.appendTo(this.$hierarchy.find('.level:eq(' + (node_level + 1) + ')'));
+		}
+
+		node.$children.hide().empty();
+
+		if (child_nodes) {
+			$.each(child_nodes, (_i, data) => {
+				this.add_node(node, data);
+				setTimeout(() => {
+					this.add_connector(node.id, data.id);
+				}, 250);
+			});
+		}
+
+		node.$children.show();
+		$(`path[data-parent="${node.id}"]`).show();
+		node.expanded = true;
+	}
+
+	add_node(node, data) {
+		return new this.Node({
+			id: data.id,
+			parent: $('<li class="child-node"></li>').appendTo(node.$children),
+			parent_id: node.id,
+			image: data.image,
+			name: data.name,
+			title: data.title,
+			expandable: data.expandable,
+			connections: data.connections,
+			children: undefined
+		});
+	}
+
+	add_connector(parent_id, child_id) {
+		// using pure javascript for better performance
+		const parent_node = document.querySelector(`#${parent_id}`);
+		const child_node = document.querySelector(`#${child_id}`);
+
+		let path = document.createElementNS('http://www.w3.org/2000/svg', 'path');
+
+		// we need to connect right side of the parent to the left side of the child node
+		const pos_parent_right = {
+			x: parent_node.offsetLeft + parent_node.offsetWidth,
+			y: parent_node.offsetTop + parent_node.offsetHeight / 2
+		};
+		const pos_child_left = {
+			x: child_node.offsetLeft - 5,
+			y: child_node.offsetTop + child_node.offsetHeight / 2
+		};
+
+		const connector = this.get_connector(pos_parent_right, pos_child_left);
+
+		path.setAttribute('d', connector);
+		this.set_path_attributes(path, parent_id, child_id);
+
+		document.getElementById('connectors').appendChild(path);
+	}
+
+	get_connector(pos_parent_right, pos_child_left) {
+		if (pos_parent_right.y === pos_child_left.y) {
+			// don't add arcs if it's a straight line
+			return "M" +
+			(pos_parent_right.x) + "," + (pos_parent_right.y) + " " +
+			"L"+
+			(pos_child_left.x) + "," + (pos_child_left.y);
+		} else {
+			let arc_1 = "";
+			let arc_2 = "";
+			let offset = 0;
+
+			if (pos_parent_right.y > pos_child_left.y) {
+				// if child is above parent on Y axis 1st arc is anticlocwise
+				// second arc is clockwise
+				arc_1 = "a10,10 1 0 0 10,-10 ";
+				arc_2 = "a10,10 0 0 1 10,-10 ";
+				offset = 10;
+			} else {
+				// if child is below parent on Y axis 1st arc is clockwise
+				// second arc is anticlockwise
+				arc_1 = "a10,10 0 0 1 10,10 ";
+				arc_2 = "a10,10 1 0 0 10,10 ";
+				offset = -10;
+			}
+
+			return "M" + (pos_parent_right.x) + "," + (pos_parent_right.y) + " " +
+				"L" +
+				(pos_parent_right.x + 40) + "," + (pos_parent_right.y) + " " +
+				arc_1 +
+				"L" +
+				(pos_parent_right.x + 50) + "," + (pos_child_left.y + offset) + " " +
+				arc_2 +
+				"L"+
+				(pos_child_left.x) + "," + (pos_child_left.y);
+		}
+	}
+
+	set_path_attributes(path, parent_id, child_id) {
+		path.setAttribute("data-parent", parent_id);
+		path.setAttribute("data-child", child_id);
+		const parent = $(`#${parent_id}`);
+
+		if (parent.hasClass('active')) {
+			path.setAttribute("class", "active-connector");
+			path.setAttribute("marker-start", "url(#arrowstart-active)");
+			path.setAttribute("marker-end", "url(#arrowhead-active)");
+		} else {
+			path.setAttribute("class", "collapsed-connector");
+			path.setAttribute("marker-start", "url(#arrowstart-collapsed)");
+			path.setAttribute("marker-end", "url(#arrowhead-collapsed)");
+		}
+	}
+
+	set_selected_node(node) {
+		// remove active class from the current node
+		if (this.selected_node)
+			this.selected_node.$link.removeClass('active');
+
+		// add active class to the newly selected node
+		this.selected_node = node;
+		node.$link.addClass('active');
+	}
+
+	collapse_previous_level_nodes(node) {
+		let node_parent = $(`#${node.parent_id}`);
+		let previous_level_nodes = node_parent.parent().parent().children('li');
+		let node_card = undefined;
+
+		previous_level_nodes.each(function() {
+			node_card = $(this).find('.node-card');
+
+			if (!node_card.hasClass('active-path')) {
+				node_card.addClass('collapsed');
+			}
+		});
+	}
+
+	refresh_connectors(node_parent) {
+		if (!node_parent) return;
+
+		$(`path[data-parent="${node_parent}"]`).remove();
+
+		frappe.run_serially([
+			() => this.get_child_nodes(node_parent),
+			(child_nodes) => {
+				if (child_nodes) {
+					$.each(child_nodes, (_i, data) => {
+						this.add_connector(node_parent, data.id);
+					});
+				}
+			}
+		]);
+	}
+
+	setup_node_click_action(node) {
+		let me = this;
+		let node_element = $(`#${node.id}`);
+
+		node_element.click(function() {
+			const is_sibling = me.selected_node.parent_id === node.parent_id;
+
+			if (is_sibling) {
+				me.collapse_node();
+			} else if (node_element.is(':visible')
+				&& (node_element.hasClass('collapsed') || node_element.hasClass('active-path'))) {
+				me.remove_levels_after_node(node);
+				me.remove_orphaned_connectors();
+			}
+
+			me.expand_node(node);
+		});
+	}
+
+	setup_edit_node_action(node) {
+		let node_element = $(`#${node.id}`);
+		let me = this;
+
+		node_element.find('.btn-edit-node').click(function() {
+			frappe.set_route('Form', me.doctype, node.id);
+		});
+	}
+
+	remove_levels_after_node(node) {
+		let level = $(`#${node.id}`).parent().parent().parent().index();
+
+		level = $('.hierarchy > li:eq('+ level + ')');
+		level.nextAll('li').remove();
+
+		let nodes = level.find('.node-card');
+		let node_object = undefined;
+
+		$.each(nodes, (_i, element) => {
+			node_object = this.nodes[element.id];
+			node_object.expanded = 0;
+			node_object.$children = undefined;
+		});
+
+		nodes.removeClass('collapsed active-path');
+	}
+
+	remove_orphaned_connectors() {
+		let paths = $('#connectors > path');
+		$.each(paths, (_i, path) => {
+			const parent = $(path).data('parent');
+			const child = $(path).data('child');
+
+			if ($(`#${parent}`).length && $(`#${child}`).length)
+				return;
+
+			$(path).remove();
+		});
+	}
+};
\ No newline at end of file
diff --git a/erpnext/public/js/hierarchy_chart/hierarchy_chart_mobile.js b/erpnext/public/js/hierarchy_chart/hierarchy_chart_mobile.js
new file mode 100644
index 0000000..bd7946a
--- /dev/null
+++ b/erpnext/public/js/hierarchy_chart/hierarchy_chart_mobile.js
@@ -0,0 +1,551 @@
+erpnext.HierarchyChartMobile = class {
+	/* Options:
+		- doctype
+		- wrapper: wrapper for the hierarchy view
+		- method:
+			- to get the data for each node
+			- this method should return id, name, title, image, and connections for each node
+	*/
+	constructor(doctype, wrapper, method) {
+		this.page = wrapper.page;
+		this.method = method;
+		this.doctype = doctype;
+
+		this.page.main.css({
+			'min-height': '300px',
+			'max-height': '600px',
+			'overflow': 'auto',
+			'position': 'relative'
+		});
+		this.page.main.addClass('frappe-card');
+
+		this.nodes = {};
+		this.setup_node_class();
+	}
+
+	setup_node_class() {
+		let me = this;
+		this.Node = class {
+			constructor({
+				id, parent, parent_id, image, name, title, expandable, connections, is_root // eslint-disable-line
+			}) {
+				// to setup values passed via constructor
+				$.extend(this, arguments[0]);
+
+				this.expanded = 0;
+
+				me.nodes[this.id] = this;
+				me.make_node_element(this);
+				me.setup_node_click_action(this);
+				me.setup_edit_node_action(this);
+			}
+		};
+	}
+
+	make_node_element(node) {
+		let node_card = frappe.render_template('node_card', {
+			id: node.id,
+			name: node.name,
+			title: node.title,
+			image: node.image,
+			parent: node.parent_id,
+			connections: node.connections,
+			is_mobile: true
+		});
+
+		node.parent.append(node_card);
+		node.$link = $(`#${node.id}`);
+		node.$link.addClass('mobile-node');
+	}
+
+	show() {
+		frappe.breadcrumbs.add('HR');
+
+		let me = this;
+		if ($(`[data-fieldname="company"]`).length) return;
+
+		let company = this.page.add_field({
+			fieldtype: 'Link',
+			options: 'Company',
+			fieldname: 'company',
+			placeholder: __('Select Company'),
+			default: frappe.defaults.get_default('company'),
+			only_select: true,
+			reqd: 1,
+			change: () => {
+				me.company = undefined;
+
+				if (company.get_value() && me.company != company.get_value()) {
+					me.company = company.get_value();
+
+					// svg for connectors
+					me.make_svg_markers();
+
+					if (me.$sibling_group)
+						me.$sibling_group.remove();
+
+					// setup sibling group wrapper
+					me.$sibling_group = $(`<div class="sibling-group mt-4 mb-4"></div>`);
+					me.page.main.append(me.$sibling_group);
+
+					me.setup_hierarchy();
+					me.render_root_nodes();
+				}
+			}
+		});
+
+		company.refresh();
+		$(`[data-fieldname="company"]`).trigger('change');
+	}
+
+	make_svg_markers() {
+		$('#arrows').remove();
+
+		this.page.main.prepend(`
+			<svg id="arrows" width="100%" height="100%">
+				<defs>
+					<marker id="arrowhead-active" viewBox="0 0 10 10" refX="3" refY="5" markerWidth="6" markerHeight="6" orient="auto" fill="var(--blue-500)">
+						<path d="M 0 0 L 10 5 L 0 10 z"></path>
+					</marker>
+					<marker id="arrowhead-collapsed" viewBox="0 0 10 10" refX="3" refY="5" markerWidth="6" markerHeight="6" orient="auto" fill="var(--blue-300)">
+						<path d="M 0 0 L 10 5 L 0 10 z"></path>
+					</marker>
+
+					<marker id="arrowstart-active" viewBox="0 0 10 10" refX="3" refY="5" markerWidth="8" markerHeight="8" orient="auto" fill="var(--blue-500)">
+						<circle cx="4" cy="4" r="3.5" fill="white" stroke="var(--blue-500)"/>
+					</marker>
+					<marker id="arrowstart-collapsed" viewBox="0 0 10 10" refX="3" refY="5" markerWidth="8" markerHeight="8" orient="auto" fill="var(--blue-300)">
+						<circle cx="4" cy="4" r="3.5" fill="white" stroke="var(--blue-300)"/>
+					</marker>
+				</defs>
+				<g id="connectors" fill="none">
+				</g>
+			</svg>`);
+	}
+
+	setup_hierarchy() {
+		$(`#connectors`).empty();
+		if (this.$hierarchy)
+			this.$hierarchy.remove();
+
+		if (this.$sibling_group)
+			this.$sibling_group.empty();
+
+		this.$hierarchy = $(
+			`<ul class="hierarchy-mobile">
+				<li class="root-level level"></li>
+			</ul>`);
+
+		this.page.main.append(this.$hierarchy);
+	}
+
+	render_root_nodes() {
+		let me = this;
+
+		frappe.call({
+			method: me.method,
+			args: {
+				company: me.company
+			},
+		}).then(r => {
+			if (r.message.length) {
+				let root_level = me.$hierarchy.find('.root-level');
+				root_level.empty();
+
+				$.each(r.message, (_i, data) => {
+					return new me.Node({
+						id: data.id,
+						parent: root_level,
+						parent_id: undefined,
+						image: data.image,
+						name: data.name,
+						title: data.title,
+						expandable: true,
+						connections: data.connections,
+						is_root: true
+					});
+				});
+			}
+		});
+	}
+
+	expand_node(node) {
+		const is_same_node = (this.selected_node && this.selected_node.id === node.id);
+		this.set_selected_node(node);
+		this.show_active_path(node);
+
+		if (this.$sibling_group) {
+			const sibling_parent = this.$sibling_group.find('.node-group').attr('data-parent');
+			if (node.parent_id !== undefined && node.parent_id != sibling_parent)
+				this.$sibling_group.empty();
+		}
+
+		if (!is_same_node) {
+			// since the previous/parent node collapses, all connections to that node need to be rebuilt
+			// rebuild outgoing connections of parent
+			this.refresh_connectors(node.parent_id, node.id);
+
+			// rebuild incoming connections of parent
+			let grandparent = $(`#${node.parent_id}`).attr('data-parent');
+			this.refresh_connectors(grandparent, node.parent_id);
+		}
+
+		if (node.expandable && !node.expanded) {
+			return this.load_children(node);
+		}
+	}
+
+	collapse_node() {
+		let node = this.selected_node;
+		if (node.expandable && node.$children) {
+			node.$children.hide();
+			node.expanded = 0;
+
+			// add a collapsed level to show the collapsed parent
+			// and a button beside it to move to that level
+			let node_parent = node.$link.parent();
+			node_parent.prepend(
+				`<div class="collapsed-level d-flex flex-row"></div>`
+			);
+
+			node_parent
+				.find('.collapsed-level')
+				.append(node.$link);
+
+			frappe.run_serially([
+				() => this.get_child_nodes(node.parent_id, node.id),
+				(child_nodes) => this.get_node_group(child_nodes, node.parent_id),
+				(node_group) => node_parent.find('.collapsed-level').append(node_group),
+				() => this.setup_node_group_action()
+			]);
+		}
+	}
+
+	show_active_path(node) {
+		// mark node parent on active path
+		$(`#${node.parent_id}`).addClass('active-path');
+	}
+
+	load_children(node) {
+		frappe.run_serially([
+			() => this.get_child_nodes(node.id),
+			(child_nodes) => this.render_child_nodes(node, child_nodes)
+		]);
+	}
+
+	get_child_nodes(node_id, exclude_node=null) {
+		let me = this;
+		return new Promise(resolve => {
+			frappe.call({
+				method: this.method,
+				args: {
+					parent: node_id,
+					company: me.company,
+					exclude_node: exclude_node
+				}
+			}).then(r => resolve(r.message));
+		});
+	}
+
+	render_child_nodes(node, child_nodes) {
+		if (!node.$children) {
+			node.$children = $('<ul class="node-children"></ul>')
+				.hide()
+				.appendTo(node.$link.parent());
+
+			node.$children.empty();
+
+			if (child_nodes) {
+				$.each(child_nodes, (_i, data) => {
+					this.add_node(node, data);
+					$(`#${data.id}`).addClass('active-child');
+
+					setTimeout(() => {
+						this.add_connector(node.id, data.id);
+					}, 250);
+				});
+			}
+		}
+
+		node.$children.show();
+		node.expanded = 1;
+	}
+
+	add_node(node, data) {
+		var $li = $('<li class="child-node"></li>');
+
+		return new this.Node({
+			id: data.id,
+			parent: $li.appendTo(node.$children),
+			parent_id: node.id,
+			image: data.image,
+			name: data.name,
+			title: data.title,
+			expandable: data.expandable,
+			connections: data.connections,
+			children: undefined
+		});
+	}
+
+	add_connector(parent_id, child_id) {
+		const parent_node = document.querySelector(`#${parent_id}`);
+		const child_node = document.querySelector(`#${child_id}`);
+
+		const path = document.createElementNS('http://www.w3.org/2000/svg', 'path');
+
+		let connector = undefined;
+
+		if ($(`#${parent_id}`).hasClass('active')) {
+			connector = this.get_connector_for_active_node(parent_node, child_node);
+		} else if ($(`#${parent_id}`).hasClass('active-path')) {
+			connector = this.get_connector_for_collapsed_node(parent_node, child_node);
+		}
+
+		path.setAttribute('d', connector);
+		this.set_path_attributes(path, parent_id, child_id);
+
+		document.getElementById('connectors').appendChild(path);
+	}
+
+	get_connector_for_active_node(parent_node, child_node) {
+		// we need to connect the bottom left of the parent to the left side of the child node
+		let pos_parent_bottom = {
+			x: parent_node.offsetLeft + 20,
+			y: parent_node.offsetTop + parent_node.offsetHeight
+		};
+		let pos_child_left = {
+			x: child_node.offsetLeft - 5,
+			y: child_node.offsetTop + child_node.offsetHeight / 2
+		};
+
+		let connector =
+			"M" +
+			(pos_parent_bottom.x) + "," + (pos_parent_bottom.y) + " " +
+			"L" +
+			(pos_parent_bottom.x) + "," + (pos_child_left.y - 10) + " " +
+			"a10,10 1 0 0 10,10 " +
+			"L" +
+			(pos_child_left.x) + "," + (pos_child_left.y);
+
+		return connector;
+	}
+
+	get_connector_for_collapsed_node(parent_node, child_node) {
+		// we need to connect the bottom left of the parent to the top left of the child node
+		let pos_parent_bottom = {
+			x: parent_node.offsetLeft + 20,
+			y: parent_node.offsetTop + parent_node.offsetHeight
+		};
+		let pos_child_top = {
+			x: child_node.offsetLeft + 20,
+			y: child_node.offsetTop
+		};
+
+		let connector =
+			"M" +
+			(pos_parent_bottom.x) + "," + (pos_parent_bottom.y) + " " +
+			"L" +
+			(pos_child_top.x) + "," + (pos_child_top.y);
+
+		return connector;
+	}
+
+	set_path_attributes(path, parent_id, child_id) {
+		path.setAttribute("data-parent", parent_id);
+		path.setAttribute("data-child", child_id);
+		const parent = $(`#${parent_id}`);
+
+		if (parent.hasClass('active')) {
+			path.setAttribute("class", "active-connector");
+			path.setAttribute("marker-start", "url(#arrowstart-active)");
+			path.setAttribute("marker-end", "url(#arrowhead-active)");
+		} else if (parent.hasClass('active-path')) {
+			path.setAttribute("class", "collapsed-connector");
+		}
+	}
+
+	set_selected_node(node) {
+		// remove .active class from the current node
+		if (this.selected_node)
+			this.selected_node.$link.removeClass('active');
+
+		// add active class to the newly selected node
+		this.selected_node = node;
+		node.$link.addClass('active');
+	}
+
+	setup_node_click_action(node) {
+		let me = this;
+		let node_element = $(`#${node.id}`);
+
+		node_element.click(function() {
+			let el = undefined;
+
+			if (node.is_root) {
+				el = $(this).detach();
+				me.$hierarchy.empty();
+				$(`#connectors`).empty();
+				me.add_node_to_hierarchy(el, node);
+			} else if (node_element.is(':visible') && node_element.hasClass('active-path')) {
+				me.remove_levels_after_node(node);
+				me.remove_orphaned_connectors();
+			} else {
+				el = $(this).detach();
+				me.add_node_to_hierarchy(el, node);
+				me.collapse_node();
+			}
+
+			me.expand_node(node);
+		});
+	}
+
+	setup_edit_node_action(node) {
+		let node_element = $(`#${node.id}`);
+		let me = this;
+
+		node_element.find('.btn-edit-node').click(function() {
+			frappe.set_route('Form', me.doctype, node.id);
+		});
+	}
+
+	setup_node_group_action() {
+		let me = this;
+
+		$('.node-group').on('click', function() {
+			let parent = $(this).attr('data-parent');
+			if (parent === 'undefined') {
+				me.setup_hierarchy();
+				me.render_root_nodes();
+			} else {
+				me.expand_sibling_group_node(parent);
+			}
+		});
+	}
+
+	add_node_to_hierarchy(node_element, node) {
+		this.$hierarchy.append(`<li class="level"></li>`);
+		node_element.removeClass('active-child active-path');
+		this.$hierarchy.find('.level:last').append(node_element);
+
+		let node_object = this.nodes[node.id];
+		node_object.expanded = 0;
+		node_object.$children = undefined;
+		this.nodes[node.id] = node_object;
+	}
+
+	get_node_group(nodes, parent, collapsed=true) {
+		let limit = 2;
+		const display_nodes = nodes.slice(0, limit);
+		const extra_nodes = nodes.slice(limit);
+
+		let html = display_nodes.map(node =>
+			this.get_avatar(node)
+		).join('');
+
+		if (extra_nodes.length === 1) {
+			let node = extra_nodes[0];
+			html += this.get_avatar(node);
+		} else if (extra_nodes.length > 1) {
+			html = `
+				${html}
+				<span class="avatar avatar-small">
+					<div class="avatar-frame standard-image avatar-extra-count"
+						title="${extra_nodes.map(node => node.name).join(', ')}">
+						+${extra_nodes.length}
+					</div>
+				</span>
+			`;
+		}
+
+		if (html) {
+			const $node_group =
+				$(`<div class="node-group card cursor-pointer" data-parent=${parent}>
+					<div class="avatar-group right overlap">
+						${html}
+					</div>
+				</div>`);
+
+			if (collapsed)
+				$node_group.addClass('collapsed');
+
+			return $node_group;
+		}
+
+		return null;
+	}
+
+	get_avatar(node) {
+		return `<span class="avatar avatar-small" title="${node.name}">
+			<span class="avatar-frame" src=${node.image} style="background-image: url(${node.image})"></span>
+		</span>`;
+	}
+
+	expand_sibling_group_node(parent) {
+		let node_object = this.nodes[parent];
+		let node = node_object.$link;
+
+		node.removeClass('active-child active-path');
+		node_object.expanded = 0;
+		node_object.$children = undefined;
+		this.nodes[node.id] = node_object;
+
+		// show parent's siblings and expand parent node
+		frappe.run_serially([
+			() => this.get_child_nodes(node_object.parent_id, node_object.id),
+			(child_nodes) => this.get_node_group(child_nodes, node_object.parent_id, false),
+			(node_group) => {
+				if (node_group)
+					this.$sibling_group.empty().append(node_group);
+			},
+			() => this.setup_node_group_action(),
+			() => this.reattach_and_expand_node(node, node_object)
+		]);
+	}
+
+	reattach_and_expand_node(node, node_object) {
+		var el = node.detach();
+
+		this.$hierarchy.empty().append(`
+			<li class="level"></li>
+		`);
+		this.$hierarchy.find('.level').append(el);
+		$(`#connectors`).empty();
+		this.expand_node(node_object);
+	}
+
+	remove_levels_after_node(node) {
+		let level = $(`#${node.id}`).parent().parent().index();
+
+		level = $('.hierarchy-mobile > li:eq('+ level + ')');
+		level.nextAll('li').remove();
+
+		let node_object = this.nodes[node.id];
+		let current_node = level.find(`#${node.id}`).detach();
+		current_node.removeClass('active-child active-path');
+
+		node_object.expanded = 0;
+		node_object.$children = undefined;
+
+		level.empty().append(current_node);
+	}
+
+	remove_orphaned_connectors() {
+		let paths = $('#connectors > path');
+		$.each(paths, (_i, path) => {
+			const parent = $(path).data('parent');
+			const child = $(path).data('child');
+
+			if ($(`#${parent}`).length && $(`#${child}`).length)
+				return;
+
+			$(path).remove();
+		});
+	}
+
+	refresh_connectors(node_parent, node_id) {
+		if (!node_parent) return;
+
+		$(`path[data-parent="${node_parent}"]`).remove();
+		this.add_connector(node_parent, node_id);
+	}
+};
\ No newline at end of file
diff --git a/erpnext/public/js/templates/node_card.html b/erpnext/public/js/templates/node_card.html
new file mode 100644
index 0000000..fb94df8
--- /dev/null
+++ b/erpnext/public/js/templates/node_card.html
@@ -0,0 +1,33 @@
+<div class="node-card card cursor-pointer" id="{%= id %}" data-parent="{%= parent %}">
+	<div class="node-meta d-flex flex-row">
+		<div class="mr-3">
+			<span class="avatar node-image" title="{{ name }}">
+				<span class="avatar-frame" src={{image}} style="background-image: url(\'{%= image %}\')"></span>
+			</span>
+		</div>
+		<div>
+			<div class="node-name d-flex flex-row mb-1">
+				<span class="ellipsis">{{ name }}</span>
+				<div class="btn-xs btn-edit-node d-flex flex-row">
+					<a class="node-edit-icon">{{ frappe.utils.icon("edit", "xs") }}</a>
+					<span class="edit-chart-node text-xs">{{ __("Edit") }}</span>
+				</div>
+			</div>
+			<div class="node-info d-flex flex-row mb-1">
+				<div class="node-title text-muted ellipsis">{{ title }}</div>
+
+				{% if is_mobile %}
+					<div class="node-connections text-muted ml-2 ellipsis">
+						· {{ connections }} <span class="fa fa-level-down"></span>
+					</div>
+				{% else %}
+					{% if connections == 1 %}
+						<div class="node-connections text-muted ml-2 ellipsis">· {{ connections }} Connection</div>
+					{% else %}
+						<div class="node-connections text-muted ml-2 ellipsis">· {{ connections }} Connections</div>
+					{% endif %}
+				{% endif %}
+			</div>
+		</div>
+	</div>
+</div>
\ No newline at end of file
diff --git a/erpnext/public/js/utils/party.js b/erpnext/public/js/utils/party.js
index a79eadc..4d432e3 100644
--- a/erpnext/public/js/utils/party.js
+++ b/erpnext/public/js/utils/party.js
@@ -76,6 +76,7 @@
 
 		if (args) {
 			args.posting_date = frm.doc.posting_date || frm.doc.transaction_date;
+			args.fetch_payment_terms_template = cint(!frm.doc.ignore_default_payment_terms_template);
 		}
 	}
 	if (!args || !args.party) return;
diff --git a/erpnext/public/scss/erpnext.bundle.scss b/erpnext/public/scss/erpnext.bundle.scss
index d3313c7..b68ddf5 100644
--- a/erpnext/public/scss/erpnext.bundle.scss
+++ b/erpnext/public/scss/erpnext.bundle.scss
@@ -1,3 +1,4 @@
 @import "./erpnext";
 @import "./call_popup";
 @import "./point-of-sale";
+@import "./hierarchy_chart";
diff --git a/erpnext/public/scss/hierarchy_chart.scss b/erpnext/public/scss/hierarchy_chart.scss
new file mode 100644
index 0000000..a66d647
--- /dev/null
+++ b/erpnext/public/scss/hierarchy_chart.scss
@@ -0,0 +1,313 @@
+.node-card {
+	background: white;
+	stroke: 1px solid var(--gray-200);
+	box-shadow: var(--shadow-base);
+	border-radius: 0.5rem;
+	padding: 0.75rem;
+	margin-left: 3rem;
+	width: 18rem;
+	overflow: hidden;
+
+	.btn-edit-node {
+		display: none;
+	}
+
+	.edit-chart-node {
+		display: none;
+	}
+
+	.node-edit-icon {
+		display: none;
+	}
+}
+
+.node-card.exported {
+	box-shadow: none
+}
+
+.node-image {
+	width: 3.0rem;
+	height: 3.0rem;
+}
+
+.node-name {
+	font-size: 1rem;
+	line-height: 1.72;
+}
+
+.node-title {
+	font-size: 0.75rem;
+	line-height: 1.35;
+}
+
+.node-info {
+	width: 12.7rem;
+}
+
+.node-connections {
+	font-size: 0.75rem;
+	line-height: 1.35;
+}
+
+.node-card.active {
+	background: var(--blue-50);
+	border: 1px solid var(--blue-500);
+	box-shadow: var(--shadow-md);
+	border-radius: 0.5rem;
+	padding: 0.75rem;
+	width: 18rem;
+
+	.btn-edit-node {
+		display: flex;
+		background: var(--blue-100);
+		color: var(--blue-500);
+		padding: .25rem .5rem;
+		font-size: .75rem;
+		justify-content: center;
+		box-shadow: var(--shadow-sm);
+		margin-left: auto;
+	}
+
+	.edit-chart-node {
+		display: block;
+		margin-right: 0.25rem;
+	}
+
+	.node-edit-icon {
+		display: block;
+	}
+
+	.node-edit-icon > .icon{
+		stroke: var(--blue-500);
+	}
+
+	.node-name {
+		align-items: center;
+		justify-content: space-between;
+		margin-bottom: 2px;
+		width: 12.2rem;
+	}
+}
+
+.node-card.active-path {
+	background: var(--blue-100);
+	border: 1px solid var(--blue-300);
+	box-shadow: var(--shadow-sm);
+	border-radius: 0.5rem;
+	padding: 0.75rem;
+	width: 15rem;
+	height: 3.0rem;
+
+	.btn-edit-node {
+		display: none !important;
+	}
+
+	.edit-chart-node {
+		display: none;
+	}
+
+	.node-edit-icon {
+		display: none;
+	}
+
+	.node-info {
+		display: none;
+	}
+
+	.node-title {
+		display: none;
+	}
+
+	.node-connections {
+		display: none;
+	}
+
+	.node-name {
+		font-size: 0.85rem;
+		line-height: 1.35;
+	}
+
+	.node-image {
+		width: 1.5rem;
+		height: 1.5rem;
+	}
+
+	.node-meta {
+		align-items: baseline;
+	}
+}
+
+.node-card.collapsed {
+	background: white;
+	stroke: 1px solid var(--gray-200);
+	box-shadow: var(--shadow-sm);
+	border-radius: 0.5rem;
+	padding: 0.75rem;
+	width: 15rem;
+	height: 3.0rem;
+
+	.btn-edit-node {
+		display: none !important;
+	}
+
+	.edit-chart-node {
+		display: none;
+	}
+
+	.node-edit-icon {
+		display: none;
+	}
+
+	.node-info {
+		display: none;
+	}
+
+	.node-title {
+		display: none;
+	}
+
+	.node-connections {
+		display: none;
+	}
+
+	.node-name {
+		font-size: 0.85rem;
+		line-height: 1.35;
+	}
+
+	.node-image {
+		width: 1.5rem;
+		height: 1.5rem;
+	}
+
+	.node-meta {
+		align-items: baseline;
+	}
+}
+
+// horizontal hierarchy tree view
+#hierarchy-chart-wrapper {
+	padding-top: 30px;
+
+	#arrows {
+		margin-top: -80px;
+	}
+}
+
+.hierarchy {
+	display: flex;
+}
+
+.hierarchy li {
+	list-style-type: none;
+}
+
+.child-node {
+	margin: 0px 0px 16px 0px;
+}
+
+.hierarchy, .hierarchy-mobile {
+	.level {
+		margin-right: 8px;
+		align-items: flex-start;
+		flex-direction: column;
+	}
+}
+
+#arrows {
+	position: absolute;
+	overflow: visible;
+}
+
+.active-connector {
+	stroke: var(--blue-500);
+}
+
+.collapsed-connector {
+	stroke: var(--blue-300);
+}
+
+// mobile
+
+.hierarchy-mobile {
+	display: flex;
+	flex-direction: column;
+	align-items: center;
+	padding-top: 10px;
+	padding-left: 0px;
+}
+
+.hierarchy-mobile li {
+	list-style-type: none;
+	display: flex;
+	flex-direction: column;
+	align-items: flex-end;
+}
+
+.mobile-node {
+	margin-left: 0;
+}
+
+.mobile-node.active-path {
+	width: 12.25rem;
+}
+
+.active-child {
+	width: 15.5rem;
+}
+
+.mobile-node .node-connections {
+	max-width: 80px;
+}
+
+.hierarchy-mobile .node-children {
+	margin-top: 16px;
+}
+
+.root-level .node-card {
+	margin: 0 0 16px;
+}
+
+// node group
+
+.collapsed-level {
+	margin-bottom: 16px;
+	width: 18rem;
+}
+
+.node-group {
+	background: white;
+	border: 1px solid var(--gray-300);
+	box-shadow: var(--shadow-sm);
+	border-radius: 0.5rem;
+	padding: 0.75rem;
+	width: 18rem;
+	height: 3rem;
+	overflow: hidden;
+	align-items: center;
+}
+
+.node-group .avatar-group {
+	margin-left: 0px;
+}
+
+.node-group .avatar-extra-count {
+	background-color: var(--blue-100);
+	color: var(--blue-500);
+}
+
+.node-group .avatar-frame {
+	width: 1.5rem;
+	height: 1.5rem;
+}
+
+.node-group.collapsed {
+	width: 5rem;
+	margin-left: 12px;
+}
+
+.sibling-group {
+	display: flex;
+	flex-direction: column;
+	align-items: center;
+}
\ No newline at end of file
diff --git a/erpnext/quality_management/workspace/quality/quality.json b/erpnext/quality_management/workspace/quality/quality.json
index e5fef43..4dc8129 100644
--- a/erpnext/quality_management/workspace/quality/quality.json
+++ b/erpnext/quality_management/workspace/quality/quality.json
@@ -1,22 +1,27 @@
 {
- "category": "Modules",
+ "category": "",
  "charts": [],
+ "content": "[{\"type\": \"header\", \"data\": {\"text\": \"Your Shortcuts\", \"level\": 4, \"col\": 12}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Quality Goal\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Quality Procedure\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Quality Inspection\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Quality Review\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Quality Action\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Non Conformance\", \"col\": 4}}, {\"type\": \"spacer\", \"data\": {\"col\": 12}}, {\"type\": \"header\", \"data\": {\"text\": \"Reports & Masters\", \"level\": 4, \"col\": 12}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Goal and Procedure\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Feedback\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Meeting\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Review and Action\", \"col\": 4}}]",
  "creation": "2020-03-02 15:49:28.632014",
  "developer_mode_only": 0,
  "disable_user_customization": 0,
  "docstatus": 0,
  "doctype": "Workspace",
+ "extends": "",
  "extends_another_page": 0,
+ "for_user": "",
  "hide_custom": 0,
  "icon": "quality",
  "idx": 0,
- "is_standard": 1,
+ "is_default": 0,
+ "is_standard": 0,
  "label": "Quality",
  "links": [
   {
    "hidden": 0,
    "is_query_report": 0,
    "label": "Goal and Procedure",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -25,6 +30,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Quality Goal",
+   "link_count": 0,
    "link_to": "Quality Goal",
    "link_type": "DocType",
    "onboard": 1,
@@ -35,6 +41,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Quality Procedure",
+   "link_count": 0,
    "link_to": "Quality Procedure",
    "link_type": "DocType",
    "onboard": 1,
@@ -45,6 +52,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Tree of Procedures",
+   "link_count": 0,
    "link_to": "Quality Procedure",
    "link_type": "DocType",
    "onboard": 0,
@@ -54,6 +62,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Feedback",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -62,6 +71,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Quality Feedback",
+   "link_count": 0,
    "link_to": "Quality Feedback",
    "link_type": "DocType",
    "onboard": 1,
@@ -72,6 +82,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Quality Feedback Template",
+   "link_count": 0,
    "link_to": "Quality Feedback Template",
    "link_type": "DocType",
    "onboard": 0,
@@ -81,6 +92,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Meeting",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -89,6 +101,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Quality Meeting",
+   "link_count": 0,
    "link_to": "Quality Meeting",
    "link_type": "DocType",
    "onboard": 0,
@@ -98,6 +111,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Review and Action",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -106,6 +120,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Non Conformance",
+   "link_count": 0,
    "link_to": "Non Conformance",
    "link_type": "DocType",
    "onboard": 0,
@@ -116,6 +131,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Quality Review",
+   "link_count": 0,
    "link_to": "Quality Review",
    "link_type": "DocType",
    "onboard": 0,
@@ -126,19 +142,26 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Quality Action",
+   "link_count": 0,
    "link_to": "Quality Action",
    "link_type": "DocType",
    "onboard": 0,
    "type": "Link"
   }
  ],
- "modified": "2020-12-01 13:38:35.120213",
+ "modified": "2021-08-05 12:16:01.699912",
  "modified_by": "Administrator",
  "module": "Quality Management",
  "name": "Quality",
+ "onboarding": "",
  "owner": "Administrator",
+ "parent_page": "",
  "pin_to_bottom": 0,
  "pin_to_top": 0,
+ "public": 1,
+ "restrict_to_domain": "",
+ "roles": [],
+ "sequence_id": 21,
  "shortcuts": [
   {
    "color": "Grey",
@@ -186,5 +209,6 @@
    "stats_filter": "{\"status\": \"Open\"}",
    "type": "DocType"
   }
- ]
+ ],
+ "title": "Quality"
 }
\ No newline at end of file
diff --git a/erpnext/regional/india/e_invoice/utils.py b/erpnext/regional/india/e_invoice/utils.py
index 4276946..fa7e88d 100644
--- a/erpnext/regional/india/e_invoice/utils.py
+++ b/erpnext/regional/india/e_invoice/utils.py
@@ -190,8 +190,10 @@
 		item.description = sanitize_for_json(d.item_name)
 
 		item.qty = abs(item.qty)
-
-		item.unit_rate = abs(item.taxable_value / item.qty)
+		if flt(item.qty) != 0.0:
+			item.unit_rate = abs(item.taxable_value / item.qty)
+		else:
+			item.unit_rate = abs(item.taxable_value)
 		item.gross_amount = abs(item.taxable_value)
 		item.taxable_value = abs(item.taxable_value)
 		item.discount_amount = 0
diff --git a/erpnext/regional/india/setup.py b/erpnext/regional/india/setup.py
index b4f146c..2d6b913 100644
--- a/erpnext/regional/india/setup.py
+++ b/erpnext/regional/india/setup.py
@@ -642,7 +642,8 @@
 				'fieldtype': 'Select',
 				'insert_after': 'gst_category',
 				'depends_on':'eval:in_list(["SEZ", "Overseas"], doc.gst_category)',
-				'options': '\nWith Payment of Tax\nWithout Payment of Tax'
+				'options': '\nWith Payment of Tax\nWithout Payment of Tax',
+				'mandatory_depends_on': 'eval:in_list(["SEZ", "Overseas"], doc.gst_category)'
 			}
 		],
 		'Customer': [
@@ -660,7 +661,8 @@
 				'fieldtype': 'Select',
 				'insert_after': 'gst_category',
 				'depends_on':'eval:in_list(["SEZ", "Overseas", "Deemed Export"], doc.gst_category)',
-				'options': '\nWith Payment of Tax\nWithout Payment of Tax'
+				'options': '\nWith Payment of Tax\nWithout Payment of Tax',
+				'mandatory_depends_on': 'eval:in_list(["SEZ", "Overseas", "Deemed Export"], doc.gst_category)'
 			}
 		],
 		'Member': [
diff --git a/erpnext/regional/print_format/detailed_tax_invoice/detailed_tax_invoice.json b/erpnext/regional/print_format/detailed_tax_invoice/detailed_tax_invoice.json
index ab56c6b..f67e245 100644
--- a/erpnext/regional/print_format/detailed_tax_invoice/detailed_tax_invoice.json
+++ b/erpnext/regional/print_format/detailed_tax_invoice/detailed_tax_invoice.json
@@ -16,7 +16,7 @@
  "name": "Detailed Tax Invoice", 
  "owner": "Administrator", 
  "print_format_builder": 1, 
- "print_format_type": "Server", 
+ "print_format_type": "Jinja", 
  "show_section_headings": 0, 
  "standard": "Yes"
 }
\ No newline at end of file
diff --git a/erpnext/regional/print_format/gst_tax_invoice/gst_tax_invoice.json b/erpnext/regional/print_format/gst_tax_invoice/gst_tax_invoice.json
index 7d8e675..b23206b 100644
--- a/erpnext/regional/print_format/gst_tax_invoice/gst_tax_invoice.json
+++ b/erpnext/regional/print_format/gst_tax_invoice/gst_tax_invoice.json
@@ -16,7 +16,7 @@
  "name": "GST Tax Invoice", 
  "owner": "Administrator", 
  "print_format_builder": 1, 
- "print_format_type": "Server", 
+ "print_format_type": "Jinja", 
  "show_section_headings": 0, 
  "standard": "Yes"
 }
\ No newline at end of file
diff --git a/erpnext/regional/print_format/simplified_tax_invoice/simplified_tax_invoice.json b/erpnext/regional/print_format/simplified_tax_invoice/simplified_tax_invoice.json
index b324f6e..aed2e89 100644
--- a/erpnext/regional/print_format/simplified_tax_invoice/simplified_tax_invoice.json
+++ b/erpnext/regional/print_format/simplified_tax_invoice/simplified_tax_invoice.json
@@ -16,7 +16,7 @@
  "name": "Simplified Tax Invoice", 
  "owner": "Administrator", 
  "print_format_builder": 1, 
- "print_format_type": "Server", 
+ "print_format_type": "Jinja", 
  "show_section_headings": 0, 
  "standard": "Yes"
 }
\ No newline at end of file
diff --git a/erpnext/regional/print_format/tax_invoice/tax_invoice.json b/erpnext/regional/print_format/tax_invoice/tax_invoice.json
index 74db067..7479891 100644
--- a/erpnext/regional/print_format/tax_invoice/tax_invoice.json
+++ b/erpnext/regional/print_format/tax_invoice/tax_invoice.json
@@ -16,7 +16,7 @@
  "name": "Tax Invoice", 
  "owner": "Administrator", 
  "print_format_builder": 1, 
- "print_format_type": "Server", 
+ "print_format_type": "Jinja", 
  "show_section_headings": 0, 
  "standard": "Yes"
 }
\ No newline at end of file
diff --git a/erpnext/selling/doctype/sales_order/sales_order.py b/erpnext/selling/doctype/sales_order/sales_order.py
index 41f57a3..bba5401 100755
--- a/erpnext/selling/doctype/sales_order/sales_order.py
+++ b/erpnext/selling/doctype/sales_order/sales_order.py
@@ -670,6 +670,7 @@
 				"party_account_currency": "party_account_currency",
 				"payment_terms_template": "payment_terms_template"
 			},
+			"field_no_map": ["payment_terms_template"],
 			"validation": {
 				"docstatus": ["=", 1]
 			}
@@ -693,6 +694,10 @@
 		}
 	}, target_doc, postprocess, ignore_permissions=ignore_permissions)
 
+	automatically_fetch_payment_terms = cint(frappe.db.get_single_value('Accounts Settings', 'automatically_fetch_payment_terms'))
+	if automatically_fetch_payment_terms:
+		doclist.set_payment_schedule()
+
 	return doclist
 
 @frappe.whitelist()
diff --git a/erpnext/selling/doctype/sales_order/test_sales_order.py b/erpnext/selling/doctype/sales_order/test_sales_order.py
index 974648d..a0a21ee 100644
--- a/erpnext/selling/doctype/sales_order/test_sales_order.py
+++ b/erpnext/selling/doctype/sales_order/test_sales_order.py
@@ -5,7 +5,7 @@
 import unittest
 import frappe
 import frappe.permissions
-from frappe.utils import flt, add_days, nowdate
+from frappe.utils import flt, add_days, nowdate, getdate
 from frappe.core.doctype.user_permission.test_user_permission import create_user
 from erpnext.selling.doctype.sales_order.sales_order \
 	import make_material_request, make_delivery_note, make_sales_invoice, WarehouseRequired
@@ -673,6 +673,8 @@
 
 		so.cancel()
 
+		dn.load_from_db()
+
 		self.assertRaises(frappe.CancelledLinkError, dn.submit)
 
 	def test_service_type_product_bundle(self):
@@ -1229,7 +1231,38 @@
 
 		self.assertRaises(frappe.ValidationError, so.cancel)
 
+	def test_payment_terms_are_fetched_when_creating_sales_invoice(self):
+		from erpnext.accounts.doctype.payment_entry.test_payment_entry import create_payment_terms_template
+		from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice
 
+		automatically_fetch_payment_terms()
+
+		so = make_sales_order(uom="Nos", do_not_save=1)
+		create_payment_terms_template()
+		so.payment_terms_template = 'Test Receivable Template'
+		so.submit()
+
+		si = create_sales_invoice(qty=10, do_not_save=1)
+		si.items[0].sales_order = so.name
+		si.items[0].so_detail = so.items[0].name
+		si.insert()
+
+		self.assertEqual(so.payment_terms_template, si.payment_terms_template)
+		compare_payment_schedules(self, so, si)
+
+		automatically_fetch_payment_terms(enable=0)		
+
+def automatically_fetch_payment_terms(enable=1):
+	accounts_settings = frappe.get_doc("Accounts Settings")
+	accounts_settings.automatically_fetch_payment_terms = enable
+	accounts_settings.save()
+
+def compare_payment_schedules(doc, doc1, doc2):
+	for index, schedule in enumerate(doc1.get('payment_schedule')):
+		doc.assertEqual(schedule.payment_term, doc2.payment_schedule[index].payment_term)
+		doc.assertEqual(getdate(schedule.due_date), doc2.payment_schedule[index].due_date)
+		doc.assertEqual(schedule.invoice_portion, doc2.payment_schedule[index].invoice_portion)
+		doc.assertEqual(schedule.payment_amount, doc2.payment_schedule[index].payment_amount)
 
 def make_sales_order(**args):
 	so = frappe.new_doc("Sales Order")
diff --git a/erpnext/selling/workspace/retail/retail.json b/erpnext/selling/workspace/retail/retail.json
index e20f834..9d2e6ca 100644
--- a/erpnext/selling/workspace/retail/retail.json
+++ b/erpnext/selling/workspace/retail/retail.json
@@ -1,22 +1,27 @@
 {
- "category": "Domains",
+ "category": "",
  "charts": [],
+ "content": "[{\"type\": \"header\", \"data\": {\"text\": \"Your Shortcuts\", \"level\": 4, \"col\": 12}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Point Of Sale\", \"col\": 4}}, {\"type\": \"spacer\", \"data\": {\"col\": 12}}, {\"type\": \"header\", \"data\": {\"text\": \"Reports & Masters\", \"level\": 4, \"col\": 12}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Settings & Configurations\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Loyalty Program\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Opening & Closing\", \"col\": 4}}]",
  "creation": "2020-03-02 17:18:32.505616",
  "developer_mode_only": 0,
  "disable_user_customization": 0,
  "docstatus": 0,
  "doctype": "Workspace",
+ "extends": "",
  "extends_another_page": 0,
+ "for_user": "",
  "hide_custom": 0,
  "icon": "retail",
  "idx": 0,
- "is_standard": 1,
+ "is_default": 0,
+ "is_standard": 0,
  "label": "Retail",
  "links": [
   {
    "hidden": 0,
    "is_query_report": 0,
    "label": "Settings & Configurations",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -25,6 +30,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Point-of-Sale Profile",
+   "link_count": 0,
    "link_to": "POS Profile",
    "link_type": "DocType",
    "onboard": 1,
@@ -35,6 +41,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "POS Settings",
+   "link_count": 0,
    "link_to": "POS Settings",
    "link_type": "DocType",
    "onboard": 0,
@@ -44,6 +51,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Loyalty Program",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -52,6 +60,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Loyalty Program",
+   "link_count": 0,
    "link_to": "Loyalty Program",
    "link_type": "DocType",
    "onboard": 0,
@@ -62,6 +71,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Loyalty Point Entry",
+   "link_count": 0,
    "link_to": "Loyalty Point Entry",
    "link_type": "DocType",
    "onboard": 0,
@@ -71,6 +81,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Opening & Closing",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -79,6 +90,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "POS Opening Entry",
+   "link_count": 0,
    "link_to": "POS Opening Entry",
    "link_type": "DocType",
    "onboard": 0,
@@ -89,20 +101,26 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "POS Closing Entry",
+   "link_count": 0,
    "link_to": "POS Closing Entry",
    "link_type": "DocType",
    "onboard": 0,
    "type": "Link"
   }
  ],
- "modified": "2020-12-01 13:38:36.758038",
+ "modified": "2021-08-05 12:16:01.840988",
  "modified_by": "Administrator",
  "module": "Selling",
  "name": "Retail",
+ "onboarding": "",
  "owner": "Administrator",
+ "parent_page": "",
  "pin_to_bottom": 0,
  "pin_to_top": 0,
+ "public": 1,
  "restrict_to_domain": "Retail",
+ "roles": [],
+ "sequence_id": 22,
  "shortcuts": [
   {
    "doc_view": "",
@@ -110,5 +128,6 @@
    "link_to": "point-of-sale",
    "type": "Page"
   }
- ]
+ ],
+ "title": "Retail"
 }
\ No newline at end of file
diff --git a/erpnext/selling/workspace/selling/selling.json b/erpnext/selling/workspace/selling/selling.json
index 879034a..345187f 100644
--- a/erpnext/selling/workspace/selling/selling.json
+++ b/erpnext/selling/workspace/selling/selling.json
@@ -1,5 +1,5 @@
 {
- "category": "Modules",
+ "category": "",
  "charts": [
   {
    "chart_name": "Sales Order Trends",
@@ -7,22 +7,27 @@
   }
  ],
  "charts_label": "Selling ",
+ "content": "[{\"type\": \"onboarding\", \"data\": {\"onboarding_name\":\"Selling\", \"col\": 12}}, {\"type\": \"chart\", \"data\": {\"chart_name\": \"Sales Order Trends\", \"col\": 12}}, {\"type\": \"spacer\", \"data\": {\"col\": 12}}, {\"type\": \"header\", \"data\": {\"text\": \"Quick Access\", \"level\": 4, \"col\": 12}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Item\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Sales Order\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Sales Analytics\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Sales Order Analysis\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Dashboard\", \"col\": 4}}, {\"type\": \"spacer\", \"data\": {\"col\": 12}}, {\"type\": \"header\", \"data\": {\"text\": \"Reports & Masters\", \"level\": 4, \"col\": 12}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Selling\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Items and Pricing\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Settings\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Key Reports\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Other Reports\", \"col\": 4}}]",
  "creation": "2020-01-28 11:49:12.092882",
  "developer_mode_only": 0,
  "disable_user_customization": 0,
  "docstatus": 0,
  "doctype": "Workspace",
+ "extends": "",
  "extends_another_page": 0,
- "hide_custom": 1,
+ "for_user": "",
+ "hide_custom": 0,
  "icon": "sell",
  "idx": 0,
- "is_standard": 1,
+ "is_default": 0,
+ "is_standard": 0,
  "label": "Selling",
  "links": [
   {
    "hidden": 0,
    "is_query_report": 0,
    "label": "Selling",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -31,6 +36,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Customer",
+   "link_count": 0,
    "link_to": "Customer",
    "link_type": "DocType",
    "onboard": 1,
@@ -41,6 +47,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Quotation",
+   "link_count": 0,
    "link_to": "Quotation",
    "link_type": "DocType",
    "onboard": 1,
@@ -51,6 +58,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Sales Order",
+   "link_count": 0,
    "link_to": "Sales Order",
    "link_type": "DocType",
    "onboard": 1,
@@ -61,6 +69,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Sales Invoice",
+   "link_count": 0,
    "link_to": "Sales Invoice",
    "link_type": "DocType",
    "onboard": 1,
@@ -71,6 +80,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Blanket Order",
+   "link_count": 0,
    "link_to": "Blanket Order",
    "link_type": "DocType",
    "onboard": 1,
@@ -81,6 +91,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Sales Partner",
+   "link_count": 0,
    "link_to": "Sales Partner",
    "link_type": "DocType",
    "onboard": 0,
@@ -91,6 +102,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Sales Person",
+   "link_count": 0,
    "link_to": "Sales Person",
    "link_type": "DocType",
    "onboard": 0,
@@ -100,6 +112,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Items and Pricing",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -108,6 +121,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Item",
+   "link_count": 0,
    "link_to": "Item",
    "link_type": "DocType",
    "onboard": 1,
@@ -118,6 +132,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Item Price",
+   "link_count": 0,
    "link_to": "Item Price",
    "link_type": "DocType",
    "onboard": 1,
@@ -128,6 +143,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Price List",
+   "link_count": 0,
    "link_to": "Price List",
    "link_type": "DocType",
    "onboard": 1,
@@ -138,6 +154,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Item Group",
+   "link_count": 0,
    "link_to": "Item Group",
    "link_type": "DocType",
    "onboard": 1,
@@ -148,6 +165,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Product Bundle",
+   "link_count": 0,
    "link_to": "Product Bundle",
    "link_type": "DocType",
    "onboard": 0,
@@ -158,6 +176,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Promotional Scheme",
+   "link_count": 0,
    "link_to": "Promotional Scheme",
    "link_type": "DocType",
    "onboard": 0,
@@ -168,6 +187,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Pricing Rule",
+   "link_count": 0,
    "link_to": "Pricing Rule",
    "link_type": "DocType",
    "onboard": 0,
@@ -178,6 +198,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Shipping Rule",
+   "link_count": 0,
    "link_to": "Shipping Rule",
    "link_type": "DocType",
    "onboard": 0,
@@ -188,6 +209,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Coupon Code",
+   "link_count": 0,
    "link_to": "Coupon Code",
    "link_type": "DocType",
    "onboard": 0,
@@ -197,6 +219,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Settings",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -205,6 +228,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Selling Settings",
+   "link_count": 0,
    "link_to": "Selling Settings",
    "link_type": "DocType",
    "onboard": 0,
@@ -215,6 +239,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Terms and Conditions Template",
+   "link_count": 0,
    "link_to": "Terms and Conditions",
    "link_type": "DocType",
    "onboard": 1,
@@ -225,6 +250,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Sales Taxes and Charges Template",
+   "link_count": 0,
    "link_to": "Sales Taxes and Charges Template",
    "link_type": "DocType",
    "onboard": 1,
@@ -235,6 +261,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Lead Source",
+   "link_count": 0,
    "link_to": "Lead Source",
    "link_type": "DocType",
    "onboard": 0,
@@ -245,6 +272,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Customer Group",
+   "link_count": 0,
    "link_to": "Customer Group",
    "link_type": "DocType",
    "onboard": 0,
@@ -255,6 +283,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Contact",
+   "link_count": 0,
    "link_to": "Contact",
    "link_type": "DocType",
    "onboard": 0,
@@ -265,6 +294,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Address",
+   "link_count": 0,
    "link_to": "Address",
    "link_type": "DocType",
    "onboard": 0,
@@ -275,6 +305,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Territory",
+   "link_count": 0,
    "link_to": "Territory",
    "link_type": "DocType",
    "onboard": 0,
@@ -285,6 +316,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Campaign",
+   "link_count": 0,
    "link_to": "Campaign",
    "link_type": "DocType",
    "onboard": 0,
@@ -294,6 +326,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Key Reports",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -302,6 +335,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Sales Analytics",
+   "link_count": 0,
    "link_to": "Sales Analytics",
    "link_type": "Report",
    "onboard": 1,
@@ -312,6 +346,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Sales Order Analysis",
+   "link_count": 0,
    "link_to": "Sales Order Analysis",
    "link_type": "Report",
    "onboard": 1,
@@ -322,6 +357,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Sales Funnel",
+   "link_count": 0,
    "link_to": "sales-funnel",
    "link_type": "Page",
    "onboard": 1,
@@ -332,6 +368,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Sales Order Trends",
+   "link_count": 0,
    "link_to": "Sales Order Trends",
    "link_type": "Report",
    "onboard": 0,
@@ -342,6 +379,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Quotation Trends",
+   "link_count": 0,
    "link_to": "Quotation Trends",
    "link_type": "Report",
    "onboard": 0,
@@ -352,6 +390,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Customer Acquisition and Loyalty",
+   "link_count": 0,
    "link_to": "Customer Acquisition and Loyalty",
    "link_type": "Report",
    "onboard": 0,
@@ -362,6 +401,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Inactive Customers",
+   "link_count": 0,
    "link_to": "Inactive Customers",
    "link_type": "Report",
    "onboard": 0,
@@ -372,6 +412,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Sales Person-wise Transaction Summary",
+   "link_count": 0,
    "link_to": "Sales Person-wise Transaction Summary",
    "link_type": "Report",
    "onboard": 0,
@@ -382,6 +423,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Item-wise Sales History",
+   "link_count": 0,
    "link_to": "Item-wise Sales History",
    "link_type": "Report",
    "onboard": 0,
@@ -391,6 +433,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Other Reports",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -399,6 +442,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Lead Details",
+   "link_count": 0,
    "link_to": "Lead Details",
    "link_type": "Report",
    "onboard": 0,
@@ -409,6 +453,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Customer Addresses And Contacts",
+   "link_count": 0,
    "link_to": "Address And Contacts",
    "link_type": "Report",
    "onboard": 0,
@@ -419,6 +464,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Available Stock for Packing Items",
+   "link_count": 0,
    "link_to": "Available Stock for Packing Items",
    "link_type": "Report",
    "onboard": 0,
@@ -429,6 +475,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Pending SO Items For Purchase Request",
+   "link_count": 0,
    "link_to": "Pending SO Items For Purchase Request",
    "link_type": "Report",
    "onboard": 0,
@@ -439,6 +486,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Delivery Note Trends",
+   "link_count": 0,
    "link_to": "Delivery Note Trends",
    "link_type": "Report",
    "onboard": 0,
@@ -449,6 +497,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Sales Invoice Trends",
+   "link_count": 0,
    "link_to": "Sales Invoice Trends",
    "link_type": "Report",
    "onboard": 0,
@@ -459,6 +508,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Customer Credit Balance",
+   "link_count": 0,
    "link_to": "Customer Credit Balance",
    "link_type": "Report",
    "onboard": 0,
@@ -469,6 +519,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Customers Without Any Sales Transactions",
+   "link_count": 0,
    "link_to": "Customers Without Any Sales Transactions",
    "link_type": "Report",
    "onboard": 0,
@@ -479,6 +530,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Sales Partners Commission",
+   "link_count": 0,
    "link_to": "Sales Partners Commission",
    "link_type": "Report",
    "onboard": 0,
@@ -489,6 +541,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Territory Target Variance Based On Item Group",
+   "link_count": 0,
    "link_to": "Territory Target Variance Based On Item Group",
    "link_type": "Report",
    "onboard": 0,
@@ -499,6 +552,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Sales Person Target Variance Based On Item Group",
+   "link_count": 0,
    "link_to": "Sales Person Target Variance Based On Item Group",
    "link_type": "Report",
    "onboard": 0,
@@ -509,20 +563,26 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Sales Partner Target Variance Based On Item Group",
+   "link_count": 0,
    "link_to": "Sales Partner Target Variance based on Item Group",
    "link_type": "Report",
    "onboard": 0,
    "type": "Link"
   }
  ],
- "modified": "2020-12-01 13:38:35.971277",
+ "modified": "2021-08-05 12:16:01.990702",
  "modified_by": "Administrator",
  "module": "Selling",
  "name": "Selling",
  "onboarding": "Selling",
  "owner": "Administrator",
+ "parent_page": "",
  "pin_to_bottom": 0,
  "pin_to_top": 0,
+ "public": 1,
+ "restrict_to_domain": "",
+ "roles": [],
+ "sequence_id": 23,
  "shortcuts": [
   {
    "color": "Grey",
@@ -559,5 +619,6 @@
    "type": "Dashboard"
   }
  ],
- "shortcuts_label": "Quick Access"
+ "shortcuts_label": "Quick Access",
+ "title": "Selling"
 }
\ No newline at end of file
diff --git a/erpnext/setup/doctype/email_digest/email_digest.js b/erpnext/setup/doctype/email_digest/email_digest.js
index 1071ea2..2e415af 100644
--- a/erpnext/setup/doctype/email_digest/email_digest.js
+++ b/erpnext/setup/doctype/email_digest/email_digest.js
@@ -1,78 +1,31 @@
 // Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
-cur_frm.cscript.refresh = function(doc, dt, dn) {
-	doc = locals[dt][dn];
-	cur_frm.add_custom_button(__('View Now'), function() {
-		frappe.call({
-			method: 'erpnext.setup.doctype.email_digest.email_digest.get_digest_msg',
-			args: {
-				name: doc.name
-			},
-			callback: function(r) {
-				var d = new frappe.ui.Dialog({
-					title: __('Email Digest: ') + dn,
-					width: 800
+frappe.ui.form.on("Email Digest", {
+	refresh: function(frm) {
+		if (!frm.is_new()) {
+			frm.add_custom_button(__('View Now'), function() {
+				frappe.call({
+					method: 'erpnext.setup.doctype.email_digest.email_digest.get_digest_msg',
+					args: {
+						name: frm.doc.name
+					},
+					callback: function(r) {
+						let d = new frappe.ui.Dialog({
+							title: __('Email Digest: {0}', [frm.doc.name]),
+							width: 800
+						});
+						$(d.body).html(r.message);
+						d.show();
+					}
 				});
-				$(d.body).html(r.message);
-				d.show();
-			}
-		});
-	}, "fa fa-eye-open", "btn-default");
-
-	if (!cur_frm.is_new()) {
-		cur_frm.add_custom_button(__('Send Now'), function() {
-			return cur_frm.call('send', null, (r) => {
-				frappe.show_alert(__('Message Sent'));
 			});
-		});
+
+			frm.add_custom_button(__('Send Now'), function() {
+				return frm.call('send', null, () => {
+					frappe.show_alert({ message: __("Message Sent"), indicator: 'green'});
+				});
+			});
+		}
 	}
-};
-
-cur_frm.cscript.addremove_recipients = function(doc, dt, dn) {
-	// Get user list
-
-	return cur_frm.call('get_users', null, function(r) {
-		// Open a dialog and display checkboxes against email addresses
-		doc = locals[dt][dn];
-		var d = new frappe.ui.Dialog({
-			title: __('Add/Remove Recipients'),
-			width: 400
-		});
-
-		$.each(r.user_list, function(i, v) {
-			var fullname = frappe.user.full_name(v.name);
-			if(fullname !== v.name) fullname = fullname + " &lt;" + v.name + "&gt;";
-
-			if(v.enabled==0) {
-				fullname = repl("<span style='color: red'> %(name)s (" + __("disabled user") + ")</span>", {name: v.name});
-			}
-
-			$('<div class="checkbox"><label>\
-				<input type="checkbox" data-id="' + v.name + '"'+
-					(v.checked ? 'checked' : '') +
-			'> '+ fullname +'</label></div>').appendTo(d.body);
-		});
-
-		// Display add recipients button
-		d.set_primary_action("Update", function() {
-			cur_frm.cscript.add_to_rec_list(doc, d.body, r.user_list.length);
-		});
-
-		cur_frm.rec_dialog = d;
-		d.show();
-	});
-}
-
-cur_frm.cscript.add_to_rec_list = function(doc, dialog, length) {
-	// add checked users to list of recipients
-	var rec_list = [];
-	$(dialog).find('input:checked').each(function(i, input) {
-		rec_list.push($(input).attr('data-id'));
-	});
-
-	doc.recipient_list = rec_list.join('\n');
-	cur_frm.rec_dialog.hide();
-	cur_frm.save();
-	cur_frm.refresh_fields();
-}
+});
\ No newline at end of file
diff --git a/erpnext/setup/doctype/email_digest/email_digest.json b/erpnext/setup/doctype/email_digest/email_digest.json
index 125aca1..06c98e5 100644
--- a/erpnext/setup/doctype/email_digest/email_digest.json
+++ b/erpnext/setup/doctype/email_digest/email_digest.json
@@ -1,1482 +1,338 @@
 {
- "allow_copy": 0, 
- "allow_events_in_timeline": 0, 
- "allow_guest_to_view": 0, 
- "allow_import": 0, 
- "allow_rename": 0, 
- "autoname": "Prompt", 
- "beta": 0, 
- "creation": "2018-09-16 22:00:00", 
- "custom": 0, 
- "description": "Send regular summary reports via Email.", 
- "docstatus": 0, 
- "doctype": "DocType", 
- "document_type": "System", 
- "editable_grid": 0, 
+ "actions": [],
+ "autoname": "Prompt",
+ "creation": "2018-09-16 22:00:00",
+ "description": "Send regular summary reports via Email.",
+ "doctype": "DocType",
+ "document_type": "System",
+ "engine": "InnoDB",
+ "field_order": [
+  "settings",
+  "column_break0",
+  "enabled",
+  "company",
+  "frequency",
+  "next_send",
+  "column_break1",
+  "recipients",
+  "accounts",
+  "accounts_module",
+  "income",
+  "expenses_booked",
+  "income_year_to_date",
+  "expense_year_to_date",
+  "column_break_16",
+  "bank_balance",
+  "credit_balance",
+  "invoiced_amount",
+  "payables",
+  "work_in_progress",
+  "sales_orders_to_bill",
+  "purchase_orders_to_bill",
+  "operation",
+  "column_break_21",
+  "sales_order",
+  "purchase_order",
+  "sales_orders_to_deliver",
+  "purchase_orders_to_receive",
+  "sales_invoice",
+  "purchase_invoice",
+  "column_break_operation",
+  "new_quotations",
+  "pending_quotations",
+  "issue",
+  "project",
+  "purchase_orders_items_overdue",
+  "other",
+  "tools",
+  "calendar_events",
+  "todo_list",
+  "notifications",
+  "column_break_32",
+  "add_quote"
+ ],
  "fields": [
   {
-   "allow_bulk_edit": 0, 
-   "allow_in_quick_entry": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "settings", 
-   "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": "Email Digest Settings", 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "translatable": 0, 
-   "unique": 0
-  }, 
+   "fieldname": "settings",
+   "fieldtype": "Section Break",
+   "label": "Email Digest Settings"
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_in_quick_entry": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "column_break0", 
-   "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, 
-   "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
-  }, 
+   "fieldname": "column_break0",
+   "fieldtype": "Column Break"
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_in_quick_entry": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "enabled", 
-   "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": "Enabled", 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "translatable": 0, 
-   "unique": 0
-  }, 
+   "default": "0",
+   "fieldname": "enabled",
+   "fieldtype": "Check",
+   "in_list_view": 1,
+   "label": "Enabled"
+  },
   {
-   "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": "For Company", 
-   "length": 0, 
-   "no_copy": 0, 
-   "options": "Company", 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 1, 
-   "report_hide": 0, 
-   "reqd": 1, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "translatable": 0, 
-   "unique": 0
-  }, 
+   "fieldname": "company",
+   "fieldtype": "Link",
+   "in_list_view": 1,
+   "in_standard_filter": 1,
+   "label": "For Company",
+   "options": "Company",
+   "remember_last_selected_value": 1,
+   "reqd": 1
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_in_quick_entry": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "frequency", 
-   "fieldtype": "Select", 
-   "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": "How frequently?", 
-   "length": 0, 
-   "no_copy": 0, 
-   "options": "Daily\nWeekly\nMonthly", 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 1, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "translatable": 0, 
-   "unique": 0
-  }, 
+   "fieldname": "frequency",
+   "fieldtype": "Select",
+   "in_list_view": 1,
+   "in_standard_filter": 1,
+   "label": "How frequently?",
+   "options": "Daily\nWeekly\nMonthly",
+   "reqd": 1
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_in_quick_entry": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "depends_on": "eval:doc.enabled", 
-   "fieldname": "next_send", 
-   "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": "Next email will be sent on:", 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "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
-  }, 
+   "depends_on": "eval:doc.enabled",
+   "fieldname": "next_send",
+   "fieldtype": "Data",
+   "label": "Next email will be sent on:",
+   "read_only": 1
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_in_quick_entry": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "column_break1", 
-   "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, 
-   "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
-  }, 
+   "fieldname": "column_break1",
+   "fieldtype": "Column Break"
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_in_quick_entry": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "description": "Note: Email will not be sent to disabled users", 
-   "fieldname": "recipient_list", 
-   "fieldtype": "Code", 
-   "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": "Recipients", 
-   "length": 0, 
-   "no_copy": 0, 
-   "options": "Email", 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 1, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 1, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "translatable": 0, 
-   "unique": 0
-  }, 
+   "fieldname": "accounts",
+   "fieldtype": "Section Break",
+   "label": "Accounts"
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_in_quick_entry": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "addremove_recipients", 
-   "fieldtype": "Button", 
-   "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": "Add/Remove Recipients", 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "translatable": 0, 
-   "unique": 0
-  }, 
+   "fieldname": "accounts_module",
+   "fieldtype": "Column Break",
+   "hidden": 1,
+   "label": "Profit & Loss"
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_in_quick_entry": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "accounts", 
-   "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": "Accounts", 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "translatable": 0, 
-   "unique": 0
-  }, 
+   "default": "0",
+   "fieldname": "income",
+   "fieldtype": "Check",
+   "label": "New Income"
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_in_quick_entry": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "accounts_module", 
-   "fieldtype": "Column Break", 
-   "hidden": 1, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "Profit & Loss", 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "translatable": 0, 
-   "unique": 0
-  }, 
+   "default": "0",
+   "fieldname": "expenses_booked",
+   "fieldtype": "Check",
+   "label": "New Expenses"
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_in_quick_entry": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "description": "", 
-   "fieldname": "income", 
-   "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": "New Income", 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "translatable": 0, 
-   "unique": 0
-  }, 
+   "default": "0",
+   "fieldname": "income_year_to_date",
+   "fieldtype": "Check",
+   "label": "Annual Income"
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_in_quick_entry": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "description": "", 
-   "fieldname": "expenses_booked", 
-   "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": "New Expenses", 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "translatable": 0, 
-   "unique": 0
-  }, 
+   "default": "0",
+   "fieldname": "expense_year_to_date",
+   "fieldtype": "Check",
+   "label": "Annual Expenses"
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_in_quick_entry": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "income_year_to_date", 
-   "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": "Annual Income", 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "translatable": 0, 
-   "unique": 0
-  }, 
+   "fieldname": "column_break_16",
+   "fieldtype": "Column Break",
+   "label": "Balance Sheet"
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_in_quick_entry": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "expense_year_to_date", 
-   "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": "Annual Expenses", 
-   "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
-  }, 
+   "default": "0",
+   "fieldname": "bank_balance",
+   "fieldtype": "Check",
+   "label": "Bank Balance"
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_in_quick_entry": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "description": "", 
-   "fieldname": "column_break_16", 
-   "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": "Balance Sheet", 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "translatable": 0, 
-   "unique": 0
-  }, 
+   "default": "0",
+   "fieldname": "credit_balance",
+   "fieldtype": "Check",
+   "label": "Bank Credit Balance"
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_in_quick_entry": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "description": "", 
-   "fieldname": "bank_balance", 
-   "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": "Bank Balance", 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "translatable": 0, 
-   "unique": 0
-  }, 
+   "default": "0",
+   "fieldname": "invoiced_amount",
+   "fieldtype": "Check",
+   "label": "Receivables"
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_in_quick_entry": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "credit_balance", 
-   "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": "Bank Credit Balance", 
-   "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
-  }, 
+   "default": "0",
+   "fieldname": "payables",
+   "fieldtype": "Check",
+   "label": "Payables"
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_in_quick_entry": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "description": "", 
-   "fieldname": "invoiced_amount", 
-   "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": "Receivables", 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "translatable": 0, 
-   "unique": 0
-  }, 
+   "fieldname": "work_in_progress",
+   "fieldtype": "Column Break",
+   "label": "Work in Progress"
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_in_quick_entry": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "description": "", 
-   "fieldname": "payables", 
-   "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": "Payables", 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "translatable": 0, 
-   "unique": 0
-  }, 
+   "default": "0",
+   "fieldname": "sales_orders_to_bill",
+   "fieldtype": "Check",
+   "label": "Sales Orders to Bill"
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_in_quick_entry": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "work_in_progress", 
-   "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": "Work in Progress", 
-   "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
-  }, 
+   "default": "0",
+   "fieldname": "purchase_orders_to_bill",
+   "fieldtype": "Check",
+   "label": "Purchase Orders to Bill"
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_in_quick_entry": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "sales_orders_to_bill", 
-   "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": "Sales Orders to Bill", 
-   "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
-  }, 
+   "fieldname": "operation",
+   "fieldtype": "Section Break",
+   "label": "Operations"
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_in_quick_entry": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "purchase_orders_to_bill", 
-   "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": "Purchase Orders to Bill", 
-   "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
-  }, 
+   "fieldname": "column_break_21",
+   "fieldtype": "Column Break"
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_in_quick_entry": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "operation", 
-   "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": "Operations", 
-   "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
-  }, 
+   "default": "0",
+   "fieldname": "sales_order",
+   "fieldtype": "Check",
+   "label": "New Sales Orders"
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_in_quick_entry": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "column_break_21", 
-   "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
-  }, 
+   "default": "0",
+   "fieldname": "purchase_order",
+   "fieldtype": "Check",
+   "label": "New Purchase Orders"
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_in_quick_entry": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "sales_order", 
-   "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": "New Sales Orders", 
-   "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
-  }, 
+   "default": "0",
+   "fieldname": "sales_orders_to_deliver",
+   "fieldtype": "Check",
+   "label": "Sales Orders to Deliver"
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_in_quick_entry": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "purchase_order", 
-   "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": "New Purchase Orders", 
-   "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
-  }, 
+   "default": "0",
+   "fieldname": "purchase_orders_to_receive",
+   "fieldtype": "Check",
+   "label": "Purchase Orders to Receive"
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_in_quick_entry": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "sales_orders_to_deliver", 
-   "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": "Sales Orders to Deliver", 
-   "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
-  }, 
+   "default": "0",
+   "fieldname": "sales_invoice",
+   "fieldtype": "Check",
+   "label": "New Sales Invoice"
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_in_quick_entry": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "purchase_orders_to_receive", 
-   "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": "Purchase Orders to Receive", 
-   "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
-  }, 
+   "default": "0",
+   "fieldname": "purchase_invoice",
+   "fieldtype": "Check",
+   "label": "New Purchase Invoice"
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_in_quick_entry": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "sales_invoice", 
-   "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": "New Sales Invoice", 
-   "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
-  }, 
+   "fieldname": "column_break_operation",
+   "fieldtype": "Column Break"
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_in_quick_entry": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "purchase_invoice", 
-   "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": "New Purchase Invoice", 
-   "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
-  }, 
+   "default": "0",
+   "fieldname": "new_quotations",
+   "fieldtype": "Check",
+   "label": "New Quotations"
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_in_quick_entry": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "column_break_operation", 
-   "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": 0, 
-   "set_only_once": 0, 
-   "translatable": 0, 
-   "unique": 0
-  }, 
+   "default": "0",
+   "fieldname": "pending_quotations",
+   "fieldtype": "Check",
+   "label": "Open Quotations"
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_in_quick_entry": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "new_quotations", 
-   "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": "New Quotations", 
-   "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
-  }, 
+   "default": "0",
+   "fieldname": "issue",
+   "fieldtype": "Check",
+   "label": "Open Issues"
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_in_quick_entry": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "pending_quotations", 
-   "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": "Open Quotations", 
-   "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
-  }, 
+   "default": "0",
+   "fieldname": "project",
+   "fieldtype": "Check",
+   "label": "Open Projects"
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_in_quick_entry": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "issue", 
-   "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": "Open Issues", 
-   "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
-  }, 
+   "default": "0",
+   "fieldname": "purchase_orders_items_overdue",
+   "fieldtype": "Check",
+   "label": "Purchase Orders Items Overdue"
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_in_quick_entry": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "project", 
-   "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": "Open Projects", 
-   "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
-  }, 
+   "fieldname": "other",
+   "fieldtype": "Section Break",
+   "label": "Other"
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_in_quick_entry": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "purchase_orders_items_overdue", 
-   "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": "Purchase Orders Items Overdue", 
-   "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
-  }, 
+   "fieldname": "tools",
+   "fieldtype": "Column Break",
+   "label": "Tools"
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_in_quick_entry": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "other", 
-   "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", 
-   "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
-  }, 
+   "default": "0",
+   "fieldname": "calendar_events",
+   "fieldtype": "Check",
+   "label": "Upcoming Calendar Events"
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_in_quick_entry": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "tools", 
-   "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": "Tools", 
-   "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
-  }, 
+   "default": "0",
+   "fieldname": "todo_list",
+   "fieldtype": "Check",
+   "label": "Open To Do"
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_in_quick_entry": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "calendar_events", 
-   "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": "Upcoming Calendar Events", 
-   "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
-  }, 
+   "default": "0",
+   "fieldname": "notifications",
+   "fieldtype": "Check",
+   "label": "Open Notifications"
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_in_quick_entry": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "todo_list", 
-   "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": "Open To Do", 
-   "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
-  }, 
+   "fieldname": "column_break_32",
+   "fieldtype": "Column Break",
+   "label": "  "
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_in_quick_entry": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "notifications", 
-   "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": "Open Notifications", 
-   "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
-  }, 
+   "default": "0",
+   "fieldname": "add_quote",
+   "fieldtype": "Check",
+   "label": "Add Quote"
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_in_quick_entry": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "column_break_32", 
-   "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": 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": "add_quote", 
-   "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": "Add Quote", 
-   "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
+   "description": "Note: Email will not be sent to disabled users",
+   "fieldname": "recipients",
+   "fieldtype": "Table MultiSelect",
+   "label": "Recipients",
+   "options": "Email Digest Recipient",
+   "reqd": 1
   }
- ], 
- "has_web_view": 0, 
- "hide_heading": 0, 
- "hide_toolbar": 0, 
- "icon": "fa fa-envelope", 
- "idx": 1, 
- "image_view": 0, 
- "in_create": 0, 
- "is_submittable": 0, 
- "issingle": 0, 
- "istable": 0, 
- "max_attachments": 0, 
- "menu_index": 0, 
- "modified": "2019-01-16 09:52:15.149908", 
- "modified_by": "Administrator", 
- "module": "Setup", 
- "name": "Email Digest", 
- "owner": "Administrator", 
+ ],
+ "icon": "fa fa-envelope",
+ "idx": 1,
+ "index_web_pages_for_search": 1,
+ "links": [],
+ "modified": "2020-08-24 23:49:00.081695",
+ "modified_by": "Administrator",
+ "module": "Setup",
+ "name": "Email Digest",
+ "owner": "Administrator",
  "permissions": [
   {
-   "amend": 0, 
-   "cancel": 0, 
-   "create": 1, 
-   "delete": 1, 
-   "email": 1, 
-   "export": 0, 
-   "if_owner": 0, 
-   "import": 0, 
-   "permlevel": 0, 
-   "print": 1, 
-   "read": 1, 
-   "report": 1, 
-   "role": "System Manager", 
-   "set_user_permissions": 0, 
-   "share": 1, 
-   "submit": 0, 
+   "create": 1,
+   "delete": 1,
+   "email": 1,
+   "print": 1,
+   "read": 1,
+   "report": 1,
+   "role": "System Manager",
+   "share": 1,
    "write": 1
-  }, 
+  },
   {
-   "amend": 0, 
-   "cancel": 0, 
-   "create": 0, 
-   "delete": 0, 
-   "email": 0, 
-   "export": 0, 
-   "if_owner": 0, 
-   "import": 0, 
-   "permlevel": 1, 
-   "print": 0, 
-   "read": 1, 
-   "report": 0, 
-   "role": "System Manager", 
-   "set_user_permissions": 0, 
-   "share": 0, 
-   "submit": 0, 
-   "write": 0
+   "permlevel": 1,
+   "read": 1,
+   "role": "System Manager"
   }
- ], 
- "quick_entry": 0, 
- "read_only": 0, 
- "read_only_onload": 0, 
- "show_name_in_global_search": 0, 
- "sort_field": "modified", 
- "sort_order": "DESC", 
- "track_changes": 0, 
- "track_seen": 0, 
- "track_views": 0
+ ],
+ "sort_field": "modified",
+ "sort_order": "DESC"
 }
\ No newline at end of file
diff --git a/erpnext/setup/doctype/email_digest/email_digest.py b/erpnext/setup/doctype/email_digest/email_digest.py
index 340d89b..6fbd4cd 100644
--- a/erpnext/setup/doctype/email_digest/email_digest.py
+++ b/erpnext/setup/doctype/email_digest/email_digest.py
@@ -47,19 +47,13 @@
 		# send email only to enabled users
 		valid_users = [p[0] for p in frappe.db.sql("""select name from `tabUser`
 			where enabled=1""")]
-		recipients = list(filter(lambda r: r in valid_users,
-			self.recipient_list.split("\n")))
 
-		original_user = frappe.session.user
-
-		if recipients:
-			for user_id in recipients:
-				frappe.set_user(user_id)
-				frappe.set_user_lang(user_id)
+		if self.recipients:
+			for row in self.recipients:
 				msg_for_this_recipient = self.get_msg_html()
-				if msg_for_this_recipient:
+				if msg_for_this_recipient and row.recipient in valid_users:
 					frappe.sendmail(
-						recipients=user_id,
+						recipients=row.recipient,
 						subject=_("{0} Digest").format(self.frequency),
 						message=msg_for_this_recipient,
 						reference_doctype = self.doctype,
diff --git a/erpnext/setup/doctype/email_digest_recipient/__init__.py b/erpnext/setup/doctype/email_digest_recipient/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/erpnext/setup/doctype/email_digest_recipient/__init__.py
diff --git a/erpnext/setup/doctype/email_digest_recipient/email_digest_recipient.json b/erpnext/setup/doctype/email_digest_recipient/email_digest_recipient.json
new file mode 100644
index 0000000..8b2a6dc
--- /dev/null
+++ b/erpnext/setup/doctype/email_digest_recipient/email_digest_recipient.json
@@ -0,0 +1,33 @@
+{
+ "actions": [],
+ "creation": "2020-06-08 12:19:40.428949",
+ "doctype": "DocType",
+ "editable_grid": 1,
+ "engine": "InnoDB",
+ "field_order": [
+  "recipient"
+ ],
+ "fields": [
+  {
+   "fieldname": "recipient",
+   "fieldtype": "Link",
+   "in_list_view": 1,
+   "label": "Recipient",
+   "options": "User",
+   "reqd": 1
+  }
+ ],
+ "index_web_pages_for_search": 1,
+ "istable": 1,
+ "links": [],
+ "modified": "2020-08-24 23:10:23.217572",
+ "modified_by": "Administrator",
+ "module": "Setup",
+ "name": "Email Digest Recipient",
+ "owner": "Administrator",
+ "permissions": [],
+ "quick_entry": 1,
+ "sort_field": "modified",
+ "sort_order": "DESC",
+ "track_changes": 1
+}
\ No newline at end of file
diff --git a/erpnext/setup/doctype/email_digest_recipient/email_digest_recipient.py b/erpnext/setup/doctype/email_digest_recipient/email_digest_recipient.py
new file mode 100644
index 0000000..968c51c
--- /dev/null
+++ b/erpnext/setup/doctype/email_digest_recipient/email_digest_recipient.py
@@ -0,0 +1,10 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+# import frappe
+from frappe.model.document import Document
+
+class EmailDigestRecipient(Document):
+	pass
diff --git a/erpnext/setup/setup_wizard/operations/company_setup.py b/erpnext/setup/setup_wizard/operations/company_setup.py
index 4edf948..4833d93 100644
--- a/erpnext/setup/setup_wizard/operations/company_setup.py
+++ b/erpnext/setup/setup_wizard/operations/company_setup.py
@@ -45,9 +45,16 @@
 def create_email_digest():
 	from frappe.utils.user import get_system_managers
 	system_managers = get_system_managers(only_name=True)
+
 	if not system_managers:
 		return
 
+	recipients = []
+	for d in system_managers:
+		recipients.append({
+			'recipient': d
+		})
+
 	companies = frappe.db.sql_list("select name FROM `tabCompany`")
 	for company in companies:
 		if not frappe.db.exists("Email Digest", "Default Weekly Digest - " + company):
@@ -56,7 +63,7 @@
 				"name": "Default Weekly Digest - " + company,
 				"company": company,
 				"frequency": "Weekly",
-				"recipient_list": "\n".join(system_managers)
+				"recipients": recipients
 			})
 
 			for df in edigest.meta.get("fields", {"fieldtype": "Check"}):
@@ -72,7 +79,7 @@
 			"name": "Scheduler Errors",
 			"company": companies[0],
 			"frequency": "Daily",
-			"recipient_list": "\n".join(system_managers),
+			"recipients": recipients,
 			"scheduler_errors": 1,
 			"enabled": 1
 		})
diff --git a/erpnext/setup/workspace/erpnext_settings/erpnext_settings.json b/erpnext/setup/workspace/erpnext_settings/erpnext_settings.json
index 6ca3d63..ef4b050 100644
--- a/erpnext/setup/workspace/erpnext_settings/erpnext_settings.json
+++ b/erpnext/setup/workspace/erpnext_settings/erpnext_settings.json
@@ -1,27 +1,35 @@
 {
- "category": "Modules",
+ "category": "",
  "charts": [],
+ "content": "[{\"type\": \"header\", \"data\": {\"text\": \"Your Shortcuts\", \"level\": 4, \"col\": 12}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Projects Settings\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Accounts Settings\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Stock Settings\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"HR Settings\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Selling Settings\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Buying Settings\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Support Settings\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Shopping Cart Settings\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Portal Settings\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Manufacturing Settings\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Education Settings\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Hotel Settings\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Healthcare Settings\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Domain Settings\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Products Settings\", \"col\": 4}}]",
  "creation": "2020-03-12 14:47:51.166455",
  "developer_mode_only": 0,
  "disable_user_customization": 0,
  "docstatus": 0,
  "doctype": "Workspace",
- "extends": "Settings",
- "extends_another_page": 1,
+ "extends": "",
+ "extends_another_page": 0,
+ "for_user": "",
  "hide_custom": 0,
- "icon": "settings",
+ "icon": "setting",
  "idx": 0,
  "is_default": 0,
- "is_standard": 1,
+ "is_standard": 0,
  "label": "ERPNext Settings",
  "links": [],
- "modified": "2021-06-12 01:58:11.399566",
+ "modified": "2021-08-05 12:15:59.052327",
  "modified_by": "Administrator",
  "module": "Setup",
  "name": "ERPNext Settings",
+ "onboarding": "",
  "owner": "Administrator",
+ "parent_page": "",
  "pin_to_bottom": 0,
  "pin_to_top": 0,
+ "public": 1,
+ "restrict_to_domain": "",
+ "roles": [],
+ "sequence_id": 12,
  "shortcuts": [
   {
    "icon": "project",
@@ -118,5 +126,6 @@
    "link_to": "Products Settings",
    "type": "DocType"
   }
- ]
-}
+ ],
+ "title": "ERPNext Settings"
+}
\ No newline at end of file
diff --git a/erpnext/setup/workspace/home/home.json b/erpnext/setup/workspace/home/home.json
index 1576d5a..cc9569f 100644
--- a/erpnext/setup/workspace/home/home.json
+++ b/erpnext/setup/workspace/home/home.json
@@ -1,23 +1,27 @@
 {
- "category": "Modules",
+ "category": "",
  "charts": [],
+ "content": "[{\"type\":\"spacer\",\"data\":{\"col\":12}},{\"type\":\"header\",\"data\":{\"text\":\"Your Shortcuts\",\"level\":4,\"col\":12}},{\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Item\",\"col\":4}},{\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Customer\",\"col\":4}},{\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Supplier\",\"col\":4}},{\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Sales Invoice\",\"col\":4}},{\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Leaderboard\",\"col\":4}},{\"type\":\"spacer\",\"data\":{\"col\":12}},{\"type\":\"header\",\"data\":{\"text\":\"Reports &amp; Masters\",\"level\":4,\"col\":12}},{\"type\":\"card\",\"data\":{\"card_name\":\"Accounting\",\"col\":4}},{\"type\":\"card\",\"data\":{\"card_name\":\"Stock\",\"col\":4}},{\"type\":\"card\",\"data\":{\"card_name\":\"Human Resources\",\"col\":4}},{\"type\":\"card\",\"data\":{\"card_name\":\"CRM\",\"col\":4}},{\"type\":\"card\",\"data\":{\"card_name\":\"Data Import and Settings\",\"col\":4}}]",
  "creation": "2020-01-23 13:46:38.833076",
  "developer_mode_only": 0,
  "disable_user_customization": 0,
  "docstatus": 0,
  "doctype": "Workspace",
+ "extends": "",
  "extends_another_page": 0,
+ "for_user": "",
  "hide_custom": 0,
  "icon": "getting-started",
  "idx": 0,
  "is_default": 0,
- "is_standard": 1,
+ "is_standard": 0,
  "label": "Home",
  "links": [
   {
    "hidden": 0,
    "is_query_report": 0,
    "label": "Accounting",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -26,6 +30,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Chart of Accounts",
+   "link_count": 0,
    "link_to": "Account",
    "link_type": "DocType",
    "onboard": 1,
@@ -36,6 +41,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Company",
+   "link_count": 0,
    "link_to": "Company",
    "link_type": "DocType",
    "onboard": 1,
@@ -46,6 +52,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Customer",
+   "link_count": 0,
    "link_to": "Customer",
    "link_type": "DocType",
    "onboard": 1,
@@ -56,6 +63,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Supplier",
+   "link_count": 0,
    "link_to": "Supplier",
    "link_type": "DocType",
    "onboard": 1,
@@ -65,6 +73,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Stock",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -73,6 +82,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Item",
+   "link_count": 0,
    "link_to": "Item",
    "link_type": "DocType",
    "onboard": 1,
@@ -83,6 +93,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Warehouse",
+   "link_count": 0,
    "link_to": "Warehouse",
    "link_type": "DocType",
    "onboard": 1,
@@ -93,6 +104,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Brand",
+   "link_count": 0,
    "link_to": "Brand",
    "link_type": "DocType",
    "onboard": 1,
@@ -103,6 +115,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Unit of Measure (UOM)",
+   "link_count": 0,
    "link_to": "UOM",
    "link_type": "DocType",
    "onboard": 1,
@@ -113,6 +126,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Stock Reconciliation",
+   "link_count": 0,
    "link_to": "Stock Reconciliation",
    "link_type": "DocType",
    "onboard": 1,
@@ -122,6 +136,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Human Resources",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -130,6 +145,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Employee",
+   "link_count": 0,
    "link_to": "Employee",
    "link_type": "DocType",
    "onboard": 1,
@@ -140,6 +156,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Employee Attendance Tool",
+   "link_count": 0,
    "link_to": "Employee Attendance Tool",
    "link_type": "DocType",
    "onboard": 1,
@@ -150,6 +167,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Salary Structure",
+   "link_count": 0,
    "link_to": "Salary Structure",
    "link_type": "DocType",
    "onboard": 1,
@@ -159,6 +177,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "CRM",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -167,6 +186,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Lead",
+   "link_count": 0,
    "link_to": "Lead",
    "link_type": "DocType",
    "onboard": 1,
@@ -177,6 +197,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Customer Group",
+   "link_count": 0,
    "link_to": "Customer Group",
    "link_type": "DocType",
    "onboard": 1,
@@ -187,6 +208,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Territory",
+   "link_count": 0,
    "link_to": "Territory",
    "link_type": "DocType",
    "onboard": 1,
@@ -196,6 +218,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Data Import and Settings",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -204,6 +227,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Import Data",
+   "link_count": 0,
    "link_to": "Data Import",
    "link_type": "DocType",
    "onboard": 1,
@@ -214,6 +238,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Opening Invoice Creation Tool",
+   "link_count": 0,
    "link_to": "Opening Invoice Creation Tool",
    "link_type": "DocType",
    "onboard": 1,
@@ -224,6 +249,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Chart of Accounts Importer",
+   "link_count": 0,
    "link_to": "Chart of Accounts Importer",
    "link_type": "DocType",
    "onboard": 1,
@@ -234,6 +260,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Letter Head",
+   "link_count": 0,
    "link_to": "Letter Head",
    "link_type": "DocType",
    "onboard": 1,
@@ -244,19 +271,26 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Email Account",
+   "link_count": 0,
    "link_to": "Email Account",
    "link_type": "DocType",
    "onboard": 1,
    "type": "Link"
   }
  ],
- "modified": "2021-04-19 15:48:44.089927",
+ "modified": "2021-08-10 15:33:20.704740",
  "modified_by": "Administrator",
  "module": "Setup",
  "name": "Home",
+ "onboarding": "",
  "owner": "Administrator",
+ "parent_page": "",
  "pin_to_bottom": 0,
- "pin_to_top": 1,
+ "pin_to_top": 0,
+ "public": 1,
+ "restrict_to_domain": "",
+ "roles": [],
+ "sequence_id": 1,
  "shortcuts": [
   {
    "label": "Item",
@@ -283,5 +317,6 @@
    "link_to": "leaderboard",
    "type": "Page"
   }
- ]
+ ],
+ "title": "Home"
 }
\ No newline at end of file
diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.py b/erpnext/stock/doctype/delivery_note/delivery_note.py
index 4808e94..f99a01b 100644
--- a/erpnext/stock/doctype/delivery_note/delivery_note.py
+++ b/erpnext/stock/doctype/delivery_note/delivery_note.py
@@ -503,6 +503,10 @@
 		}
 	}, target_doc, set_missing_values)
 
+	automatically_fetch_payment_terms = cint(frappe.db.get_single_value('Accounts Settings', 'automatically_fetch_payment_terms'))
+	if automatically_fetch_payment_terms:
+		doc.set_payment_schedule()
+
 	return doc
 
 @frappe.whitelist()
diff --git a/erpnext/stock/doctype/delivery_note/test_delivery_note.py b/erpnext/stock/doctype/delivery_note/test_delivery_note.py
index f981aeb..756825e 100644
--- a/erpnext/stock/doctype/delivery_note/test_delivery_note.py
+++ b/erpnext/stock/doctype/delivery_note/test_delivery_note.py
@@ -17,7 +17,8 @@
 from erpnext.stock.doctype.serial_no.serial_no import get_serial_nos, SerialNoWarehouseError
 from erpnext.stock.doctype.stock_reconciliation.test_stock_reconciliation \
 	import create_stock_reconciliation, set_valuation_method
-from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order, create_dn_against_so
+from erpnext.selling.doctype.sales_order.test_sales_order \
+	import make_sales_order, create_dn_against_so, automatically_fetch_payment_terms, compare_payment_schedules
 from erpnext.accounts.doctype.account.test_account import get_inventory_account
 from erpnext.stock.doctype.warehouse.test_warehouse import get_warehouse
 from erpnext.stock.doctype.item.test_item import make_item
@@ -759,6 +760,32 @@
 
 		self.assertTrue("TESTBATCH" in dn.packed_items[0].batch_no, "Batch number not added in packed item")
 
+	def test_payment_terms_are_fetched_when_creating_sales_invoice(self):
+		from erpnext.accounts.doctype.payment_entry.test_payment_entry import create_payment_terms_template
+		from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice
+
+		automatically_fetch_payment_terms()
+
+		so = make_sales_order(uom="Nos", do_not_save=1)
+		create_payment_terms_template()
+		so.payment_terms_template = 'Test Receivable Template'
+		so.submit()
+
+		dn = create_dn_against_so(so.name, delivered_qty=10)
+		
+		si = create_sales_invoice(qty=10, do_not_save=1)
+		si.items[0].delivery_note= dn.name
+		si.items[0].dn_detail = dn.items[0].name
+		si.items[0].sales_order = so.name
+		si.items[0].so_detail = so.items[0].name
+
+		si.insert()
+		si.submit()
+
+		self.assertEqual(so.payment_terms_template, si.payment_terms_template)
+		compare_payment_schedules(self, so, si)
+
+		automatically_fetch_payment_terms(enable=0)
 
 def create_delivery_note(**args):
 	dn = frappe.new_doc("Delivery Note")
diff --git a/erpnext/stock/doctype/item/item.js b/erpnext/stock/doctype/item/item.js
index fd080fd..c5bc9f1 100644
--- a/erpnext/stock/doctype/item/item.js
+++ b/erpnext/stock/doctype/item/item.js
@@ -260,6 +260,17 @@
 			}
 		}
 
+		frm.fields_dict["item_defaults"].grid.get_field("default_discount_account").get_query = function(doc, cdt, cdn) {
+			const row = locals[cdt][cdn];
+			return {
+				filters: {
+					'report_type': 'Profit and Loss',
+					'company': row.company,
+					"is_group": 0
+				}
+			};
+		};
+
 		frm.fields_dict["item_defaults"].grid.get_field("buying_cost_center").get_query = function(doc, cdt, cdn) {
 			const row = locals[cdt][cdn];
 			return {
diff --git a/erpnext/stock/doctype/item/item.json b/erpnext/stock/doctype/item/item.json
index 6fed9ef..f662bbd 100644
--- a/erpnext/stock/doctype/item/item.json
+++ b/erpnext/stock/doctype/item/item.json
@@ -1067,7 +1067,7 @@
  "index_web_pages_for_search": 1,
  "links": [],
  "max_attachments": 1,
- "modified": "2021-03-18 14:04:38.575519",
+ "modified": "2021-07-13 01:29:06.071827",
  "modified_by": "Administrator",
  "module": "Stock",
  "name": "Item",
@@ -1138,4 +1138,4 @@
  "sort_order": "DESC",
  "title_field": "item_name",
  "track_changes": 1
-}
+}
\ No newline at end of file
diff --git a/erpnext/stock/doctype/item_default/item_default.json b/erpnext/stock/doctype/item_default/item_default.json
index 96b5dfd..bc17160 100644
--- a/erpnext/stock/doctype/item_default/item_default.json
+++ b/erpnext/stock/doctype/item_default/item_default.json
@@ -1,464 +1,118 @@
 {
- "allow_copy": 0, 
- "allow_events_in_timeline": 0, 
- "allow_guest_to_view": 0, 
- "allow_import": 0, 
- "allow_rename": 0, 
- "beta": 0, 
- "creation": "2018-05-03 02:29:24.444341", 
- "custom": 0, 
- "docstatus": 0, 
- "doctype": "DocType", 
- "document_type": "", 
- "editable_grid": 1, 
- "engine": "InnoDB", 
+ "actions": [],
+ "creation": "2018-05-03 02:29:24.444341",
+ "doctype": "DocType",
+ "editable_grid": 1,
+ "engine": "InnoDB",
+ "field_order": [
+  "company",
+  "default_warehouse",
+  "column_break_3",
+  "default_price_list",
+  "default_discount_account",
+  "purchase_defaults",
+  "buying_cost_center",
+  "default_supplier",
+  "column_break_8",
+  "expense_account",
+  "selling_defaults",
+  "selling_cost_center",
+  "column_break_12",
+  "income_account"
+ ],
  "fields": [
   {
-   "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": 1, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 1, 
-   "in_standard_filter": 0, 
-   "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
-  }, 
+   "fieldname": "company",
+   "fieldtype": "Link",
+   "ignore_user_permissions": 1,
+   "in_list_view": 1,
+   "label": "Company",
+   "options": "Company",
+   "reqd": 1
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_in_quick_entry": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "default_warehouse", 
-   "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": "Default 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
-  }, 
+   "fieldname": "default_warehouse",
+   "fieldtype": "Link",
+   "in_list_view": 1,
+   "label": "Default Warehouse",
+   "options": "Warehouse"
+  },
   {
-   "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
-  }, 
+   "fieldname": "column_break_3",
+   "fieldtype": "Column Break"
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_in_quick_entry": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "default_price_list", 
-   "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": "Default Price List", 
-   "length": 0, 
-   "no_copy": 0, 
-   "options": "Price List", 
-   "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
-  }, 
+   "fieldname": "default_price_list",
+   "fieldtype": "Link",
+   "in_list_view": 1,
+   "label": "Default Price List",
+   "options": "Price List"
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_in_quick_entry": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "purchase_defaults", 
-   "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": "Purchase Defaults", 
-   "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
-  }, 
+   "fieldname": "purchase_defaults",
+   "fieldtype": "Section Break",
+   "label": "Purchase Defaults"
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_in_quick_entry": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "buying_cost_center", 
-   "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 Buying Cost Center", 
-   "length": 0, 
-   "no_copy": 0, 
-   "options": "Cost Center", 
-   "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
-  }, 
+   "fieldname": "buying_cost_center",
+   "fieldtype": "Link",
+   "label": "Default Buying Cost Center",
+   "options": "Cost Center"
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_in_quick_entry": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "default_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": "Default 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
-  }, 
+   "fieldname": "default_supplier",
+   "fieldtype": "Link",
+   "label": "Default Supplier",
+   "options": "Supplier"
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_in_quick_entry": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "column_break_8", 
-   "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
-  }, 
+   "fieldname": "column_break_8",
+   "fieldtype": "Column Break"
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_in_quick_entry": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "expense_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": "Default Expense 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, 
-   "unique": 0
-  }, 
+   "fieldname": "expense_account",
+   "fieldtype": "Link",
+   "label": "Default Expense Account",
+   "options": "Account"
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_in_quick_entry": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "selling_defaults", 
-   "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": "Sales Defaults", 
-   "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
-  }, 
+   "fieldname": "selling_defaults",
+   "fieldtype": "Section Break",
+   "label": "Sales Defaults"
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_in_quick_entry": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "selling_cost_center", 
-   "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 Selling Cost Center", 
-   "length": 0, 
-   "no_copy": 0, 
-   "options": "Cost Center", 
-   "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
-  }, 
+   "fieldname": "selling_cost_center",
+   "fieldtype": "Link",
+   "label": "Default Selling Cost Center",
+   "options": "Cost Center"
+  },
   {
-   "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
-  }, 
+   "fieldname": "column_break_12",
+   "fieldtype": "Column Break"
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_in_quick_entry": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "income_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": "Default Income 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, 
-   "unique": 0
+   "fieldname": "income_account",
+   "fieldtype": "Link",
+   "label": "Default Income Account",
+   "options": "Account"
+  },
+  {
+   "fieldname": "default_discount_account",
+   "fieldtype": "Link",
+   "label": "Default Discount Account",
+   "options": "Account"
   }
- ], 
- "has_web_view": 0, 
- "hide_heading": 0, 
- "hide_toolbar": 0, 
- "idx": 0, 
- "image_view": 0, 
- "in_create": 0, 
- "is_submittable": 0, 
- "issingle": 0, 
- "istable": 1, 
- "max_attachments": 0, 
- "modified": "2018-12-07 11:48:07.638935", 
- "modified_by": "Administrator", 
- "module": "Stock", 
- "name": "Item Default", 
- "name_case": "", 
- "owner": "Administrator", 
- "permissions": [], 
- "quick_entry": 1, 
- "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, 
- "track_views": 0
+ ],
+ "istable": 1,
+ "links": [],
+ "modified": "2021-07-13 01:26:03.860065",
+ "modified_by": "Administrator",
+ "module": "Stock",
+ "name": "Item Default",
+ "owner": "Administrator",
+ "permissions": [],
+ "quick_entry": 1,
+ "sort_field": "modified",
+ "sort_order": "DESC",
+ "track_changes": 1
 }
\ No newline at end of file
diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
index bcf6052..ece6d6f 100644
--- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
+++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
@@ -734,6 +734,7 @@
 		doc.run_method("onload")
 		doc.run_method("set_missing_values")
 		doc.run_method("calculate_taxes_and_totals")
+		doc.set_payment_schedule()
 
 	def update_item(source_doc, target_doc, source_parent):
 		target_doc.qty, returned_qty = get_pending_qty(source_doc)
diff --git a/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py
index d40d781..2314508 100644
--- a/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py
+++ b/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py
@@ -326,7 +326,6 @@
 		self.assertRaises(frappe.ValidationError, pr2.submit)
 		frappe.db.rollback()
 
-
 	def test_serial_no_supplier(self):
 		pr = make_purchase_receipt(item_code="_Test Serialized Item With Series", qty=1)
 		self.assertEqual(frappe.db.get_value("Serial No", pr.get("items")[0].serial_no, "supplier"),
@@ -1065,6 +1064,33 @@
 
 		self.assertEqual(discrepancy_caused_by_exchange_rate_diff, amount)
 
+	def test_payment_terms_are_fetched_when_creating_purchase_invoice(self):
+		from erpnext.accounts.doctype.payment_entry.test_payment_entry import create_payment_terms_template
+		from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice import make_purchase_invoice
+		from erpnext.buying.doctype.purchase_order.test_purchase_order import create_purchase_order, make_pr_against_po
+		from erpnext.selling.doctype.sales_order.test_sales_order import automatically_fetch_payment_terms, compare_payment_schedules
+
+		automatically_fetch_payment_terms()
+
+		po = create_purchase_order(qty=10, rate=100, do_not_save=1)
+		create_payment_terms_template()
+		po.payment_terms_template = 'Test Receivable Template'
+		po.submit()
+
+		pr = make_pr_against_po(po.name, received_qty=10)
+
+		pi = make_purchase_invoice(qty=10, rate=100, do_not_save=1)
+		pi.items[0].purchase_receipt = pr.name
+		pi.items[0].pr_detail = pr.items[0].name
+		pi.items[0].purchase_order = po.name
+		pi.items[0].po_detail = po.items[0].name
+		pi.insert()
+
+		# self.assertEqual(po.payment_terms_template, pi.payment_terms_template)
+		compare_payment_schedules(self, po, pi)
+
+		automatically_fetch_payment_terms(enable=0)
+
 def get_sl_entries(voucher_type, voucher_no):
 	return frappe.db.sql(""" select actual_qty, warehouse, stock_value_difference
 		from `tabStock Ledger Entry` where voucher_type=%s and voucher_no=%s
diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py
index 8293319..7b31d2f 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.py
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.py
@@ -1185,7 +1185,7 @@
 		wo = frappe.get_doc("Work Order", self.work_order)
 		wo_items = frappe.get_all('Work Order Item',
 			filters={'parent': self.work_order},
-			fields=["item_code", "required_qty", "consumed_qty", "transferred_qty"]
+			fields=["item_code", "source_warehouse", "required_qty", "consumed_qty", "transferred_qty"]
 			)
 
 		work_order_qty = wo.material_transferred_for_manufacturing or wo.qty
@@ -1205,7 +1205,7 @@
 			if qty > 0:
 				self.add_to_stock_entry_detail({
 					item.item_code: {
-						"from_warehouse": wo.wip_warehouse,
+						"from_warehouse": wo.wip_warehouse or item.source_warehouse,
 						"to_warehouse": "",
 						"qty": qty,
 						"item_name": item.item_name,
@@ -1857,4 +1857,4 @@
 
 		supplied_item.total_supplied_qty = flt(supplied_item.supplied_qty) - flt(supplied_item.returned_qty)
 
-	return supplied_item_details
\ No newline at end of file
+	return supplied_item_details
diff --git a/erpnext/stock/get_item_details.py b/erpnext/stock/get_item_details.py
index be8508a..a0fbcec 100644
--- a/erpnext/stock/get_item_details.py
+++ b/erpnext/stock/get_item_details.py
@@ -286,6 +286,7 @@
 		"warehouse": warehouse,
 		"income_account": get_default_income_account(args, item_defaults, item_group_defaults, brand_defaults),
 		"expense_account": expense_account or get_default_expense_account(args, item_defaults, item_group_defaults, brand_defaults) ,
+		"discount_account": None or get_default_discount_account(args, item_defaults),
 		"cost_center": get_default_cost_center(args, item_defaults, item_group_defaults, brand_defaults),
 		'has_serial_no': item.has_serial_no,
 		'has_batch_no': item.has_batch_no,
@@ -588,6 +589,10 @@
 		or brand.get("expense_account")
 		or args.expense_account)
 
+def get_default_discount_account(args, item):
+	return (item.get("default_discount_account")
+		or args.discount_account)
+
 def get_default_deferred_account(args, item, fieldname=None):
 	if item.get("enable_deferred_revenue") or item.get("enable_deferred_expense"):
 		return (item.get(fieldname)
diff --git a/erpnext/stock/report/stock_analytics/stock_analytics.py b/erpnext/stock/report/stock_analytics/stock_analytics.py
index 0cc8ca4..fde934b 100644
--- a/erpnext/stock/report/stock_analytics/stock_analytics.py
+++ b/erpnext/stock/report/stock_analytics/stock_analytics.py
@@ -114,14 +114,42 @@
 
 
 def get_periodic_data(entry, filters):
+	"""Structured as:
+		Item 1
+			- Balance (updated and carried forward):
+					- Warehouse A : bal_qty/value
+					- Warehouse B : bal_qty/value
+			- Jun 2021 (sum of warehouse quantities used in report)
+					- Warehouse A : bal_qty/value
+					- Warehouse B : bal_qty/value
+			- Jul 2021 (sum of warehouse quantities used in report)
+					- Warehouse A : bal_qty/value
+					- Warehouse B : bal_qty/value
+		Item 2
+			- Balance (updated and carried forward):
+					- Warehouse A : bal_qty/value
+					- Warehouse B : bal_qty/value
+			- Jun 2021 (sum of warehouse quantities used in report)
+					- Warehouse A : bal_qty/value
+					- Warehouse B : bal_qty/value
+			- Jul 2021 (sum of warehouse quantities used in report)
+					- Warehouse A : bal_qty/value
+					- Warehouse B : bal_qty/value
+	"""
 	periodic_data = {}
 	for d in entry:
 		period = get_period(d.posting_date, filters)
 		bal_qty = 0
 
+		# if period against item does not exist yet, instantiate it
+		# insert existing balance dict against period, and add/subtract to it
+		if periodic_data.get(d.item_code) and not periodic_data.get(d.item_code).get(period):
+			previous_balance = periodic_data[d.item_code]['balance'].copy()
+			periodic_data[d.item_code][period] = previous_balance
+
 		if d.voucher_type == "Stock Reconciliation":
-			if periodic_data.get(d.item_code):
-				bal_qty = periodic_data[d.item_code]["balance"]
+			if periodic_data.get(d.item_code) and periodic_data.get(d.item_code).get('balance').get(d.warehouse):
+				bal_qty = periodic_data[d.item_code]['balance'][d.warehouse]
 
 			qty_diff = d.qty_after_transaction - bal_qty
 		else:
@@ -132,12 +160,12 @@
 		else:
 			value = d.stock_value_difference
 
-		periodic_data.setdefault(d.item_code, {}).setdefault(period, 0.0)
-		periodic_data.setdefault(d.item_code, {}).setdefault("balance", 0.0)
+		# period-warehouse wise balance
+		periodic_data.setdefault(d.item_code, {}).setdefault('balance', {}).setdefault(d.warehouse, 0.0)
+		periodic_data.setdefault(d.item_code, {}).setdefault(period, {}).setdefault(d.warehouse, 0.0)
 
-		periodic_data[d.item_code]["balance"] += value
-		periodic_data[d.item_code][period] = periodic_data[d.item_code]["balance"]
-
+		periodic_data[d.item_code]['balance'][d.warehouse] += value
+		periodic_data[d.item_code][period][d.warehouse] = periodic_data[d.item_code]['balance'][d.warehouse]
 
 	return periodic_data
 
@@ -160,7 +188,8 @@
 		total = 0
 		for dummy, end_date in ranges:
 			period = get_period(end_date, filters)
-			amount = flt(periodic_data.get(item_data.name, {}).get(period))
+			period_data = periodic_data.get(item_data.name, {}).get(period)
+			amount = sum(period_data.values()) if period_data else 0
 			row[scrub(period)] = amount
 			total += amount
 		row["total"] = total
diff --git a/erpnext/stock/report/stock_balance/stock_balance.py b/erpnext/stock/report/stock_balance/stock_balance.py
index 9e56ad4..fc3d719 100644
--- a/erpnext/stock/report/stock_balance/stock_balance.py
+++ b/erpnext/stock/report/stock_balance/stock_balance.py
@@ -235,12 +235,15 @@
 	return iwb_map
 
 def get_items(filters):
+	"Get items based on item code, item group or brand."
 	conditions = []
 	if filters.get("item_code"):
 		conditions.append("item.name=%(item_code)s")
 	else:
 		if filters.get("item_group"):
 			conditions.append(get_item_group_condition(filters.get("item_group")))
+		if filters.get("brand"): # used in stock analytics report
+			conditions.append("item.brand=%(brand)s")
 
 	items = []
 	if conditions:
diff --git a/erpnext/stock/workspace/stock/stock.json b/erpnext/stock/workspace/stock/stock.json
index 529ce8e..26d10ce 100644
--- a/erpnext/stock/workspace/stock/stock.json
+++ b/erpnext/stock/workspace/stock/stock.json
@@ -1,28 +1,32 @@
 {
  "cards_label": "Masters & Reports",
- "category": "Modules",
+ "category": "",
  "charts": [
   {
    "chart_name": "Warehouse wise Stock Value"
   }
  ],
+ "content": "[{\"type\": \"onboarding\", \"data\": {\"onboarding_name\":\"Stock\", \"col\": 12}}, {\"type\": \"chart\", \"data\": {\"chart_name\": null, \"col\": 12}}, {\"type\": \"spacer\", \"data\": {\"col\": 12}}, {\"type\": \"header\", \"data\": {\"text\": \"Quick Access\", \"level\": 4, \"col\": 12}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Item\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Material Request\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Stock Entry\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Purchase Receipt\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Delivery Note\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Stock Ledger\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Stock Balance\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Dashboard\", \"col\": 4}}, {\"type\": \"spacer\", \"data\": {\"col\": 12}}, {\"type\": \"header\", \"data\": {\"text\": \"Masters & Reports\", \"level\": 4, \"col\": 12}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Items and Pricing\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Stock Transactions\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Stock Reports\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Settings\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Serial No and Batch\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Tools\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Key Reports\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Other Reports\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Incorrect Data Report\", \"col\": 4}}]",
  "creation": "2020-03-02 15:43:10.096528",
  "developer_mode_only": 0,
  "disable_user_customization": 0,
  "docstatus": 0,
  "doctype": "Workspace",
+ "extends": "",
  "extends_another_page": 0,
+ "for_user": "",
  "hide_custom": 0,
  "icon": "stock",
  "idx": 0,
  "is_default": 0,
- "is_standard": 1,
+ "is_standard": 0,
  "label": "Stock",
  "links": [
   {
    "hidden": 0,
    "is_query_report": 0,
    "label": "Items and Pricing",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -31,6 +35,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Item",
+   "link_count": 0,
    "link_to": "Item",
    "link_type": "DocType",
    "onboard": 1,
@@ -41,6 +46,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Item Group",
+   "link_count": 0,
    "link_to": "Item Group",
    "link_type": "DocType",
    "onboard": 1,
@@ -51,6 +57,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Product Bundle",
+   "link_count": 0,
    "link_to": "Product Bundle",
    "link_type": "DocType",
    "onboard": 1,
@@ -61,6 +68,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Price List",
+   "link_count": 0,
    "link_to": "Price List",
    "link_type": "DocType",
    "onboard": 0,
@@ -71,6 +79,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Item Price",
+   "link_count": 0,
    "link_to": "Item Price",
    "link_type": "DocType",
    "onboard": 0,
@@ -81,6 +90,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Shipping Rule",
+   "link_count": 0,
    "link_to": "Shipping Rule",
    "link_type": "DocType",
    "onboard": 0,
@@ -91,6 +101,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Pricing Rule",
+   "link_count": 0,
    "link_to": "Pricing Rule",
    "link_type": "DocType",
    "onboard": 0,
@@ -101,6 +112,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Item Alternative",
+   "link_count": 0,
    "link_to": "Item Alternative",
    "link_type": "DocType",
    "onboard": 0,
@@ -111,6 +123,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Item Manufacturer",
+   "link_count": 0,
    "link_to": "Item Manufacturer",
    "link_type": "DocType",
    "onboard": 0,
@@ -121,6 +134,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Customs Tariff Number",
+   "link_count": 0,
    "link_to": "Customs Tariff Number",
    "link_type": "DocType",
    "onboard": 0,
@@ -130,6 +144,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Stock Transactions",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -138,6 +153,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Material Request",
+   "link_count": 0,
    "link_to": "Material Request",
    "link_type": "DocType",
    "onboard": 1,
@@ -148,6 +164,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Stock Entry",
+   "link_count": 0,
    "link_to": "Stock Entry",
    "link_type": "DocType",
    "onboard": 1,
@@ -158,6 +175,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Delivery Note",
+   "link_count": 0,
    "link_to": "Delivery Note",
    "link_type": "DocType",
    "onboard": 1,
@@ -168,6 +186,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Purchase Receipt",
+   "link_count": 0,
    "link_to": "Purchase Receipt",
    "link_type": "DocType",
    "onboard": 1,
@@ -178,6 +197,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Pick List",
+   "link_count": 0,
    "link_to": "Pick List",
    "link_type": "DocType",
    "onboard": 1,
@@ -188,6 +208,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Delivery Trip",
+   "link_count": 0,
    "link_to": "Delivery Trip",
    "link_type": "DocType",
    "onboard": 0,
@@ -197,6 +218,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Stock Reports",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -205,6 +227,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Stock Ledger",
+   "link_count": 0,
    "link_to": "Stock Ledger",
    "link_type": "Report",
    "onboard": 1,
@@ -215,6 +238,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Stock Balance",
+   "link_count": 0,
    "link_to": "Stock Balance",
    "link_type": "Report",
    "onboard": 1,
@@ -225,6 +249,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Stock Projected Qty",
+   "link_count": 0,
    "link_to": "Stock Projected Qty",
    "link_type": "Report",
    "onboard": 1,
@@ -235,6 +260,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Stock Summary",
+   "link_count": 0,
    "link_to": "stock-balance",
    "link_type": "Page",
    "onboard": 0,
@@ -245,6 +271,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Stock Ageing",
+   "link_count": 0,
    "link_to": "Stock Ageing",
    "link_type": "Report",
    "onboard": 0,
@@ -255,6 +282,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Item Price Stock",
+   "link_count": 0,
    "link_to": "Item Price Stock",
    "link_type": "Report",
    "onboard": 0,
@@ -264,6 +292,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Settings",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -272,6 +301,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Stock Settings",
+   "link_count": 0,
    "link_to": "Stock Settings",
    "link_type": "DocType",
    "onboard": 1,
@@ -282,6 +312,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Warehouse",
+   "link_count": 0,
    "link_to": "Warehouse",
    "link_type": "DocType",
    "onboard": 1,
@@ -292,6 +323,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Unit of Measure (UOM)",
+   "link_count": 0,
    "link_to": "UOM",
    "link_type": "DocType",
    "onboard": 1,
@@ -302,6 +334,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Item Variant Settings",
+   "link_count": 0,
    "link_to": "Item Variant Settings",
    "link_type": "DocType",
    "onboard": 1,
@@ -312,6 +345,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Brand",
+   "link_count": 0,
    "link_to": "Brand",
    "link_type": "DocType",
    "onboard": 1,
@@ -322,6 +356,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Item Attribute",
+   "link_count": 0,
    "link_to": "Item Attribute",
    "link_type": "DocType",
    "onboard": 0,
@@ -332,6 +367,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "UOM Conversion Factor",
+   "link_count": 0,
    "link_to": "UOM Conversion Factor",
    "link_type": "DocType",
    "onboard": 0,
@@ -341,6 +377,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Serial No and Batch",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -349,6 +386,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Serial No",
+   "link_count": 0,
    "link_to": "Serial No",
    "link_type": "DocType",
    "onboard": 1,
@@ -359,6 +397,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Batch",
+   "link_count": 0,
    "link_to": "Batch",
    "link_type": "DocType",
    "onboard": 1,
@@ -369,6 +408,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Installation Note",
+   "link_count": 0,
    "link_to": "Installation Note",
    "link_type": "DocType",
    "onboard": 0,
@@ -379,6 +419,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Serial No Service Contract Expiry",
+   "link_count": 0,
    "link_to": "Serial No Service Contract Expiry",
    "link_type": "Report",
    "onboard": 0,
@@ -389,6 +430,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Serial No Status",
+   "link_count": 0,
    "link_to": "Serial No Status",
    "link_type": "Report",
    "onboard": 0,
@@ -399,6 +441,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Serial No Warranty Expiry",
+   "link_count": 0,
    "link_to": "Serial No Warranty Expiry",
    "link_type": "Report",
    "onboard": 0,
@@ -408,6 +451,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Tools",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -416,6 +460,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Stock Reconciliation",
+   "link_count": 0,
    "link_to": "Stock Reconciliation",
    "link_type": "DocType",
    "onboard": 1,
@@ -426,6 +471,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Landed Cost Voucher",
+   "link_count": 0,
    "link_to": "Landed Cost Voucher",
    "link_type": "DocType",
    "onboard": 1,
@@ -436,6 +482,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Packing Slip",
+   "link_count": 0,
    "link_to": "Packing Slip",
    "link_type": "DocType",
    "onboard": 1,
@@ -446,6 +493,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Quality Inspection",
+   "link_count": 0,
    "link_to": "Quality Inspection",
    "link_type": "DocType",
    "onboard": 0,
@@ -456,6 +504,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Quality Inspection Template",
+   "link_count": 0,
    "link_to": "Quality Inspection Template",
    "link_type": "DocType",
    "onboard": 0,
@@ -466,6 +515,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Quick Stock Balance",
+   "link_count": 0,
    "link_to": "Quick Stock Balance",
    "link_type": "DocType",
    "onboard": 0,
@@ -475,6 +525,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Key Reports",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -483,6 +534,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Item-wise Price List Rate",
+   "link_count": 0,
    "link_to": "Item-wise Price List Rate",
    "link_type": "Report",
    "onboard": 1,
@@ -493,6 +545,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Stock Analytics",
+   "link_count": 0,
    "link_to": "Stock Analytics",
    "link_type": "Report",
    "onboard": 1,
@@ -503,6 +556,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Stock Qty vs Serial No Count",
+   "link_count": 0,
    "link_to": "Stock Qty vs Serial No Count",
    "link_type": "Report",
    "onboard": 1,
@@ -513,6 +567,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Delivery Note Trends",
+   "link_count": 0,
    "link_to": "Delivery Note Trends",
    "link_type": "Report",
    "onboard": 0,
@@ -523,6 +578,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Purchase Receipt Trends",
+   "link_count": 0,
    "link_to": "Purchase Receipt Trends",
    "link_type": "Report",
    "onboard": 0,
@@ -533,6 +589,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Sales Order Analysis",
+   "link_count": 0,
    "link_to": "Sales Order Analysis",
    "link_type": "Report",
    "onboard": 0,
@@ -543,6 +600,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Purchase Order Analysis",
+   "link_count": 0,
    "link_to": "Purchase Order Analysis",
    "link_type": "Report",
    "onboard": 0,
@@ -553,6 +611,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Item Shortage Report",
+   "link_count": 0,
    "link_to": "Item Shortage Report",
    "link_type": "Report",
    "onboard": 0,
@@ -563,6 +622,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Batch-Wise Balance History",
+   "link_count": 0,
    "link_to": "Batch-Wise Balance History",
    "link_type": "Report",
    "onboard": 0,
@@ -572,6 +632,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Other Reports",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -580,6 +641,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Requested Items To Be Transferred",
+   "link_count": 0,
    "link_to": "Requested Items To Be Transferred",
    "link_type": "Report",
    "onboard": 0,
@@ -590,6 +652,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Batch Item Expiry Status",
+   "link_count": 0,
    "link_to": "Batch Item Expiry Status",
    "link_type": "Report",
    "onboard": 0,
@@ -600,6 +663,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Item Prices",
+   "link_count": 0,
    "link_to": "Item Prices",
    "link_type": "Report",
    "onboard": 0,
@@ -610,6 +674,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Itemwise Recommended Reorder Level",
+   "link_count": 0,
    "link_to": "Itemwise Recommended Reorder Level",
    "link_type": "Report",
    "onboard": 0,
@@ -620,6 +685,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Item Variant Details",
+   "link_count": 0,
    "link_to": "Item Variant Details",
    "link_type": "Report",
    "onboard": 0,
@@ -630,6 +696,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Subcontracted Raw Materials To Be Transferred",
+   "link_count": 0,
    "link_to": "Subcontracted Raw Materials To Be Transferred",
    "link_type": "Report",
    "onboard": 0,
@@ -640,6 +707,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Subcontracted Item To Be Received",
+   "link_count": 0,
    "link_to": "Subcontracted Item To Be Received",
    "link_type": "Report",
    "onboard": 0,
@@ -650,6 +718,7 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "Stock and Account Value Comparison",
+   "link_count": 0,
    "link_to": "Stock and Account Value Comparison",
    "link_type": "Report",
    "onboard": 0,
@@ -659,6 +728,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Incorrect Data Report",
+   "link_count": 0,
    "link_type": "DocType",
    "onboard": 0,
    "type": "Card Break"
@@ -667,6 +737,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Incorrect Serial No Qty and Valuation",
+   "link_count": 0,
    "link_to": "Incorrect Serial No Valuation",
    "link_type": "Report",
    "onboard": 0,
@@ -676,6 +747,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Incorrect Balance Qty After Transaction",
+   "link_count": 0,
    "link_to": "Incorrect Balance Qty After Transaction",
    "link_type": "Report",
    "onboard": 0,
@@ -685,20 +757,26 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Stock and Account Value Comparison",
+   "link_count": 0,
    "link_to": "Stock and Account Value Comparison",
    "link_type": "Report",
    "onboard": 0,
    "type": "Link"
   }
  ],
- "modified": "2021-05-13 13:10:24.914983",
+ "modified": "2021-08-05 12:16:02.361509",
  "modified_by": "Administrator",
  "module": "Stock",
  "name": "Stock",
  "onboarding": "Stock",
  "owner": "Administrator",
+ "parent_page": "",
  "pin_to_bottom": 0,
  "pin_to_top": 0,
+ "public": 1,
+ "restrict_to_domain": "",
+ "roles": [],
+ "sequence_id": 24,
  "shortcuts": [
   {
    "color": "Green",
@@ -753,5 +831,6 @@
    "type": "Dashboard"
   }
  ],
- "shortcuts_label": "Quick Access"
+ "shortcuts_label": "Quick Access",
+ "title": "Stock"
 }
\ No newline at end of file
diff --git a/erpnext/support/doctype/issue/issue.py b/erpnext/support/doctype/issue/issue.py
index 24dadd5..f28976e 100644
--- a/erpnext/support/doctype/issue/issue.py
+++ b/erpnext/support/doctype/issue/issue.py
@@ -116,7 +116,7 @@
 		}).insert(ignore_permissions=True)
 
 		return replicated_issue.name
-	
+
 	def reset_issue_metrics(self):
 		self.db_set("resolution_time", None)
 		self.db_set("user_resolution_time", None)
@@ -231,7 +231,7 @@
 
 def is_first_response(issue):
 	responses = frappe.get_all('Communication', filters = {'reference_name': issue.name, 'sent_or_received': 'Sent'})
-	if len(responses) == 1: 
+	if len(responses) == 1:
 		return True
 	return False
 
@@ -260,7 +260,7 @@
 			# both issue creation and first response were after working hours
 			else:
 				return 1.0		# this should ideally be zero, but it gets reset when the next response is sent if the value is zero
-			
+
 		else:
 			return 1.0
 
diff --git a/erpnext/support/doctype/issue/test_issue.py b/erpnext/support/doctype/issue/test_issue.py
index 84f8c39..739324f 100644
--- a/erpnext/support/doctype/issue/test_issue.py
+++ b/erpnext/support/doctype/issue/test_issue.py
@@ -13,6 +13,10 @@
 class TestSetUp(unittest.TestCase):
 	def setUp(self):
 		frappe.db.sql("delete from `tabService Level Agreement`")
+		frappe.db.sql("delete from `tabService Level Priority`")
+		frappe.db.sql("delete from `tabSLA Fulfilled On Status`")
+		frappe.db.sql("delete from `tabPause SLA On Status`")
+		frappe.db.sql("delete from `tabService Day`")
 		frappe.db.set_value("Support Settings", None, "track_service_level_agreement", 1)
 		create_service_level_agreements_for_issues()
 
diff --git a/erpnext/support/doctype/service_level_agreement/service_level_agreement.json b/erpnext/support/doctype/service_level_agreement/service_level_agreement.json
index ef14b29..b649b87 100644
--- a/erpnext/support/doctype/service_level_agreement/service_level_agreement.json
+++ b/erpnext/support/doctype/service_level_agreement/service_level_agreement.json
@@ -18,6 +18,10 @@
   "entity_type",
   "column_break_10",
   "entity",
+  "filters_section",
+  "condition",
+  "column_break_15",
+  "condition_description",
   "agreement_details_section",
   "start_date",
   "column_break_7",
@@ -176,10 +180,30 @@
    "fieldname": "apply_sla_for_resolution",
    "fieldtype": "Check",
    "label": "Apply SLA for Resolution Time"
+  },
+  {
+   "fieldname": "filters_section",
+   "fieldtype": "Section Break",
+   "label": "Assignment Condition"
+  },
+  {
+   "fieldname": "column_break_15",
+   "fieldtype": "Column Break"
+  },
+  {
+   "fieldname": "condition",
+   "fieldtype": "Code",
+   "label": "Condition",
+   "options": "Python"
+  },
+  {
+   "fieldname": "condition_description",
+   "fieldtype": "HTML",
+   "options": "<p><strong>Condition Examples:</strong></p>\n<pre>doc.status==\"Open\"<br>doc.due_date==nowdate()<br>doc.total &gt; 40000\n</pre>"
   }
  ],
  "links": [],
- "modified": "2021-07-08 12:28:46.283334",
+ "modified": "2021-07-27 11:16:45.596579",
  "modified_by": "Administrator",
  "module": "Support",
  "name": "Service Level Agreement",
@@ -213,4 +237,4 @@
  "sort_field": "modified",
  "sort_order": "DESC",
  "track_changes": 1
-}
\ No newline at end of file
+}
diff --git a/erpnext/support/doctype/service_level_agreement/service_level_agreement.py b/erpnext/support/doctype/service_level_agreement/service_level_agreement.py
index cfa264f..472e96c 100644
--- a/erpnext/support/doctype/service_level_agreement/service_level_agreement.py
+++ b/erpnext/support/doctype/service_level_agreement/service_level_agreement.py
@@ -3,14 +3,17 @@
 # For license information, please see license.txt
 
 from __future__ import unicode_literals
+
 import frappe
 from frappe.model.document import Document
 from frappe import _
 from frappe.core.utils import get_parent_doc
 from frappe.utils import time_diff_in_seconds, getdate, get_weekdays, add_to_date, get_time, get_datetime, \
-	get_time_zone, to_timedelta, get_datetime_str, get_link_to_form, cint
+	get_time_zone, to_timedelta, get_datetime_str, get_link_to_form, cint, nowdate
 from datetime import datetime
+from frappe.utils.safe_exec import get_safe_globals
 from erpnext.support.doctype.issue.issue import get_holidays
+from frappe.utils.safe_exec import get_safe_globals
 
 class ServiceLevelAgreement(Document):
 	def validate(self):
@@ -18,6 +21,7 @@
 		self.validate_status_field()
 		self.check_priorities()
 		self.check_support_and_resolution()
+		self.validate_condition()
 
 	def check_priorities(self):
 		priorities = []
@@ -96,6 +100,14 @@
 			frappe.throw(_("The Document Type {0} must have a Status field to configure Service Level Agreement").format(
 				frappe.bold(self.document_type)))
 
+	def validate_condition(self):
+		temp_doc = frappe.new_doc(self.document_type)
+		if self.condition:
+			try:
+				frappe.safe_eval(self.condition, None, get_context(temp_doc))
+			except Exception:
+				frappe.throw(_("The Condition '{0}' is invalid").format(self.condition))
+
 	def get_service_level_agreement_priority(self, priority):
 		priority = frappe.get_doc("Service Level Priority", {"priority": priority, "parent": self.name})
 
@@ -204,35 +216,51 @@
 		if doc.end_date and getdate(doc.end_date) < getdate(frappe.utils.getdate()):
 			frappe.db.set_value("Service Level Agreement", service_level_agreement.name, "enabled", 0)
 
-
-def get_active_service_level_agreement_for(doctype, priority, customer=None, service_level_agreement=None):
-	if doctype == "Issue" and not frappe.db.get_single_value("Support Settings", "track_service_level_agreement"):
+def get_active_service_level_agreement_for(doc):
+	if not frappe.db.get_single_value("Support Settings", "track_service_level_agreement"):
 		return
 
 	filters = [
-		["Service Level Agreement", "document_type", "=", doctype],
+		["Service Level Agreement", "document_type", "=", doc.get('doctype')],
 		["Service Level Agreement", "enabled", "=", 1]
 	]
-	if priority:
-		filters.append(["Service Level Priority", "priority", "=", priority])
+
+	if doc.get('priority'):
+		filters.append(["Service Level Priority", "priority", "=", doc.get('priority')])
 
 	or_filters = []
-	if service_level_agreement:
+	if doc.get('service_level_agreement'):
 		or_filters = [
-			["Service Level Agreement", "name", "=", service_level_agreement],
+			["Service Level Agreement", "name", "=", doc.get('service_level_agreement')],
 		]
 
-	if customer:
-		or_filters.append(
-			["Service Level Agreement", "entity", "in", [customer, get_customer_group(customer), get_customer_territory(customer)]]
-		)
-	or_filters.append(["Service Level Agreement", "default_service_level_agreement", "=", 1])
+	customer = doc.get('customer')
+	or_filters.append(
+		["Service Level Agreement", "entity", "in", [customer, get_customer_group(customer), get_customer_territory(customer)]]
+	)
 
-	agreement = frappe.get_all("Service Level Agreement", filters=filters, or_filters=or_filters,
-		fields=["name", "default_priority", "apply_sla_for_resolution"])
+	default_sla_filter = filters + [["Service Level Agreement", "default_service_level_agreement", "=", 1]]
+	default_sla = frappe.get_all("Service Level Agreement", filters=default_sla_filter,
+		fields=["name", "default_priority", "apply_sla_for_resolution", "condition"])
 
-	return agreement[0] if agreement else None
+	filters += [["Service Level Agreement", "default_service_level_agreement", "=", 0]]
+	agreements = frappe.get_all("Service Level Agreement", filters=filters, or_filters=or_filters,
+		fields=["name", "default_priority", "apply_sla_for_resolution", "condition"])
+	
+	# check if the current document on which SLA is to be applied fulfills all the conditions
+	filtered_agreements = []
+	for agreement in agreements:
+		condition = agreement.get('condition')
+		if not condition or (condition and frappe.safe_eval(condition, None, get_context(doc))):
+			filtered_agreements.append(agreement)
 
+	# if any default sla
+	filtered_agreements += default_sla
+
+	return filtered_agreements[0] if filtered_agreements else None
+
+def get_context(doc):
+	return {"doc": doc.as_dict(), "nowdate": nowdate, "frappe": frappe._dict(utils=get_safe_globals().get("frappe").get("utils"))}
 
 def get_customer_group(customer):
 	return frappe.db.get_value("Customer", customer, "customer_group") if customer else None
@@ -301,8 +329,7 @@
 		doc.doctype not in get_documents_with_active_service_level_agreement():
 		return
 
-	service_level_agreement = get_active_service_level_agreement_for(doctype=doc.get("doctype"), priority=doc.get("priority"),
-		customer=doc.get("customer"), service_level_agreement=doc.get("service_level_agreement"))
+	service_level_agreement = get_active_service_level_agreement_for(doc)
 
 	if not service_level_agreement:
 		return
diff --git a/erpnext/support/doctype/service_level_agreement/test_service_level_agreement.py b/erpnext/support/doctype/service_level_agreement/test_service_level_agreement.py
index 7bc97d6..1a5ff27 100644
--- a/erpnext/support/doctype/service_level_agreement/test_service_level_agreement.py
+++ b/erpnext/support/doctype/service_level_agreement/test_service_level_agreement.py
@@ -253,6 +253,26 @@
 		lead.reload()
 		self.assertEqual(lead.response_by_variance, 1800.0)
 
+	def test_service_level_agreement_filters(self):
+		doctype = "Lead"
+		lead_sla = create_service_level_agreement(
+			default_service_level_agreement=0,
+			doctype=doctype,
+			holiday_list="__Test Holiday List",
+			entity_type=None, entity=None,
+			condition='doc.source == "Test Source"',
+			response_time=14400,
+			sla_fulfilled_on=[{"status": "Replied"}],
+			apply_sla_for_resolution=0
+		)
+		creation = datetime.datetime(2019, 3, 4, 12, 0)
+		lead = make_lead(creation=creation, index=4)
+		self.assertFalse(lead.service_level_agreement)
+
+		lead.source = "Test Source"
+		lead.save()
+		self.assertEqual(lead.service_level_agreement, lead_sla.name)
+
 	def tearDown(self):
 		for d in frappe.get_all("Service Level Agreement"):
 			frappe.delete_doc("Service Level Agreement", d.name, force=1)
@@ -268,7 +288,7 @@
 	return service_level_agreement
 
 def create_service_level_agreement(default_service_level_agreement, holiday_list, response_time, entity_type,
-	entity, resolution_time=0, doctype="Issue", sla_fulfilled_on=[], pause_sla_on=[], apply_sla_for_resolution=1):
+	entity, resolution_time=0, doctype="Issue", condition="", sla_fulfilled_on=[], pause_sla_on=[], apply_sla_for_resolution=1):
 
 	make_holiday_list()
 	make_priorities()
@@ -287,6 +307,7 @@
 		"document_type": doctype,
 		"service_level": "__Test {} SLA".format(entity_type if entity_type else "Default"),
 		"default_service_level_agreement": default_service_level_agreement,
+		"condition": condition,
 		"default_priority": "Medium",
 		"holiday_list": holiday_list,
 		"entity_type": entity_type,
@@ -488,5 +509,6 @@
 		"lead_name": "_Test Lead {0}".format(index),
 		"status": "Open",
 		"creation": creation,
-		"service_level_agreement_creation": creation
+		"service_level_agreement_creation": creation,
+		"priority": "Medium"
 	}).insert(ignore_permissions=True)
\ No newline at end of file
diff --git a/erpnext/support/workspace/support/support.json b/erpnext/support/workspace/support/support.json
index 01a8676..4c5829d 100644
--- a/erpnext/support/workspace/support/support.json
+++ b/erpnext/support/workspace/support/support.json
@@ -1,22 +1,27 @@
 {
- "category": "Modules",
+ "category": "",
  "charts": [],
+ "content": "[{\"type\": \"header\", \"data\": {\"text\": \"Your Shortcuts\", \"level\": 4, \"col\": 12}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Issue\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Maintenance Visit\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Service Level Agreement\", \"col\": 4}}, {\"type\": \"spacer\", \"data\": {\"col\": 12}}, {\"type\": \"header\", \"data\": {\"text\": \"Reports & Masters\", \"level\": 4, \"col\": 12}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Issues\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Maintenance\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Service Level Agreement\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Warranty\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Settings\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Reports\", \"col\": 4}}]",
  "creation": "2020-03-02 15:48:23.224699",
  "developer_mode_only": 0,
  "disable_user_customization": 0,
  "docstatus": 0,
  "doctype": "Workspace",
+ "extends": "",
  "extends_another_page": 0,
+ "for_user": "",
  "hide_custom": 0,
  "icon": "support",
  "idx": 0,
- "is_standard": 1,
+ "is_default": 0,
+ "is_standard": 0,
  "label": "Support",
  "links": [
   {
    "hidden": 0,
    "is_query_report": 0,
    "label": "Issues",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -25,6 +30,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Issue",
+   "link_count": 0,
    "link_to": "Issue",
    "link_type": "DocType",
    "onboard": 1,
@@ -35,6 +41,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Issue Type",
+   "link_count": 0,
    "link_to": "Issue Type",
    "link_type": "DocType",
    "onboard": 0,
@@ -45,6 +52,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Issue Priority",
+   "link_count": 0,
    "link_to": "Issue Priority",
    "link_type": "DocType",
    "onboard": 0,
@@ -54,6 +62,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Maintenance",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -62,6 +71,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Maintenance Schedule",
+   "link_count": 0,
    "link_to": "Maintenance Schedule",
    "link_type": "DocType",
    "onboard": 0,
@@ -72,6 +82,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Maintenance Visit",
+   "link_count": 0,
    "link_to": "Maintenance Visit",
    "link_type": "DocType",
    "onboard": 0,
@@ -81,6 +92,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Service Level Agreement",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -89,6 +101,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Service Level Agreement",
+   "link_count": 0,
    "link_to": "Service Level Agreement",
    "link_type": "DocType",
    "onboard": 0,
@@ -98,6 +111,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Warranty",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -106,6 +120,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Warranty Claim",
+   "link_count": 0,
    "link_to": "Warranty Claim",
    "link_type": "DocType",
    "onboard": 0,
@@ -116,6 +131,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Serial No",
+   "link_count": 0,
    "link_to": "Serial No",
    "link_type": "DocType",
    "onboard": 0,
@@ -125,6 +141,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Settings",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -133,6 +150,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Support Settings",
+   "link_count": 0,
    "link_to": "Support Settings",
    "link_type": "DocType",
    "onboard": 0,
@@ -142,6 +160,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Reports",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -150,19 +169,26 @@
    "hidden": 0,
    "is_query_report": 1,
    "label": "First Response Time for Issues",
+   "link_count": 0,
    "link_to": "First Response Time for Issues",
    "link_type": "Report",
    "onboard": 0,
    "type": "Link"
   }
  ],
- "modified": "2020-12-01 13:38:37.073482",
+ "modified": "2021-08-05 12:16:02.699923",
  "modified_by": "Administrator",
  "module": "Support",
  "name": "Support",
+ "onboarding": "",
  "owner": "Administrator",
+ "parent_page": "",
  "pin_to_bottom": 0,
  "pin_to_top": 0,
+ "public": 1,
+ "restrict_to_domain": "",
+ "roles": [],
+ "sequence_id": 25,
  "shortcuts": [
   {
    "color": "Yellow",
@@ -182,5 +208,6 @@
    "link_to": "Service Level Agreement",
    "type": "DocType"
   }
- ]
+ ],
+ "title": "Support"
 }
\ No newline at end of file
diff --git a/erpnext/tests/ui_test_helpers.py b/erpnext/tests/ui_test_helpers.py
new file mode 100644
index 0000000..fc3aa29
--- /dev/null
+++ b/erpnext/tests/ui_test_helpers.py
@@ -0,0 +1,59 @@
+import frappe
+from frappe.utils import getdate
+
+@frappe.whitelist()
+def create_employee_records():
+	create_company()
+	create_missing_designation()
+
+	emp1 = create_employee('Test Employee 1', 'CEO')
+	emp2 = create_employee('Test Employee 2', 'CTO')
+	emp3 = create_employee('Test Employee 3', 'Head of Marketing and Sales', emp1)
+	emp4 = create_employee('Test Employee 4', 'Project Manager', emp2)
+	emp5 = create_employee('Test Employee 5', 'Engineer', emp2)
+	emp6 = create_employee('Test Employee 6', 'Analyst', emp3)
+	emp7 = create_employee('Test Employee 7', 'Software Developer', emp4)
+
+	employees = [emp1, emp2, emp3, emp4, emp5, emp6, emp7]
+	return employees
+
+@frappe.whitelist()
+def get_employee_records():
+	return frappe.db.get_list('Employee', filters={
+		'company': 'Test Org Chart'
+	}, pluck='name', order_by='name')
+
+def create_company():
+	company = frappe.db.exists('Company', 'Test Org Chart')
+	if not company:
+		company = frappe.get_doc({
+			'doctype': 'Company',
+			'company_name': 'Test Org Chart',
+			'country': 'India',
+			'default_currency': 'INR'
+		}).insert().name
+
+	return company
+
+def create_employee(first_name, designation, reports_to=None):
+	employee = frappe.db.exists('Employee', {'first_name': first_name, 'designation': designation})
+	if not employee:
+		employee = frappe.get_doc({
+			'doctype': 'Employee',
+			'first_name': first_name,
+			'company': 'Test Org Chart',
+			'gender': 'Female',
+			'date_of_birth': getdate('08-12-1998'),
+			'date_of_joining': getdate('01-01-2021'),
+			'designation': designation,
+			'reports_to': reports_to
+		}).insert().name
+
+	return employee
+
+def create_missing_designation():
+	if not frappe.db.exists('Designation', 'CTO'):
+		frappe.get_doc({
+			'doctype': 'Designation',
+			'designation_name': 'CTO'
+		}).insert()
\ No newline at end of file
diff --git a/erpnext/utilities/hierarchy_chart.py b/erpnext/utilities/hierarchy_chart.py
new file mode 100644
index 0000000..fb58a5d
--- /dev/null
+++ b/erpnext/utilities/hierarchy_chart.py
@@ -0,0 +1,29 @@
+# Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and Contributors
+# MIT License. See license.txt
+
+from __future__ import unicode_literals
+import frappe
+from frappe import _
+
+@frappe.whitelist()
+def get_all_nodes(parent, parent_name, method, company):
+	'''Recursively gets all data from nodes'''
+	method = frappe.get_attr(method)
+
+	if method not in frappe.whitelisted:
+		frappe.throw(_('Not Permitted'), frappe.PermissionError)
+
+	data = method(parent, company)
+	result = [dict(parent=parent, parent_name=parent_name, data=data)]
+
+	nodes_to_expand = [{'id': d.get('id'), 'name': d.get('name')} for d in data if d.get('expandable')]
+
+	while nodes_to_expand:
+		parent = nodes_to_expand.pop(0)
+		data = method(parent.get('id'), company)
+		result.append(dict(parent=parent.get('id'), parent_name=parent.get('name'), data=data))
+		for d in data:
+			if d.get('expandable'):
+				nodes_to_expand.append({'id': d.get('id'), 'name': d.get('name')})
+
+	return result
\ No newline at end of file
diff --git a/erpnext/utilities/workspace/utilities/utilities.json b/erpnext/utilities/workspace/utilities/utilities.json
index 2f9250e..4ad4afb 100644
--- a/erpnext/utilities/workspace/utilities/utilities.json
+++ b/erpnext/utilities/workspace/utilities/utilities.json
@@ -1,21 +1,26 @@
 {
- "category": "Modules",
+ "category": "",
  "charts": [],
+ "content": "[{\"type\": \"header\", \"data\": {\"text\": \"Reports & Masters\", \"level\": 4, \"col\": 12}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Video\", \"col\": 4}}]",
  "creation": "2020-09-10 12:21:22.335307",
  "developer_mode_only": 0,
  "disable_user_customization": 0,
  "docstatus": 0,
  "doctype": "Workspace",
+ "extends": "",
  "extends_another_page": 0,
+ "for_user": "",
  "hide_custom": 0,
  "idx": 0,
- "is_standard": 1,
+ "is_default": 0,
+ "is_standard": 0,
  "label": "Utilities",
  "links": [
   {
    "hidden": 0,
    "is_query_report": 0,
    "label": "Video",
+   "link_count": 0,
    "onboard": 0,
    "type": "Card Break"
   },
@@ -24,6 +29,7 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Video",
+   "link_count": 0,
    "link_to": "Video",
    "link_type": "DocType",
    "onboard": 0,
@@ -34,18 +40,26 @@
    "hidden": 0,
    "is_query_report": 0,
    "label": "Video Settings",
+   "link_count": 0,
    "link_to": "Video Settings",
    "link_type": "DocType",
    "onboard": 0,
    "type": "Link"
   }
  ],
- "modified": "2020-12-01 13:38:36.711884",
+ "modified": "2021-08-05 12:16:03.350804",
  "modified_by": "Administrator",
  "module": "Utilities",
  "name": "Utilities",
+ "onboarding": "",
  "owner": "user@erpnext.com",
- "pin_to_bottom": 1,
+ "parent_page": "",
+ "pin_to_bottom": 0,
  "pin_to_top": 0,
- "shortcuts": []
+ "public": 1,
+ "restrict_to_domain": "",
+ "roles": [],
+ "sequence_id": 30,
+ "shortcuts": [],
+ "title": "Utilities"
 }
\ No newline at end of file
diff --git a/package.json b/package.json
index c9ee7a6..5bc1e56 100644
--- a/package.json
+++ b/package.json
@@ -15,7 +15,8 @@
     "snyk": "^1.518.0"
   },
   "dependencies": {
-    "onscan.js": "^1.5.2"
+    "onscan.js": "^1.5.2",
+    "html2canvas": "^1.1.4"
   },
   "scripts": {
     "snyk-protect": "snyk protect",
diff --git a/yarn.lock b/yarn.lock
index 242695c..82e9821 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -688,6 +688,11 @@
   resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767"
   integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c=
 
+base64-arraybuffer@^0.2.0:
+  version "0.2.0"
+  resolved "https://registry.yarnpkg.com/base64-arraybuffer/-/base64-arraybuffer-0.2.0.tgz#4b944fac0191aa5907afe2d8c999ccc57ce80f45"
+  integrity sha512-7emyCsu1/xiBXgQZrscw/8KPRT44I4Yq9Pe6EGs3aPRTsWuggML1/1DTuZUuIaJPIm1FTDUVXl4x/yW8s0kQDQ==
+
 base64-js@^1.3.1:
   version "1.5.1"
   resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a"
@@ -997,6 +1002,13 @@
   resolved "https://registry.yarnpkg.com/crypto-random-string/-/crypto-random-string-2.0.0.tgz#ef2a7a966ec11083388369baa02ebead229b30d5"
   integrity sha512-v1plID3y9r/lPhviJ1wrXpLeyUIGAZ2SHNYTEapm7/8A9nLPoyvVp3RK/EPFqn5kEznyWgYZNsRtYYIWbuG8KA==
 
+css-line-break@1.1.1:
+  version "1.1.1"
+  resolved "https://registry.yarnpkg.com/css-line-break/-/css-line-break-1.1.1.tgz#d5e9bdd297840099eb0503c7310fd34927a026ef"
+  integrity sha512-1feNVaM4Fyzdj4mKPIQNL2n70MmuYzAXZ1aytlROFX1JsOo070OsugwGjj7nl6jnDJWHDM8zRZswkmeYVWZJQA==
+  dependencies:
+    base64-arraybuffer "^0.2.0"
+
 debug@^3.1.0, debug@^3.2.6:
   version "3.2.6"
   resolved "https://registry.yarnpkg.com/debug/-/debug-3.2.6.tgz#e83d17de16d8a7efb7717edbe5fb10135eee629b"
@@ -1472,6 +1484,13 @@
   dependencies:
     lru-cache "^6.0.0"
 
+html2canvas@^1.1.4:
+  version "1.1.4"
+  resolved "https://registry.yarnpkg.com/html2canvas/-/html2canvas-1.1.4.tgz#53ae91cd26e9e9e623c56533cccb2e3f57c8124c"
+  integrity sha512-uHgQDwrXsRmFdnlOVFvHin9R7mdjjZvoBoXxicPR+NnucngkaLa5zIDW9fzMkiip0jSffyTyWedE8iVogYOeWg==
+  dependencies:
+    css-line-break "1.1.1"
+
 http-cache-semantics@^4.0.0:
   version "4.1.0"
   resolved "https://registry.yarnpkg.com/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz#49e91c5cbf36c9b94bcfcd71c23d5249ec74e390"