Merge pull request #10771 from nabinhait/pro_order_99
Update actual dates in Production Order from Timesheet
diff --git a/erpnext/__init__.py b/erpnext/__init__.py
index c97197d..1c9b0b4 100644
--- a/erpnext/__init__.py
+++ b/erpnext/__init__.py
@@ -4,7 +4,7 @@
import frappe
from erpnext.hooks import regional_overrides
-__version__ = '8.11.1'
+__version__ = '8.11.2'
def get_default_company(user=None):
'''Get default company for user'''
diff --git a/erpnext/accounts/page/pos/pos.js b/erpnext/accounts/page/pos/pos.js
index f8399bf..0416b19 100644
--- a/erpnext/accounts/page/pos/pos.js
+++ b/erpnext/accounts/page/pos/pos.js
@@ -260,9 +260,7 @@
this.calculate_outstanding_amount();
}
- if (this.frm.doc.customer) {
- this.party_field.$input.val(this.frm.doc.customer);
- }
+ this.set_customer_value_in_party_field();
if (!this.frm.doc.write_off_account) {
this.frm.doc.write_off_account = doc.write_off_account
@@ -273,6 +271,12 @@
}
},
+ set_customer_value_in_party_field: function() {
+ if (this.frm.doc.customer) {
+ this.party_field.$input.val(this.frm.doc.customer);
+ }
+ },
+
get_invoice_doc: function (si_docs) {
var me = this;
this.si_docs = this.get_doc_from_localstorage();
@@ -686,6 +690,7 @@
set_focus: function () {
if (this.default_customer || this.frm.doc.customer) {
+ this.set_customer_value_in_party_field();
this.serach_item.$input.focus();
} else {
this.party_field.$input.focus();
diff --git a/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py b/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py
index 050c3c1..815e504 100644
--- a/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py
+++ b/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py
@@ -376,19 +376,20 @@
else:
bom_wise_item_details[d.item_code] = d
- if include_sublevel:
+ if include_sublevel and d.default_bom:
if ((d.default_material_request_type == "Purchase" and d.is_sub_contracted and supply_subs)
or (d.default_material_request_type == "Manufacture")):
my_qty = 0
projected_qty = self.get_item_projected_qty(d.item_code)
-
if self.create_material_requests_for_all_required_qty:
my_qty = d.qty
- elif (bom_wise_item_details[d.item_code].qty - d.qty) < projected_qty:
- my_qty = bom_wise_item_details[d.item_code].qty - projected_qty
else:
- my_qty = d.qty
+ total_required_qty = flt(bom_wise_item_details.get(d.item_code, frappe._dict()).qty)
+ if (total_required_qty - d.qty) < projected_qty:
+ my_qty = total_required_qty - projected_qty
+ else:
+ my_qty = d.qty
if my_qty > 0:
self.get_subitems(bom_wise_item_details,
@@ -483,14 +484,15 @@
return items_to_be_requested
def get_item_projected_qty(self,item):
+ conditions = ""
+ if self.purchase_request_for_warehouse:
+ conditions = " and warehouse='{0}'".format(frappe.db.escape(self.purchase_request_for_warehouse))
+
item_projected_qty = frappe.db.sql("""
select ifnull(sum(projected_qty),0) as qty
from `tabBin`
- where item_code = %(item_code)s and warehouse=%(warehouse)s
- """, {
- "item_code": item,
- "warehouse": self.purchase_request_for_warehouse
- }, as_dict=1)
+ where item_code = %(item_code)s {conditions}
+ """.format(conditions=conditions), { "item_code": item }, as_dict=1)
return item_projected_qty[0].qty
diff --git a/erpnext/patches/v8_0/merge_student_batch_and_student_group.py b/erpnext/patches/v8_0/merge_student_batch_and_student_group.py
index d30b35e..aacd97b 100644
--- a/erpnext/patches/v8_0/merge_student_batch_and_student_group.py
+++ b/erpnext/patches/v8_0/merge_student_batch_and_student_group.py
@@ -40,8 +40,10 @@
student.update({"group_roll_number": i+1})
doc.extend("students", student_list)
- instructor_list = frappe.db.sql('''select instructor, instructor_name from `tabStudent Batch Instructor`
- where parent=%s''', (doc.student_group_name), as_dict=1)
+ instructor_list = None
+ if frappe.db.table_exists("Student Batch Instructor"):
+ instructor_list = frappe.db.sql('''select instructor, instructor_name from `tabStudent Batch Instructor`
+ where parent=%s''', (doc.student_group_name), as_dict=1)
if instructor_list:
doc.extend("instructors", instructor_list)
doc.save()
diff --git a/erpnext/stock/doctype/serial_no/serial_no.py b/erpnext/stock/doctype/serial_no/serial_no.py
index ca64b1e..c39efa0 100644
--- a/erpnext/stock/doctype/serial_no/serial_no.py
+++ b/erpnext/stock/doctype/serial_no/serial_no.py
@@ -240,7 +240,8 @@
status = False
if sn.purchase_document_no:
- if sle.voucher_type in ['Purchase Receipt', 'Stock Entry']:
+ if sle.voucher_type in ['Purchase Receipt', 'Stock Entry'] and \
+ sn.delivery_document_type not in ['Purchase Receipt', 'Stock Entry']:
status = True
if status and sle.voucher_type == 'Stock Entry' and \