Merge pull request #17947 from deepeshgarg007/gstr-3b-pos-fixes

fix: GSTR-3b Report fixes
diff --git a/erpnext/config/buying.py b/erpnext/config/buying.py
index 264f88f..d1b0d91 100644
--- a/erpnext/config/buying.py
+++ b/erpnext/config/buying.py
@@ -72,9 +72,14 @@
 				},
 				{
 					"type": "doctype",
+					"name": "Promotional Scheme",
+					"description": _("Rules for applying different promotional schemes.")
+				},
+				{
+					"type": "doctype",
 					"name": "Pricing Rule",
 					"description": _("Rules for applying pricing and discount.")
-				},
+				}
 			]
 		},
 		{
diff --git a/erpnext/config/selling.py b/erpnext/config/selling.py
index 9209ca9..b31eb02 100644
--- a/erpnext/config/selling.py
+++ b/erpnext/config/selling.py
@@ -113,6 +113,11 @@
 				},
 				{
 					"type": "doctype",
+					"name": "Promotional Scheme",
+					"description": _("Rules for applying different promotional schemes.")
+				},
+				{
+					"type": "doctype",
 					"name": "Pricing Rule",
 					"description": _("Rules for applying pricing and discount."),
 					"dependencies": ["Item"],
diff --git a/erpnext/controllers/queries.py b/erpnext/controllers/queries.py
index 0dcf077..ccd334f 100644
--- a/erpnext/controllers/queries.py
+++ b/erpnext/controllers/queries.py
@@ -152,9 +152,6 @@
 def item_query(doctype, txt, searchfield, start, page_len, filters, as_dict=False):
 	conditions = []
 
-	if not filters["item_group"]:
-		filters.pop("item_group", None)
-
 	description_cond = ''
 	if frappe.db.count('Item', cache=True) < 50000:
 		# scan description only if items are less than 50000
diff --git a/erpnext/hr/doctype/appraisal_template/appraisal_template_dashboard.py b/erpnext/hr/doctype/appraisal_template/appraisal_template_dashboard.py
new file mode 100644
index 0000000..309427e
--- /dev/null
+++ b/erpnext/hr/doctype/appraisal_template/appraisal_template_dashboard.py
@@ -0,0 +1,12 @@
+from __future__ import unicode_literals
+from frappe import _
+
+def get_data():
+     return {
+        'fieldname': 'kra_template',
+        'transactions': [
+            {
+                'items': ['Appraisal']
+            },
+        ],
+    }
\ No newline at end of file
diff --git a/erpnext/hr/doctype/employee/employee_dashboard.py b/erpnext/hr/doctype/employee/employee_dashboard.py
index 46461da..e3cc33d 100644
--- a/erpnext/hr/doctype/employee/employee_dashboard.py
+++ b/erpnext/hr/doctype/employee/employee_dashboard.py
@@ -12,24 +12,32 @@
 				'items': ['Attendance', 'Attendance Request', 'Leave Application', 'Leave Allocation']
 			},
 			{
-				'label': _('Payroll'),
-				'items': ['Salary Structure Assignment', 'Salary Slip', 'Timesheet']
+				'label': _('Lifecycle'),
+				'items': ['Employee Transfer', 'Employee Promotion', 'Employee Separation']
+			},
+			{
+				'label': _('Shift'),
+				'items': ['Shift Request', 'Shift Assignment']
 			},
 			{
 				'label': _('Expense'),
-				'items': ['Expense Claim']
+				'items': ['Expense Claim', 'Travel Request']
+			},
+			{
+				'label': _('Benefit'),
+				'items': ['Employee Benefit Application', 'Employee Benefit Claim']
 			},
 			{
 				'label': _('Evaluation'),
 				'items': ['Appraisal']
 			},
 			{
-				'label': _('Training'),
-				'items': ['Training Event', 'Training Result']
+				'label': _('Payroll'),
+				'items': ['Salary Structure Assignment', 'Salary Slip', 'Additional Salary', 'Timesheet','Employee Incentive', 'Retention Bonus']
 			},
 			{
-				'label': _('Lifecycle'),
-				'items': ['Employee Transfer', 'Employee Promotion', 'Employee Separation']
-			}
+				'label': _('Training'),
+				'items': ['Training Event', 'Training Result', 'Training Feedback', 'Employee Skill Map']
+			},
 		]
 	}
