[fix] status in purchase_receipt.py (#10534)

diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index d781ec7..35530fd 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -432,4 +432,5 @@
 erpnext.patches.v8_6.update_timesheet_company_from_PO
 erpnext.patches.v8_6.set_write_permission_for_quotation_for_sales_manager
 erpnext.patches.v8_5.remove_project_type_property_setter
-erpnext.patches.v8_7.add_more_gst_fields
\ No newline at end of file
+erpnext.patches.v8_7.add_more_gst_fields
+erpnext.patches.v8_7.fix_purchase_receipt_status
\ No newline at end of file
diff --git a/erpnext/patches/v8_7/fix_purchase_receipt_status.py b/erpnext/patches/v8_7/fix_purchase_receipt_status.py
new file mode 100644
index 0000000..f7037dd
--- /dev/null
+++ b/erpnext/patches/v8_7/fix_purchase_receipt_status.py
@@ -0,0 +1,12 @@
+import frappe
+
+def execute():
+	# there is no more status called "Submitted", there was an old issue that used
+	# to set it as Submitted, fixed in this commit
+	frappe.db.sql("""
+	update
+		`tabPurchase Receipt`
+	set
+		status = 'To Bill'
+	where
+		status = 'Submitted'""")
\ No newline at end of file
diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
index 0444369..d12c288 100644
--- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
+++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
@@ -115,9 +115,6 @@
 		frappe.get_doc('Authorization Control').validate_approving_authority(self.doctype,
 			self.company, self.base_grand_total)
 
-		# Set status as Submitted
-		frappe.db.set(self, 'status', 'Submitted')
-
 		self.update_prevdoc_status()
 		if self.per_billed < 100:
 			self.update_billing_status()
@@ -152,8 +149,6 @@
 		if submitted:
 			frappe.throw(_("Purchase Invoice {0} is already submitted").format(submitted[0][0]))
 
-		frappe.db.set(self,'status','Cancelled')
-
 		self.update_prevdoc_status()
 		self.update_billing_status()