Delete GST related doctypes and reports if account is from outside India (#10808)

This commit is contained in:
Nabin Hait 2017-09-18 13:16:04 +05:30 committed by GitHub
parent fd39e6f3c8
commit bc9006ff30
3 changed files with 26 additions and 8 deletions

View File

@ -436,4 +436,5 @@ erpnext.patches.v8_7.add_more_gst_fields
erpnext.patches.v8_7.fix_purchase_receipt_status
erpnext.patches.v8_6.rename_bom_update_tool
erpnext.patches.v8_9.set_print_zero_amount_taxes
erpnext.patches.v8_9.set_default_customer_group
erpnext.patches.v8_9.set_default_customer_group
erpnext.patches.v8_9.delete_gst_doctypes_for_outside_india_accounts

View File

@ -2,21 +2,25 @@ import frappe
from frappe.email import sendmail_to_system_managers
def execute():
frappe.reload_doc('regional', 'doctype', 'gst_settings')
frappe.reload_doc('regional', 'doctype', 'gst_hsn_code')
frappe.reload_doc('stock', 'doctype', 'item')
frappe.reload_doc("stock", "doctype", "customs_tariff_number")
company = frappe.get_all('Company', filters = {'country': 'India'})
if not company:
return
frappe.reload_doc('regional', 'doctype', 'gst_settings')
frappe.reload_doc('regional', 'doctype', 'gst_hsn_code')
for report_name in ('GST Sales Register', 'GST Purchase Register',
'GST Itemised Sales Register', 'GST Itemised Purchase Register'):
frappe.reload_doc('regional', 'report', frappe.scrub(report_name))
if frappe.db.get_single_value('System Settings', 'country')=='India':
from erpnext.regional.india.setup import setup
delete_custom_field_tax_id_if_exists()
setup(patch=True)
send_gst_update_email()
from erpnext.regional.india.setup import setup
delete_custom_field_tax_id_if_exists()
setup(patch=True)
send_gst_update_email()
def delete_custom_field_tax_id_if_exists():
for field in frappe.db.sql_list("""select name from `tabCustom Field` where fieldname='tax_id'

View File

@ -0,0 +1,13 @@
import frappe
def execute():
company = frappe.get_all('Company', filters = {'country': 'India'})
if not company:
if frappe.db.exists("DocType", "GST Settings"):
frappe.delete_doc("DocType", "GST Settings")
frappe.delete_doc("DocType", "GST HSN Code")
for report_name in ('GST Sales Register', 'GST Purchase Register',
'GST Itemised Sales Register', 'GST Itemised Purchase Register'):
frappe.delete_doc('Report', report_name)