patch: trim sales invoice custom field lengths

This commit is contained in:
Saqib Ansari 2021-09-29 19:56:02 +05:30
parent a7df4227da
commit f1fcb385f5
3 changed files with 25 additions and 1 deletions

View File

@ -309,3 +309,4 @@ erpnext.patches.v13_0.update_dates_in_tax_withholding_category
erpnext.patches.v14_0.update_opportunity_currency_fields
erpnext.patches.v13_0.gst_fields_for_pos_invoice
erpnext.patches.v13_0.create_accounting_dimensions_in_pos_doctypes
erpnext.patches.v13_0.trim_sales_invoice_custom_field_length

View File

@ -0,0 +1,18 @@
# Copyright (c) 2020, Frappe and Contributors
# License: GNU General Public License v3. See license.txt
import frappe
from erpnext.regional.india.setup import create_custom_fields, get_custom_fields
def execute():
company = frappe.get_all('Company', filters = {'country': 'India'})
if not company:
return
custom_fields = {
'Sales Invoice': get_custom_fields().get('Sales Invoice')
}
create_custom_fields(custom_fields, update=True)

View File

@ -132,6 +132,10 @@ def make_property_setters(patch=False):
make_property_setter('Journal Entry', 'voucher_type', 'options', '\n'.join(journal_entry_types), '')
def make_custom_fields(update=True):
custom_fields = get_custom_fields()
create_custom_fields(custom_fields, update=update)
def get_custom_fields():
hsn_sac_field = dict(fieldname='gst_hsn_code', label='HSN/SAC',
fieldtype='Data', fetch_from='item_code.gst_hsn_code', insert_after='description',
allow_on_submit=1, print_hide=1, fetch_if_empty=1)
@ -672,7 +676,8 @@ def make_custom_fields(update=True):
}
]
}
create_custom_fields(custom_fields, update=update)
return custom_fields
def make_fixtures(company=None):
docs = []