\ No newline at end of file
diff --git a/erpnext/hr/doctype/employee_onboarding_template/employee_onboarding_template_dashboard.py b/erpnext/hr/doctype/employee_onboarding_template/employee_onboarding_template_dashboard.py
new file mode 100644
index 0000000..837da53
--- /dev/null
+++ b/erpnext/hr/doctype/employee_onboarding_template/employee_onboarding_template_dashboard.py
@@ -0,0 +1,12 @@
+from __future__ import unicode_literals
+from frappe import _
+
+def get_data():
+     return {
+        'fieldname': 'employee_onboarding_template',
+        'transactions': [
+            {
+                'items': ['Employee Onboarding']
+            },
+        ],
+    }
\ No newline at end of file
diff --git a/erpnext/hr/doctype/employee_separation_template/employee_separation_template_dashboard.py b/erpnext/hr/doctype/employee_separation_template/employee_separation_template_dashboard.py
new file mode 100644
index 0000000..39345f0
--- /dev/null
+++ b/erpnext/hr/doctype/employee_separation_template/employee_separation_template_dashboard.py
@@ -0,0 +1,12 @@
+from __future__ import unicode_literals
+from frappe import _
+
+def get_data():
+     return {
+        'fieldname': 'employee_separation_template',
+        'transactions': [
+            {
+                'items': ['Employee Separation']
+            },
+        ],
+    }
\ No newline at end of file
diff --git a/erpnext/hr/doctype/holiday_list/holiday_list_dashboard.py b/erpnext/hr/doctype/holiday_list/holiday_list_dashboard.py
index d1599a4..22e1de0 100644
--- a/erpnext/hr/doctype/holiday_list/holiday_list_dashboard.py
+++ b/erpnext/hr/doctype/holiday_list/holiday_list_dashboard.py
@@ -13,6 +13,9 @@
 			},
 			{
 				'items': ['Leave Period', 'Shift Type']
+			},
+			{
+				'items': ['Service Level', 'Service Level Agreement']
 			}
 		]
 	}
\ No newline at end of file
diff --git a/erpnext/hr/doctype/job_applicant/job_applicant_dashboard.py b/erpnext/hr/doctype/job_applicant/job_applicant_dashboard.py
new file mode 100644
index 0000000..7f13115
--- /dev/null
+++ b/erpnext/hr/doctype/job_applicant/job_applicant_dashboard.py
@@ -0,0 +1,15 @@
+from __future__ import unicode_literals
+from frappe import _
+
+def get_data():
+     return {
+        'fieldname': 'job_applicant',
+        'transactions': [
+            {
+                'items': ['Employee', 'Employee Onboarding']
+            },
+            {
+                'items': ['Job Offer']
+            },
+        ],
+    }
\ No newline at end of file
diff --git a/erpnext/hr/doctype/job_opening/job_opening_dashboard.py b/erpnext/hr/doctype/job_opening/job_opening_dashboard.py
new file mode 100644
index 0000000..c0890b4
--- /dev/null
+++ b/erpnext/hr/doctype/job_opening/job_opening_dashboard.py
@@ -0,0 +1,12 @@
+from __future__ import unicode_literals
+from frappe import _
+
+def get_data():
+     return {
+        'fieldname': 'job_title',
+        'transactions': [
+            {
+                'items': ['Job Applicant']
+            }
+        ],
+    }
\ No newline at end of file
diff --git a/erpnext/hr/doctype/leave_allocation/leave_allocation_dashboard.py b/erpnext/hr/doctype/leave_allocation/leave_allocation_dashboard.py
new file mode 100644
index 0000000..72a1b7c
--- /dev/null
+++ b/erpnext/hr/doctype/leave_allocation/leave_allocation_dashboard.py
@@ -0,0 +1,15 @@
+from __future__ import unicode_literals
+from frappe import _
+
+def get_data():
+     return {
+        'fieldname': 'leave_allocation',
+        'transactions': [
+            {
+                'items': ['Compensatory Leave Request']
+            },
+            {
+                'items': ['Leave Encashment']
+            }
+        ],
+    }
\ No newline at end of file
diff --git a/erpnext/hr/doctype/loan_application/loan_application_dashboard.py b/erpnext/hr/doctype/loan_application/loan_application_dashboard.py
new file mode 100644
index 0000000..232c6e3
--- /dev/null
+++ b/erpnext/hr/doctype/loan_application/loan_application_dashboard.py
@@ -0,0 +1,12 @@
+from __future__ import unicode_literals
+from frappe import _
+
+def get_data():
+     return {
+        'fieldname': 'loan_application',
+        'transactions': [
+            {
+                'items': ['Loan']
+            },
+        ],
+    }
\ No newline at end of file
diff --git a/erpnext/hr/doctype/loan_type/loan_type_dashboard.py b/erpnext/hr/doctype/loan_type/loan_type_dashboard.py
new file mode 100644
index 0000000..07b11fe
--- /dev/null
+++ b/erpnext/hr/doctype/loan_type/loan_type_dashboard.py
@@ -0,0 +1,12 @@
+from __future__ import unicode_literals
+from frappe import _
+
+def get_data():
+     return {
+        'fieldname': 'loan_type',
+        'transactions': [
+            {
+                'items': ['Loan Application']
+            },
+        ],
+    }
\ No newline at end of file
diff --git a/erpnext/hr/doctype/payroll_period/payroll_period_dashboard.py b/erpnext/hr/doctype/payroll_period/payroll_period_dashboard.py
new file mode 100644
index 0000000..4e9c7c9
--- /dev/null
+++ b/erpnext/hr/doctype/payroll_period/payroll_period_dashboard.py
@@ -0,0 +1,12 @@
+from __future__ import unicode_literals
+from frappe import _
+
+def get_data():
+     return {
+        'fieldname': 'payroll_period',
+        'transactions': [
+            {
+                'items': ['Employee Tax Exemption Proof Submission', 'Employee Tax Exemption Declaration']
+            },
+        ],
+    }
\ No newline at end of file
diff --git a/erpnext/hr/doctype/salary_structure/salary_structure_dashboard.py b/erpnext/hr/doctype/salary_structure/salary_structure_dashboard.py
index 3803c1d..547f2b8 100644
--- a/erpnext/hr/doctype/salary_structure/salary_structure_dashboard.py
+++ b/erpnext/hr/doctype/salary_structure/salary_structure_dashboard.py
@@ -4,9 +4,15 @@
 def get_data():
 	return {
 		'fieldname': 'salary_structure',
+		'non_standard_fieldnames': {
+			'Employee Grade': 'default_salary_structure'
+		},
 		'transactions': [
 			{
-				'items': ['Salary Structure Assignment']
-			}
+				'items': ['Salary Structure Assignment', 'Salary Slip']
+			},
+			{
+				'items': ['Employee Grade']
+			},
 		]
 	}
