fix: Patch incorrect GST category in invoices (#20084)

* fix: Patch to set GST category for unregistered invoice

* fix: Move patch up in line
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index 6d15d54..1e80b2b 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -586,6 +586,7 @@
 erpnext.patches.v11_1.setup_guardian_role
 execute:frappe.delete_doc('DocType', 'Notification Control')
 erpnext.patches.v12_0.set_gst_category
+erpnext.patches.v12_0.update_gst_category
 erpnext.patches.v11_0.remove_barcodes_field_from_copy_fields_to_variants
 erpnext.patches.v12_0.set_task_status
 erpnext.patches.v11_0.make_italian_localization_fields # 26-03-2019
diff --git a/erpnext/patches/v12_0/update_gst_category.py b/erpnext/patches/v12_0/update_gst_category.py
new file mode 100644
index 0000000..963edad
--- /dev/null
+++ b/erpnext/patches/v12_0/update_gst_category.py
@@ -0,0 +1,19 @@
+from __future__ import unicode_literals
+import frappe
+
+def execute():
+
+    company = frappe.get_all('Company', filters = {'country': 'India'})
+    if not company:
+        return
+
+    frappe.db.sql(""" UPDATE `tabSales Invoice` set gst_category = 'Unregistered'
+        where gst_category = 'Registered Regular'
+        and ifnull(customer_gstin, '')=''
+        and ifnull(billing_address_gstin,'')=''
+    """)
+
+    frappe.db.sql(""" UPDATE `tabPurchase Invoice` set gst_category = 'Unregistered'
+        where gst_category = 'Registered Regular'
+        and ifnull(supplier_gstin, '')=''
+    """)
\ No newline at end of file