From 562d942a7d3c48006a47a415fa0dccacd238621a Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 7 Sep 2018 16:14:44 +0530 Subject: [PATCH] fix(patch): gst state number in address where number is less than 10 --- erpnext/patches.txt | 4 +--- .../patches/v10_0/added_extra_gst_custom_field.py | 12 ------------ erpnext/patches/v11_0/make_job_card.py | 4 +++- erpnext/patches/v8_7/add_more_gst_fields.py | 11 ----------- .../sync_india_custom_fields.py} | 11 +++++++++-- erpnext/regional/india/setup.py | 2 +- 6 files changed, 14 insertions(+), 30 deletions(-) delete mode 100644 erpnext/patches/v10_0/added_extra_gst_custom_field.py delete mode 100644 erpnext/patches/v8_7/add_more_gst_fields.py rename erpnext/patches/{v10_0/added_extra_gst_custom_field_in_gstr2.py => v8_7/sync_india_custom_fields.py} (61%) diff --git a/erpnext/patches.txt b/erpnext/patches.txt index a83dfd679c..3b3c25b69a 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -434,7 +434,7 @@ erpnext.patches.v8_5.update_customer_group_in_POS_profile erpnext.patches.v8_6.update_timesheet_company_from_PO erpnext.patches.v8_6.set_write_permission_for_quotation_for_sales_manager erpnext.patches.v8_5.remove_project_type_property_setter -erpnext.patches.v8_7.add_more_gst_fields #21-09-2017 +erpnext.patches.v8_7.sync_india_custom_fields erpnext.patches.v8_7.fix_purchase_receipt_status erpnext.patches.v8_6.rename_bom_update_tool erpnext.patches.v8_7.set_offline_in_pos_settings #11-09-17 @@ -486,10 +486,8 @@ erpnext.patches.v10_0.update_reserved_qty_for_purchase_order erpnext.patches.v10_0.fichier_des_ecritures_comptables_for_france erpnext.patches.v10_0.update_assessment_plan erpnext.patches.v10_0.update_assessment_result -erpnext.patches.v10_0.added_extra_gst_custom_field erpnext.patches.v10_0.set_default_payment_terms_based_on_company erpnext.patches.v10_0.update_sales_order_link_to_purchase_order -erpnext.patches.v10_0.added_extra_gst_custom_field_in_gstr2 #2018-02-13 erpnext.patches.v10_0.item_barcode_childtable_migrate erpnext.patches.v10_0.rename_price_to_rate_in_pricing_rule erpnext.patches.v10_0.set_currency_in_pricing_rule diff --git a/erpnext/patches/v10_0/added_extra_gst_custom_field.py b/erpnext/patches/v10_0/added_extra_gst_custom_field.py deleted file mode 100644 index 000e8fd638..0000000000 --- a/erpnext/patches/v10_0/added_extra_gst_custom_field.py +++ /dev/null @@ -1,12 +0,0 @@ -import frappe -from erpnext.regional.india.setup import make_custom_fields - -def execute(): - company = frappe.get_all('Company', filters = {'country': 'India'}) - if not company: - return - - frappe.reload_doc("hr", "doctype", "Employee Tax Exemption Declaration") - frappe.reload_doc("hr", "doctype", "Employee Tax Exemption Proof Submission") - - make_custom_fields(update=False) \ No newline at end of file diff --git a/erpnext/patches/v11_0/make_job_card.py b/erpnext/patches/v11_0/make_job_card.py index be106e687b..4604889168 100644 --- a/erpnext/patches/v11_0/make_job_card.py +++ b/erpnext/patches/v11_0/make_job_card.py @@ -3,6 +3,7 @@ from __future__ import unicode_literals import frappe +from erpnext.manufacturing.doctype.work_order.work_order import create_job_card def execute(): frappe.reload_doc('manufacturing', 'doctype', 'work_order') @@ -14,5 +15,6 @@ def execute(): where (work_order is not null and work_order != '') and docstatus = 0""", as_dict=1): if d.work_order: doc = frappe.get_doc('Work Order', d.work_order) - doc.create_job_card() + for row in doc.operations: + create_job_card(doc, row, auto_create=True) frappe.delete_doc('Timesheet', d.name) \ No newline at end of file diff --git a/erpnext/patches/v8_7/add_more_gst_fields.py b/erpnext/patches/v8_7/add_more_gst_fields.py deleted file mode 100644 index d2085e07e8..0000000000 --- a/erpnext/patches/v8_7/add_more_gst_fields.py +++ /dev/null @@ -1,11 +0,0 @@ -import frappe -from erpnext.regional.india.setup import make_custom_fields - -def execute(): - company = frappe.get_all('Company', filters = {'country': 'India'}) - if not company: - return - - frappe.reload_doc('hr', 'doctype', 'employee_tax_exemption_declaration') - frappe.reload_doc('hr', 'doctype', 'employee_tax_exemption_proof_submission') - make_custom_fields() \ No newline at end of file diff --git a/erpnext/patches/v10_0/added_extra_gst_custom_field_in_gstr2.py b/erpnext/patches/v8_7/sync_india_custom_fields.py similarity index 61% rename from erpnext/patches/v10_0/added_extra_gst_custom_field_in_gstr2.py rename to erpnext/patches/v8_7/sync_india_custom_fields.py index 12aa5fd5d2..323b5bcd3e 100644 --- a/erpnext/patches/v10_0/added_extra_gst_custom_field_in_gstr2.py +++ b/erpnext/patches/v8_7/sync_india_custom_fields.py @@ -6,11 +6,14 @@ def execute(): if not company: return + frappe.reload_doc('hr', 'doctype', 'employee_tax_exemption_declaration') + frappe.reload_doc('hr', 'doctype', 'employee_tax_exemption_proof_submission') + for doctype in ["Sales Invoice", "Delivery Note", "Purchase Invoice"]: frappe.db.sql("""delete from `tabCustom Field` where dt = %s and fieldname in ('port_code', 'shipping_bill_number', 'shipping_bill_date')""", doctype) - make_custom_fields(update=False) + make_custom_fields() frappe.db.sql(""" update `tabCustom Field` @@ -18,4 +21,8 @@ def execute(): where fieldname = 'reason_for_issuing_document' """) - + frappe.db.sql(""" + update tabAddress + set gst_state_number=concat("0", gst_state_number) + where ifnull(gst_state_number, '') != '' and gst_state_number<10 + """) \ No newline at end of file diff --git a/erpnext/regional/india/setup.py b/erpnext/regional/india/setup.py index da9e46976b..07a42ff853 100644 --- a/erpnext/regional/india/setup.py +++ b/erpnext/regional/india/setup.py @@ -171,7 +171,7 @@ def make_custom_fields(update=True): dict(fieldname='gst_state', label='GST State', fieldtype='Select', options='\n'.join(states), insert_after='gstin'), dict(fieldname='gst_state_number', label='GST State Number', - fieldtype='Int', insert_after='gst_state', read_only=1), + fieldtype='Data', insert_after='gst_state', read_only=1), ], 'Purchase Invoice': invoice_gst_fields + purchase_invoice_gst_fields, 'Sales Invoice': invoice_gst_fields + sales_invoice_gst_fields,