\ No newline at end of file
diff --git a/erpnext/hr/doctype/shift_request/shift_request_dashboard.py b/erpnext/hr/doctype/shift_request/shift_request_dashboard.py
new file mode 100644
index 0000000..e3bf5df
--- /dev/null
+++ b/erpnext/hr/doctype/shift_request/shift_request_dashboard.py
@@ -0,0 +1,12 @@
+from __future__ import unicode_literals
+from frappe import _
+
+def get_data():
+     return {
+        'fieldname': 'shift_request',
+        'transactions': [
+            {
+                'items': ['Shift Assignment']
+            },
+        ],
+    }
\ No newline at end of file
diff --git a/erpnext/hr/doctype/shift_type/shift_type_dashboard.py b/erpnext/hr/doctype/shift_type/shift_type_dashboard.py
new file mode 100644
index 0000000..91dfbad
--- /dev/null
+++ b/erpnext/hr/doctype/shift_type/shift_type_dashboard.py
@@ -0,0 +1,12 @@
+from __future__ import unicode_literals
+from frappe import _
+
+def get_data():
+     return {
+        'fieldname': 'shift_type',
+        'transactions': [
+            {
+                'items': ['Shift Request', 'Shift Assignment']
+            }
+        ],
+    }
\ No newline at end of file
diff --git a/erpnext/hr/doctype/staffing_plan/staffing_plan_dashboard.py b/erpnext/hr/doctype/staffing_plan/staffing_plan_dashboard.py
new file mode 100644
index 0000000..35a303f
--- /dev/null
+++ b/erpnext/hr/doctype/staffing_plan/staffing_plan_dashboard.py
@@ -0,0 +1,12 @@
+from __future__ import unicode_literals
+from frappe import _
+
+def get_data():
+     return {
+        'fieldname': 'staffing_plan',
+        'transactions': [
+            {
+                'items': ['Job Opening']
+            }
+        ],
+    }
\ No newline at end of file
diff --git a/erpnext/hr/doctype/training_event/training_event_dashboard.py b/erpnext/hr/doctype/training_event/training_event_dashboard.py
new file mode 100644
index 0000000..1c1645c
--- /dev/null
+++ b/erpnext/hr/doctype/training_event/training_event_dashboard.py
@@ -0,0 +1,12 @@
+from __future__ import unicode_literals
+from frappe import _
+
+def get_data():
+     return {
+        'fieldname': 'training_event',
+        'transactions': [
+            {
+                'items': ['Training Result', 'Training Feedback']
+            },
+        ],
+    }
\ No newline at end of file
diff --git a/erpnext/hr/doctype/vehicle/vehicle_dashboard.py b/erpnext/hr/doctype/vehicle/vehicle_dashboard.py
index d27c7ac..761c701 100644
--- a/erpnext/hr/doctype/vehicle/vehicle_dashboard.py
+++ b/erpnext/hr/doctype/vehicle/vehicle_dashboard.py
@@ -1,14 +1,20 @@
 from __future__ import unicode_literals
 from frappe import _
 
