Merge branch 'master' into develop
diff --git a/erpnext/__init__.py b/erpnext/__init__.py
index ccb71bc..f1e5fa0 100644
--- a/erpnext/__init__.py
+++ b/erpnext/__init__.py
@@ -4,7 +4,7 @@
 import frappe
 from erpnext.hooks import regional_overrides
 
-__version__ = '8.5.4'
+__version__ = '8.5.5'
 
 def get_default_company(user=None):
 	'''Get default company for user'''
diff --git a/erpnext/manufacturing/doctype/production_order/production_order.py b/erpnext/manufacturing/doctype/production_order/production_order.py
index 511f6de..9533613 100644
--- a/erpnext/manufacturing/doctype/production_order/production_order.py
+++ b/erpnext/manufacturing/doctype/production_order/production_order.py
@@ -515,6 +515,12 @@
 	return res
 
 @frappe.whitelist()
+def set_production_order_ops(name):
+	po = frappe.get_doc('Production Order', name)
+	po.set_production_order_operations()
+	po.save()
+
+@frappe.whitelist()
 def make_stock_entry(production_order_id, purpose, qty=None):
 	production_order = frappe.get_doc("Production Order", production_order_id)
 	if not frappe.db.get_value("Warehouse", production_order.wip_warehouse, "is_group"):
diff --git a/erpnext/public/js/controllers/taxes_and_totals.js b/erpnext/public/js/controllers/taxes_and_totals.js
index 3a010c6..a54f30d 100644
--- a/erpnext/public/js/controllers/taxes_and_totals.js
+++ b/erpnext/public/js/controllers/taxes_and_totals.js
@@ -40,8 +40,10 @@
 	},
 
 	calculate_discount_amount: function(){
-		if (frappe.meta.get_docfield(this.frm.doc.doctype, "discount_amount"))
+		if (frappe.meta.get_docfield(this.frm.doc.doctype, "discount_amount")) {
+			this.set_discount_amount();
 			this.apply_discount_amount();
+		}
 	},
 
 	_calculate_taxes_and_totals: function() {
@@ -451,6 +453,13 @@
 		}
 	},
 
+	set_discount_amount: function() {
+		if(this.frm.doc.additional_discount_percentage) {
+			this.frm.doc.discount_amount = flt(flt(this.frm.doc[frappe.scrub(this.frm.doc.apply_discount_on)])
+				* this.frm.doc.additional_discount_percentage / 100, precision("discount_amount"));
+		}
+	},
+
 	apply_discount_amount: function() {
 		var me = this;
 		var distributed_amount = 0.0;