2017-06-22 11:07:04 +00:00
|
|
|
import frappe
|
2017-06-27 07:51:46 +00:00
|
|
|
from frappe.email import sendmail_to_system_managers
|
2017-06-22 11:07:04 +00:00
|
|
|
|
|
|
|
def execute():
|
2017-06-30 06:27:41 +00:00
|
|
|
frappe.reload_doc('stock', 'doctype', 'item')
|
2017-07-10 11:11:49 +00:00
|
|
|
frappe.reload_doc("stock", "doctype", "customs_tariff_number")
|
2017-12-15 11:19:11 +00:00
|
|
|
frappe.reload_doc("accounts", "doctype", "payment_terms_template")
|
|
|
|
frappe.reload_doc("accounts", "doctype", "payment_schedule")
|
2017-06-22 12:46:51 +00:00
|
|
|
|
2017-09-18 07:46:04 +00:00
|
|
|
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')
|
|
|
|
|
2017-06-22 12:46:51 +00:00
|
|
|
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))
|
|
|
|
|
2017-09-18 07:46:04 +00:00
|
|
|
from erpnext.regional.india.setup import setup
|
|
|
|
delete_custom_field_tax_id_if_exists()
|
|
|
|
setup(patch=True)
|
|
|
|
send_gst_update_email()
|
2017-06-27 07:51:46 +00:00
|
|
|
|
2017-06-28 07:46:42 +00:00
|
|
|
def delete_custom_field_tax_id_if_exists():
|
|
|
|
for field in frappe.db.sql_list("""select name from `tabCustom Field` where fieldname='tax_id'
|
2017-06-28 12:31:58 +00:00
|
|
|
and dt in ('Sales Order', 'Sales Invoice', 'Delivery Note')"""):
|
2017-06-28 07:46:42 +00:00
|
|
|
frappe.delete_doc("Custom Field", field, ignore_permissions=True)
|
|
|
|
frappe.db.commit()
|
|
|
|
|
2017-06-27 07:51:46 +00:00
|
|
|
def send_gst_update_email():
|
|
|
|
message = """Hello,
|
|
|
|
|
2017-06-27 12:01:41 +00:00
|
|
|
<p>ERPNext is now GST Ready!</p>
|
2017-06-27 07:51:46 +00:00
|
|
|
|
2017-06-27 12:01:41 +00:00
|
|
|
<p>To start making GST Invoices from 1st of July, you just need to create new Tax Accounts,
|
|
|
|
Templates and update your Customer's and Supplier's GST Numbers.</p>
|
2017-06-27 07:51:46 +00:00
|
|
|
|
|
|
|
<p>Please refer {gst_document_link} to know more about how to setup and implement GST in ERPNext.</p>
|
|
|
|
|
|
|
|
<p>Please contact us at support@erpnext.com, if you have any questions.</p>
|
|
|
|
|
|
|
|
<p>Thanks,</p>
|
|
|
|
ERPNext Team.
|
|
|
|
""".format(gst_document_link="<a href='http://frappe.github.io/erpnext/user/manual/en/regional/india/'> ERPNext GST Document </a>")
|
|
|
|
|
2017-06-28 05:26:50 +00:00
|
|
|
try:
|
|
|
|
sendmail_to_system_managers("[Important] ERPNext GST updates", message)
|
|
|
|
except Exception as e:
|
|
|
|
pass
|