-data = {
-	'heatmap': True,
-	'heatmap_message': _('This is based on logs against this Vehicle. See timeline below for details'),
-	'fieldname': 'license_plate',
-	'transactions': [
-		{
-			'label': _('Logs'),
-			'items': ['Vehicle Log']
-		}
-	]
-}
\ No newline at end of file
+def get_data():
+	return {
+		'heatmap': True,
+		'heatmap_message': _('This is based on logs against this Vehicle. See timeline below for details'),
+		'fieldname': 'license_plate',
+		'non_standard_fieldnames':{
+			'Delivery Trip': 'vehicle'
+		},
+		'transactions': [
+			{
+				'items': ['Vehicle Log']
+			},
+			{
+				'items': ['Delivery Trip']
+			}
+		]
+	}
\ No newline at end of file
diff --git a/erpnext/manufacturing/doctype/work_order/work_order.js b/erpnext/manufacturing/doctype/work_order/work_order.js
index 580243f..22613cc 100644
--- a/erpnext/manufacturing/doctype/work_order/work_order.js
+++ b/erpnext/manufacturing/doctype/work_order/work_order.js
@@ -72,9 +72,10 @@
 		frm.set_query("production_item", function() {
 			return {
 				query: "erpnext.controllers.queries.item_query",
-				filters:{
-					'is_stock_item': 1,
-				}
+				filters:[
+					['is_stock_item', '=',1],
+					['default_bom', '!=', '']
+				]
 			}
 		});
 
diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js
index 2151364..e82aa2c 100644
--- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js
+++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js
@@ -107,6 +107,8 @@
 
 				cur_frm.add_custom_button(__('Return'), this.make_purchase_return, __('Create'));
 
+				cur_frm.add_custom_button(__('Make Stock Entry'), cur_frm.cscript['Make Stock Entry'], __('Create'));
+
 				if(flt(this.frm.doc.per_billed) < 100) {
 					cur_frm.add_custom_button(__('Invoice'), this.make_purchase_invoice, __('Create'));
 				}
@@ -249,6 +251,13 @@
 	},
 });
 
