Merge pull request #27665 from nextchamp-saqib/trim-custom-field-length
fix: trim sales invoice custom field lengths
This commit is contained in:
commit
197e97d9d6
@ -309,6 +309,7 @@ erpnext.patches.v13_0.update_dates_in_tax_withholding_category
|
|||||||
erpnext.patches.v14_0.update_opportunity_currency_fields
|
erpnext.patches.v14_0.update_opportunity_currency_fields
|
||||||
erpnext.patches.v13_0.gst_fields_for_pos_invoice
|
erpnext.patches.v13_0.gst_fields_for_pos_invoice
|
||||||
erpnext.patches.v13_0.create_accounting_dimensions_in_pos_doctypes
|
erpnext.patches.v13_0.create_accounting_dimensions_in_pos_doctypes
|
||||||
|
erpnext.patches.v13_0.trim_sales_invoice_custom_field_length
|
||||||
erpnext.patches.v13_0.create_custom_field_for_finance_book
|
erpnext.patches.v13_0.create_custom_field_for_finance_book
|
||||||
erpnext.patches.v13_0.modify_invalid_gain_loss_gl_entries
|
erpnext.patches.v13_0.modify_invalid_gain_loss_gl_entries
|
||||||
erpnext.patches.v13_0.fix_additional_cost_in_mfg_stock_entry
|
erpnext.patches.v13_0.fix_additional_cost_in_mfg_stock_entry
|
||||||
|
@ -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)
|
@ -132,6 +132,10 @@ def make_property_setters(patch=False):
|
|||||||
make_property_setter('Journal Entry', 'voucher_type', 'options', '\n'.join(journal_entry_types), '')
|
make_property_setter('Journal Entry', 'voucher_type', 'options', '\n'.join(journal_entry_types), '')
|
||||||
|
|
||||||
def make_custom_fields(update=True):
|
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',
|
hsn_sac_field = dict(fieldname='gst_hsn_code', label='HSN/SAC',
|
||||||
fieldtype='Data', fetch_from='item_code.gst_hsn_code', insert_after='description',
|
fieldtype='Data', fetch_from='item_code.gst_hsn_code', insert_after='description',
|
||||||
allow_on_submit=1, print_hide=1, fetch_if_empty=1)
|
allow_on_submit=1, print_hide=1, fetch_if_empty=1)
|
||||||
@ -165,12 +169,12 @@ def make_custom_fields(update=True):
|
|||||||
dict(fieldname='gst_category', label='GST Category',
|
dict(fieldname='gst_category', label='GST Category',
|
||||||
fieldtype='Select', insert_after='gst_section', print_hide=1,
|
fieldtype='Select', insert_after='gst_section', print_hide=1,
|
||||||
options='\nRegistered Regular\nRegistered Composition\nUnregistered\nSEZ\nOverseas\nConsumer\nDeemed Export\nUIN Holders',
|
options='\nRegistered Regular\nRegistered Composition\nUnregistered\nSEZ\nOverseas\nConsumer\nDeemed Export\nUIN Holders',
|
||||||
fetch_from='customer.gst_category', fetch_if_empty=1),
|
fetch_from='customer.gst_category', fetch_if_empty=1, length=25),
|
||||||
dict(fieldname='export_type', label='Export Type',
|
dict(fieldname='export_type', label='Export Type',
|
||||||
fieldtype='Select', insert_after='gst_category', print_hide=1,
|
fieldtype='Select', insert_after='gst_category', print_hide=1,
|
||||||
depends_on='eval:in_list(["SEZ", "Overseas", "Deemed Export"], doc.gst_category)',
|
depends_on='eval:in_list(["SEZ", "Overseas", "Deemed Export"], doc.gst_category)',
|
||||||
options='\nWith Payment of Tax\nWithout Payment of Tax', fetch_from='customer.export_type',
|
options='\nWith Payment of Tax\nWithout Payment of Tax', fetch_from='customer.export_type',
|
||||||
fetch_if_empty=1),
|
fetch_if_empty=1, length=25),
|
||||||
]
|
]
|
||||||
|
|
||||||
delivery_note_gst_category = [
|
delivery_note_gst_category = [
|
||||||
@ -181,18 +185,18 @@ def make_custom_fields(update=True):
|
|||||||
]
|
]
|
||||||
|
|
||||||
invoice_gst_fields = [
|
invoice_gst_fields = [
|
||||||
dict(fieldname='invoice_copy', label='Invoice Copy',
|
dict(fieldname='invoice_copy', label='Invoice Copy', length=30,
|
||||||
fieldtype='Select', insert_after='export_type', print_hide=1, allow_on_submit=1,
|
fieldtype='Select', insert_after='export_type', print_hide=1, allow_on_submit=1,
|
||||||
options='Original for Recipient\nDuplicate for Transporter\nDuplicate for Supplier\nTriplicate for Supplier'),
|
options='Original for Recipient\nDuplicate for Transporter\nDuplicate for Supplier\nTriplicate for Supplier'),
|
||||||
dict(fieldname='reverse_charge', label='Reverse Charge',
|
dict(fieldname='reverse_charge', label='Reverse Charge', length=2,
|
||||||
fieldtype='Select', insert_after='invoice_copy', print_hide=1,
|
fieldtype='Select', insert_after='invoice_copy', print_hide=1,
|
||||||
options='Y\nN', default='N'),
|
options='Y\nN', default='N'),
|
||||||
dict(fieldname='ecommerce_gstin', label='E-commerce GSTIN',
|
dict(fieldname='ecommerce_gstin', label='E-commerce GSTIN', length=15,
|
||||||
fieldtype='Data', insert_after='export_type', print_hide=1),
|
fieldtype='Data', insert_after='export_type', print_hide=1),
|
||||||
dict(fieldname='gst_col_break', fieldtype='Column Break', insert_after='ecommerce_gstin'),
|
dict(fieldname='gst_col_break', fieldtype='Column Break', insert_after='ecommerce_gstin'),
|
||||||
dict(fieldname='reason_for_issuing_document', label='Reason For Issuing document',
|
dict(fieldname='reason_for_issuing_document', label='Reason For Issuing document',
|
||||||
fieldtype='Select', insert_after='gst_col_break', print_hide=1,
|
fieldtype='Select', insert_after='gst_col_break', print_hide=1,
|
||||||
depends_on='eval:doc.is_return==1',
|
depends_on='eval:doc.is_return==1', length=45,
|
||||||
options='\n01-Sales Return\n02-Post Sale Discount\n03-Deficiency in services\n04-Correction in Invoice\n05-Change in POS\n06-Finalization of Provisional assessment\n07-Others')
|
options='\n01-Sales Return\n02-Post Sale Discount\n03-Deficiency in services\n04-Correction in Invoice\n05-Change in POS\n06-Finalization of Provisional assessment\n07-Others')
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -230,25 +234,25 @@ def make_custom_fields(update=True):
|
|||||||
sales_invoice_gst_fields = [
|
sales_invoice_gst_fields = [
|
||||||
dict(fieldname='billing_address_gstin', label='Billing Address GSTIN',
|
dict(fieldname='billing_address_gstin', label='Billing Address GSTIN',
|
||||||
fieldtype='Data', insert_after='customer_address', read_only=1,
|
fieldtype='Data', insert_after='customer_address', read_only=1,
|
||||||
fetch_from='customer_address.gstin', print_hide=1),
|
fetch_from='customer_address.gstin', print_hide=1, length=15),
|
||||||
dict(fieldname='customer_gstin', label='Customer GSTIN',
|
dict(fieldname='customer_gstin', label='Customer GSTIN',
|
||||||
fieldtype='Data', insert_after='shipping_address_name',
|
fieldtype='Data', insert_after='shipping_address_name',
|
||||||
fetch_from='shipping_address_name.gstin', print_hide=1),
|
fetch_from='shipping_address_name.gstin', print_hide=1, length=15),
|
||||||
dict(fieldname='place_of_supply', label='Place of Supply',
|
dict(fieldname='place_of_supply', label='Place of Supply',
|
||||||
fieldtype='Data', insert_after='customer_gstin',
|
fieldtype='Data', insert_after='customer_gstin',
|
||||||
print_hide=1, read_only=1),
|
print_hide=1, read_only=1, length=50),
|
||||||
dict(fieldname='company_gstin', label='Company GSTIN',
|
dict(fieldname='company_gstin', label='Company GSTIN',
|
||||||
fieldtype='Data', insert_after='company_address',
|
fieldtype='Data', insert_after='company_address',
|
||||||
fetch_from='company_address.gstin', print_hide=1, read_only=1),
|
fetch_from='company_address.gstin', print_hide=1, read_only=1, length=15),
|
||||||
]
|
]
|
||||||
|
|
||||||
sales_invoice_shipping_fields = [
|
sales_invoice_shipping_fields = [
|
||||||
dict(fieldname='port_code', label='Port Code',
|
dict(fieldname='port_code', label='Port Code',
|
||||||
fieldtype='Data', insert_after='reason_for_issuing_document', print_hide=1,
|
fieldtype='Data', insert_after='reason_for_issuing_document', print_hide=1,
|
||||||
depends_on="eval:doc.gst_category=='Overseas' "),
|
depends_on="eval:doc.gst_category=='Overseas' ", length=15),
|
||||||
dict(fieldname='shipping_bill_number', label=' Shipping Bill Number',
|
dict(fieldname='shipping_bill_number', label=' Shipping Bill Number',
|
||||||
fieldtype='Data', insert_after='port_code', print_hide=1,
|
fieldtype='Data', insert_after='port_code', print_hide=1,
|
||||||
depends_on="eval:doc.gst_category=='Overseas' "),
|
depends_on="eval:doc.gst_category=='Overseas' ", length=50),
|
||||||
dict(fieldname='shipping_bill_date', label='Shipping Bill Date',
|
dict(fieldname='shipping_bill_date', label='Shipping Bill Date',
|
||||||
fieldtype='Date', insert_after='shipping_bill_number', print_hide=1,
|
fieldtype='Date', insert_after='shipping_bill_number', print_hide=1,
|
||||||
depends_on="eval:doc.gst_category=='Overseas' "),
|
depends_on="eval:doc.gst_category=='Overseas' "),
|
||||||
@ -354,7 +358,8 @@ def make_custom_fields(update=True):
|
|||||||
'insert_after': 'transporter',
|
'insert_after': 'transporter',
|
||||||
'fetch_from': 'transporter.gst_transporter_id',
|
'fetch_from': 'transporter.gst_transporter_id',
|
||||||
'print_hide': 1,
|
'print_hide': 1,
|
||||||
'translatable': 0
|
'translatable': 0,
|
||||||
|
'length': 20
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'fieldname': 'driver',
|
'fieldname': 'driver',
|
||||||
@ -370,7 +375,8 @@ def make_custom_fields(update=True):
|
|||||||
'fieldtype': 'Data',
|
'fieldtype': 'Data',
|
||||||
'insert_after': 'driver',
|
'insert_after': 'driver',
|
||||||
'print_hide': 1,
|
'print_hide': 1,
|
||||||
'translatable': 0
|
'translatable': 0,
|
||||||
|
'length': 30
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'fieldname': 'vehicle_no',
|
'fieldname': 'vehicle_no',
|
||||||
@ -378,7 +384,8 @@ def make_custom_fields(update=True):
|
|||||||
'fieldtype': 'Data',
|
'fieldtype': 'Data',
|
||||||
'insert_after': 'lr_no',
|
'insert_after': 'lr_no',
|
||||||
'print_hide': 1,
|
'print_hide': 1,
|
||||||
'translatable': 0
|
'translatable': 0,
|
||||||
|
'length': 10
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'fieldname': 'distance',
|
'fieldname': 'distance',
|
||||||
@ -395,7 +402,7 @@ def make_custom_fields(update=True):
|
|||||||
{
|
{
|
||||||
'fieldname': 'transporter_name',
|
'fieldname': 'transporter_name',
|
||||||
'label': 'Transporter Name',
|
'label': 'Transporter Name',
|
||||||
'fieldtype': 'Data',
|
'fieldtype': 'Small Text',
|
||||||
'insert_after': 'transporter_col_break',
|
'insert_after': 'transporter_col_break',
|
||||||
'fetch_from': 'transporter.name',
|
'fetch_from': 'transporter.name',
|
||||||
'read_only': 1,
|
'read_only': 1,
|
||||||
@ -409,12 +416,13 @@ def make_custom_fields(update=True):
|
|||||||
'options': '\nRoad\nAir\nRail\nShip',
|
'options': '\nRoad\nAir\nRail\nShip',
|
||||||
'insert_after': 'transporter_name',
|
'insert_after': 'transporter_name',
|
||||||
'print_hide': 1,
|
'print_hide': 1,
|
||||||
'translatable': 0
|
'translatable': 0,
|
||||||
|
'length': 5
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'fieldname': 'driver_name',
|
'fieldname': 'driver_name',
|
||||||
'label': 'Driver Name',
|
'label': 'Driver Name',
|
||||||
'fieldtype': 'Data',
|
'fieldtype': 'Small Text',
|
||||||
'insert_after': 'mode_of_transport',
|
'insert_after': 'mode_of_transport',
|
||||||
'fetch_from': 'driver.full_name',
|
'fetch_from': 'driver.full_name',
|
||||||
'print_hide': 1,
|
'print_hide': 1,
|
||||||
@ -437,7 +445,8 @@ def make_custom_fields(update=True):
|
|||||||
'default': 'Regular',
|
'default': 'Regular',
|
||||||
'insert_after': 'lr_date',
|
'insert_after': 'lr_date',
|
||||||
'print_hide': 1,
|
'print_hide': 1,
|
||||||
'translatable': 0
|
'translatable': 0,
|
||||||
|
'length': 30
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'fieldname': 'ewaybill',
|
'fieldname': 'ewaybill',
|
||||||
@ -446,7 +455,8 @@ def make_custom_fields(update=True):
|
|||||||
'depends_on': 'eval:(doc.docstatus === 1)',
|
'depends_on': 'eval:(doc.docstatus === 1)',
|
||||||
'allow_on_submit': 1,
|
'allow_on_submit': 1,
|
||||||
'insert_after': 'tax_id',
|
'insert_after': 'tax_id',
|
||||||
'translatable': 0
|
'translatable': 0,
|
||||||
|
'length': 20
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -674,7 +684,8 @@ def make_custom_fields(update=True):
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
create_custom_fields(custom_fields, update=update)
|
|
||||||
|
return custom_fields
|
||||||
|
|
||||||
def make_fixtures(company=None):
|
def make_fixtures(company=None):
|
||||||
docs = []
|
docs = []
|
||||||
|
Loading…
Reference in New Issue
Block a user