Merge pull request #16225 from rohitwaghchaure/not_able_to_make_po_from_mr
[Fix] Get items from material request not working for PO
diff --git a/erpnext/education/report/student_fee_collection/student_fee_collection.json b/erpnext/education/report/student_fee_collection/student_fee_collection.json
index 07fc27c..eb945cf 100644
--- a/erpnext/education/report/student_fee_collection/student_fee_collection.json
+++ b/erpnext/education/report/student_fee_collection/student_fee_collection.json
@@ -1,18 +1,18 @@
{
"add_total_row": 0,
- "apply_user_permissions": 1,
"creation": "2016-06-22 02:58:41.024538",
"disabled": 0,
"docstatus": 0,
"doctype": "Report",
"idx": 3,
"is_standard": "Yes",
- "modified": "2017-11-10 19:41:37.320224",
+ "modified": "2018-12-17 16:46:46.176620",
"modified_by": "Administrator",
"module": "Education",
"name": "Student Fee Collection",
"owner": "Administrator",
- "query": "SELECT\n student as \"Student:Link/Student:200\",\n student_name as \"Student Name::200\",\n sum(paid_amount) as \"Paid Amount:Currency:150\",\n sum(outstanding_amount) as \"Outstanding Amount:Currency:150\",\n sum(grand_total) as \"Grand Total:Currency:150\"\nFROM\n `tabFees` \nGROUP BY\n student",
+ "prepared_report": 0,
+ "query": "SELECT\n student as \"Student:Link/Student:200\",\n student_name as \"Student Name::200\",\n sum(grand_total) - sum(outstanding_amount) as \"Paid Amount:Currency:150\",\n sum(outstanding_amount) as \"Outstanding Amount:Currency:150\",\n sum(grand_total) as \"Grand Total:Currency:150\"\nFROM\n `tabFees` \nGROUP BY\n student",
"ref_doctype": "Fees",
"report_name": "Student Fee Collection",
"report_type": "Query Report",
diff --git a/erpnext/hr/doctype/employee_separation/employee_separation_list.js b/erpnext/hr/doctype/employee_separation/employee_separation_list.js
index 11487cc..76c58f5 100644
--- a/erpnext/hr/doctype/employee_separation/employee_separation_list.js
+++ b/erpnext/hr/doctype/employee_separation/employee_separation_list.js
@@ -1,5 +1,5 @@
frappe.listview_settings['Employee Separation'] = {
- add_fields: ["boarding_status", "employee_name", "date_of_joining", "department"],
+ add_fields: ["boarding_status", "employee_name", "department"],
filters:[["boarding_status","=", "Pending"]],
get_indicator: function(doc) {
return [__(doc.boarding_status), frappe.utils.guess_colour(doc.boarding_status), "status,=," + doc.boarding_status];
diff --git a/erpnext/hr/doctype/leave_application/leave_application.py b/erpnext/hr/doctype/leave_application/leave_application.py
index aca277e..6b7c0f7 100755
--- a/erpnext/hr/doctype/leave_application/leave_application.py
+++ b/erpnext/hr/doctype/leave_application/leave_application.py
@@ -187,7 +187,7 @@
self.total_leave_days = get_number_of_leave_days(self.employee, self.leave_type,
self.from_date, self.to_date, self.half_day, self.half_day_date)
- if self.total_leave_days == 0:
+ if self.total_leave_days <= 0:
frappe.throw(_("The day(s) on which you are applying for leave are holidays. You need not apply for leave."))
if not is_lwp(self.leave_type):
diff --git a/erpnext/manufacturing/doctype/production_plan/production_plan.py b/erpnext/manufacturing/doctype/production_plan/production_plan.py
index 7d11ae4..24ce7d4 100644
--- a/erpnext/manufacturing/doctype/production_plan/production_plan.py
+++ b/erpnext/manufacturing/doctype/production_plan/production_plan.py
@@ -514,7 +514,7 @@
doc = frappe._dict(json.loads(doc))
doc['mr_items'] = []
- po_items = doc['po_items'] if doc.get('po_items') else doc['items']
+ po_items = doc.get('po_items') if doc.get('po_items') else doc.get('items')
for data in po_items:
warehouse = None
@@ -533,10 +533,10 @@
else:
planned_qty = data.get('planned_qty')
bom_no = data.get('bom_no')
- include_subcontracted_items = doc['include_subcontracted_items']
- company = doc['company']
- include_non_stock_items = doc['include_non_stock_items']
- ignore_existing_ordered_qty = doc['ignore_existing_ordered_qty']
+ include_subcontracted_items = doc.get('include_subcontracted_items')
+ company = doc.get('company')
+ include_non_stock_items = doc.get('include_non_stock_items')
+ ignore_existing_ordered_qty = doc.get('ignore_existing_ordered_qty')
if not planned_qty:
frappe.throw(_("For row {0}: Enter Planned Qty").format(data.get('idx')))
diff --git a/erpnext/stock/doctype/quality_inspection/quality_inspection.py b/erpnext/stock/doctype/quality_inspection/quality_inspection.py
index 36f6405..e0b7382 100644
--- a/erpnext/stock/doctype/quality_inspection/quality_inspection.py
+++ b/erpnext/stock/doctype/quality_inspection/quality_inspection.py
@@ -61,7 +61,7 @@
if filters.get("from"):
from frappe.desk.reportview import get_match_cond
mcond = get_match_cond(filters["from"])
- cond = ""
+ cond, qi_condition = "", "and (quality_inspection is null or quality_inspection = '')"
if filters.get('from') in ['Purchase Invoice Item', 'Purchase Receipt Item']:
cond = """and item_code in (select name from `tabItem` where
@@ -72,9 +72,13 @@
elif filters.get('from') == 'Stock Entry Detail':
cond = """and s_warehouse is null"""
+ if filters.get('from') in ['Supplier Quotation Item']:
+ qi_condition = ""
+
return frappe.db.sql(""" select item_code from `tab{doc}`
where parent=%(parent)s and docstatus < 2 and item_code like %(txt)s
- and (quality_inspection is null or quality_inspection = '')
- {cond} {mcond} order by item_code limit {start}, {page_len}""".format(doc=filters.get('from'),
- parent=filters.get('parent'), cond=cond, mcond=mcond, start=start, page_len = page_len),
+ {qi_condition} {cond} {mcond}
+ order by item_code limit {start}, {page_len}""".format(doc=filters.get('from'),
+ parent=filters.get('parent'), cond = cond, mcond = mcond, start = start,
+ page_len = page_len, qi_condition = qi_condition),
{'parent': filters.get('parent'), 'txt': "%%%s%%" % txt})