+cur_frm.cscript['Make Stock Entry'] = function() {
+	frappe.model.open_mapped_doc({
+		method: "erpnext.stock.doctype.purchase_receipt.purchase_receipt.make_stock_entry",
+		frm: cur_frm,
+	})
+}
+
 var validate_sample_quantity = function(frm, cdt, cdn) {
 	var d = locals[cdt][cdn];
 	if (d.sample_quantity) {
diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
index 1a469c5..cdca44d 100644
--- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
+++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
@@ -12,6 +12,7 @@
 from erpnext.controllers.buying_controller import BuyingController
 from erpnext.accounts.utils import get_account_currency
 from frappe.desk.notifications import clear_doctype_notifications
+from frappe.model.mapper import get_mapped_doc
 from erpnext.buying.utils import check_on_hold_or_closed_status
 from erpnext.assets.doctype.asset.asset import get_asset_account, is_cwip_accounting_disabled
 from six import iteritems
@@ -530,3 +531,24 @@
 def update_purchase_receipt_status(docname, status):
 	pr = frappe.get_doc("Purchase Receipt", docname)
 	pr.update_status(status)
+
+@frappe.whitelist()
+def make_stock_entry(source_name,target_doc=None):
+	def set_missing_values(source, target):
+		target.stock_entry_type = "Material Transfer"
+		target.purpose =  "Material Transfer"
+
+	doclist = get_mapped_doc("Purchase Receipt", source_name,{
+		"Purchase Receipt": {
+			"doctype": "Stock Entry",
+		},
+		"Purchase Receipt Item": {
+			"doctype": "Stock Entry Detail",
+			"field_map": {
+				"warehouse": "s_warehouse",
+				"parent": "reference_purchase_receipt"
+			},
+		},
+	}, target_doc, set_missing_values)
+
+	return doclist
diff --git a/erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.json b/erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.json
index 8834035..5933700 100644
--- a/erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.json
+++ b/erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.json
@@ -13,6 +13,7 @@
   "t_warehouse",
   "sec_break1",
   "item_code",
+  "item_group",
   "col_break2",
   "item_name",
   "section_break_8",
@@ -59,7 +60,8 @@
   "against_stock_entry",
   "ste_detail",
   "column_break_51",
-  "transferred_qty"
+  "transferred_qty",
+  "reference_purchase_receipt"
  ],
  "fields": [
   {
@@ -72,7 +74,6 @@
    "fieldtype": "Section Break"
   },
   {
-   "columns": 2,
    "fieldname": "s_warehouse",
    "fieldtype": "Link",
    "in_list_view": 1,
@@ -86,7 +87,6 @@
    "fieldtype": "Column Break"
   },
   {
-   "columns": 2,
    "fieldname": "t_warehouse",
    "fieldtype": "Link",
    "in_list_view": 1,
@@ -101,7 +101,6 @@
   },
   {
    "bold": 1,
-   "columns": 3,
    "fieldname": "item_code",
    "fieldtype": "Link",
    "in_global_search": 1,
@@ -164,7 +163,6 @@
   },
   {
    "bold": 1,
-   "columns": 3,
    "fieldname": "qty",
    "fieldtype": "Float",
    "in_list_view": 1,
@@ -460,15 +458,30 @@
   {
    "fieldname": "dimension_col_break",
    "fieldtype": "Column Break"
+  },
+  {
+   "fetch_from": "item_code.item_group",
+   "fieldname": "item_group",
+   "fieldtype": "Data",
+   "in_list_view": 1,
+   "label": "Item Group"
+  },
+  {
+   "fieldname": "reference_purchase_receipt",
+   "fieldtype": "Link",
+   "label": "Reference Purchase Receipt",
+   "options": "Purchase Receipt",
+   "read_only": 1
   }
  ],
  "idx": 1,
  "istable": 1,
- "modified": "2019-05-25 22:51:00.802226",
+ "modified": "2019-06-14 11:58:41.958144",
  "modified_by": "Administrator",
  "module": "Stock",
  "name": "Stock Entry Detail",
  "owner": "Administrator",
  "permissions": [],
+ "sort_field": "modified",
  "sort_order": "ASC"
 }
\ No newline at end of file
diff --git a/erpnext/stock/report/stock_balance/stock_balance.js b/erpnext/stock/report/stock_balance/stock_balance.js
index 120f879..3829d6a 100644
--- a/erpnext/stock/report/stock_balance/stock_balance.js
+++ b/erpnext/stock/report/stock_balance/stock_balance.js
@@ -41,9 +41,6 @@
 			"get_query": function() {
 				return {
 					query: "erpnext.controllers.queries.item_query",
-					filters: {
-						"item_group": frappe.query_report.get_filter_value("item_group")
-					}
 				}
 			}
 		},
diff --git a/erpnext/templates/pages/home.html b/erpnext/templates/pages/home.html
index b67a465..2ef9c10 100644
--- a/erpnext/templates/pages/home.html
+++ b/erpnext/templates/pages/home.html
@@ -33,7 +33,7 @@
 			{% for item in homepage.products %}
 			<div class="col-md-4 mb-4">
 				<div class="card h-100 justify-content-between">
-					<div class="website-image-lazy" data-class="card-img-top h-100" data-src="{{ item.image }}" data-alt="{{ item.item_name }}"></div>
+					<div class="website-image-lazy" data-class="card-img-top website-image-extra-large" data-src="{{ item.image }}" data-alt="{{ item.item_name }}"></div>
 					<div class="card-body flex-grow-0">
 						<h5 class="card-title">{{ item.item_name }}</h5>
 						<a href="{{ item.route }}" class="card-link">{{ _('More details') }}</a>