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

* fix: Patch to set GST category for unregistered invoice

* fix: Move patch up in line
This commit is contained in:
Deepesh Garg
2019-12-27 12:58:19 +05:30
committed by Nabin Hait
parent 4d806033af
commit 467dba1954
2 changed files with 20 additions and 0 deletions

View File

@@ -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, '')=''
""")