Set serial nos in DN based on FIFO based on Stock Settings
diff --git a/erpnext/accounts/doctype/pricing_rule/pricing_rule.py b/erpnext/accounts/doctype/pricing_rule/pricing_rule.py
index 9928227..3c62297 100644
--- a/erpnext/accounts/doctype/pricing_rule/pricing_rule.py
+++ b/erpnext/accounts/doctype/pricing_rule/pricing_rule.py
@@ -109,12 +109,16 @@
 
 	item_list = args.get("items")
 	args.pop("items")
+	
+	set_serial_nos_based_on_fifo = frappe.db.get_single_value("Stock Settings", 
+		"automatically_set_serial_nos_based_on_fifo")
 
 	for item in item_list:
 		args_copy = copy.deepcopy(args)
 		args_copy.update(item)
 		out.append(get_pricing_rule_for_item(args_copy))
-		out.append(get_serial_no_for_item(args_copy))
+		if set_serial_nos_based_on_fifo:
+			out.append(get_serial_no_for_item(args_copy))
 	return out
 	
 def get_serial_no_for_item(args):