From 4802fc018b4f3e7d3d70f522ff3e1b6c868eedaa Mon Sep 17 00:00:00 2001 From: Himanshu Warekar Date: Fri, 5 Apr 2019 17:01:19 +0530 Subject: [PATCH 1/2] fix: run patch for gst --- erpnext/patches.txt | 3 ++- erpnext/patches/v10_0/gst_hsn_fixes.py | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 erpnext/patches/v10_0/gst_hsn_fixes.py diff --git a/erpnext/patches.txt b/erpnext/patches.txt index edaa9e6b372..07c959a262d 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -508,4 +508,5 @@ erpnext.patches.v10_0.recalculate_gross_margin_for_project erpnext.patches.v10_0.delete_hub_documents erpnext.patches.v10_0.update_user_image_in_employee erpnext.patches.v10_0.repost_gle_for_purchase_receipts_with_rejected_items -erpnext.patches.v10_0.allow_operators_in_supplier_scorecard \ No newline at end of file +erpnext.patches.v10_0.allow_operators_in_supplier_scorecard +erpnext.patches.v10_0.gst_hsn_fixes \ No newline at end of file diff --git a/erpnext/patches/v10_0/gst_hsn_fixes.py b/erpnext/patches/v10_0/gst_hsn_fixes.py new file mode 100644 index 00000000000..7a65ef3c08f --- /dev/null +++ b/erpnext/patches/v10_0/gst_hsn_fixes.py @@ -0,0 +1,14 @@ +import frappe +from erpnext.regional.india.setup import setup +from frappe.custom.doctype.custom_field.custom_field import create_custom_fields + +def execute(): + hsn_sac_field = dict(fieldname='gst_hsn_code', label='HSN/SAC', + fieldtype='Data', options='item_code.gst_hsn_code', insert_after='description', + allow_on_submit=1, print_hide=1) + + custom_fields = { + 'Material Request Item': [hsn_sac_field] + } + + create_custom_fields(custom_fields) \ No newline at end of file From 55e54ef6a1799a4e3e9dcd2542d7c0f5b9676c9e Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 2 May 2019 21:56:44 +0530 Subject: [PATCH 2/2] skip the patch for outside India --- erpnext/patches/v10_0/gst_hsn_fixes.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/erpnext/patches/v10_0/gst_hsn_fixes.py b/erpnext/patches/v10_0/gst_hsn_fixes.py index 7a65ef3c08f..98cf0a7a2da 100644 --- a/erpnext/patches/v10_0/gst_hsn_fixes.py +++ b/erpnext/patches/v10_0/gst_hsn_fixes.py @@ -3,6 +3,10 @@ from erpnext.regional.india.setup import setup from frappe.custom.doctype.custom_field.custom_field import create_custom_fields def execute(): + company = frappe.get_all('Company', filters = {'country': 'India'}) + if not company: + return + hsn_sac_field = dict(fieldname='gst_hsn_code', label='HSN/SAC', fieldtype='Data', options='item_code.gst_hsn_code', insert_after='description', allow_on_submit=1, print_hide=1) @@ -11,4 +15,4 @@ def execute(): 'Material Request Item': [hsn_sac_field] } - create_custom_fields(custom_fields) \ No newline at end of file + create_custom_fields(custom_fields)