* fix: trim sales invoice custom field lengths (cherry picked from commita7df4227da) * patch: trim sales invoice custom field lengths (cherry picked from commitf1fcb385f5) # Conflicts: # erpnext/patches.txt * fix: do not set length for date field (cherry picked from commit83cc597594) * fix: merge conflicts Co-authored-by: Saqib Ansari <nextchamp.saqib@gmail.com> Co-authored-by: Deepesh Garg <42651287+deepeshgarg007@users.noreply.github.com> Co-authored-by: Afshan <33727827+AfshanKhan@users.noreply.github.com>
This commit is contained in:
@@ -321,4 +321,5 @@ 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.shopping_cart_to_ecommerce
|
||||
erpnext.patches.v13_0.set_status_in_maintenance_schedule_table
|
||||
erpnext.patches.v13_0.add_default_interview_notification_templates
|
||||
erpnext.patches.v13_0.add_default_interview_notification_templates
|
||||
erpnext.patches.v13_0.trim_sales_invoice_custom_field_length
|
||||
|
||||
@@ -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)
|
||||
@@ -139,6 +139,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)
|
||||
@@ -172,12 +176,12 @@ def make_custom_fields(update=True):
|
||||
dict(fieldname='gst_category', label='GST Category',
|
||||
fieldtype='Select', insert_after='gst_section', print_hide=1,
|
||||
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',
|
||||
fieldtype='Select', insert_after='gst_category', print_hide=1,
|
||||
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',
|
||||
fetch_if_empty=1),
|
||||
fetch_if_empty=1, length=25),
|
||||
]
|
||||
|
||||
delivery_note_gst_category = [
|
||||
@@ -188,18 +192,18 @@ def make_custom_fields(update=True):
|
||||
]
|
||||
|
||||
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,
|
||||
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,
|
||||
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),
|
||||
dict(fieldname='gst_col_break', fieldtype='Column Break', insert_after='ecommerce_gstin'),
|
||||
dict(fieldname='reason_for_issuing_document', label='Reason For Issuing document',
|
||||
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')
|
||||
]
|
||||
|
||||
@@ -237,25 +241,25 @@ def make_custom_fields(update=True):
|
||||
sales_invoice_gst_fields = [
|
||||
dict(fieldname='billing_address_gstin', label='Billing Address GSTIN',
|
||||
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',
|
||||
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',
|
||||
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',
|
||||
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 = [
|
||||
dict(fieldname='port_code', label='Port Code',
|
||||
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',
|
||||
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',
|
||||
fieldtype='Date', insert_after='shipping_bill_number', print_hide=1,
|
||||
depends_on="eval:doc.gst_category=='Overseas' "),
|
||||
@@ -361,7 +365,8 @@ def make_custom_fields(update=True):
|
||||
'insert_after': 'transporter',
|
||||
'fetch_from': 'transporter.gst_transporter_id',
|
||||
'print_hide': 1,
|
||||
'translatable': 0
|
||||
'translatable': 0,
|
||||
'length': 20
|
||||
},
|
||||
{
|
||||
'fieldname': 'driver',
|
||||
@@ -377,7 +382,8 @@ def make_custom_fields(update=True):
|
||||
'fieldtype': 'Data',
|
||||
'insert_after': 'driver',
|
||||
'print_hide': 1,
|
||||
'translatable': 0
|
||||
'translatable': 0,
|
||||
'length': 30
|
||||
},
|
||||
{
|
||||
'fieldname': 'vehicle_no',
|
||||
@@ -385,7 +391,8 @@ def make_custom_fields(update=True):
|
||||
'fieldtype': 'Data',
|
||||
'insert_after': 'lr_no',
|
||||
'print_hide': 1,
|
||||
'translatable': 0
|
||||
'translatable': 0,
|
||||
'length': 10
|
||||
},
|
||||
{
|
||||
'fieldname': 'distance',
|
||||
@@ -402,7 +409,7 @@ def make_custom_fields(update=True):
|
||||
{
|
||||
'fieldname': 'transporter_name',
|
||||
'label': 'Transporter Name',
|
||||
'fieldtype': 'Data',
|
||||
'fieldtype': 'Small Text',
|
||||
'insert_after': 'transporter_col_break',
|
||||
'fetch_from': 'transporter.name',
|
||||
'read_only': 1,
|
||||
@@ -416,12 +423,13 @@ def make_custom_fields(update=True):
|
||||
'options': '\nRoad\nAir\nRail\nShip',
|
||||
'insert_after': 'transporter_name',
|
||||
'print_hide': 1,
|
||||
'translatable': 0
|
||||
'translatable': 0,
|
||||
'length': 5
|
||||
},
|
||||
{
|
||||
'fieldname': 'driver_name',
|
||||
'label': 'Driver Name',
|
||||
'fieldtype': 'Data',
|
||||
'fieldtype': 'Small Text',
|
||||
'insert_after': 'mode_of_transport',
|
||||
'fetch_from': 'driver.full_name',
|
||||
'print_hide': 1,
|
||||
@@ -444,7 +452,8 @@ def make_custom_fields(update=True):
|
||||
'default': 'Regular',
|
||||
'insert_after': 'lr_date',
|
||||
'print_hide': 1,
|
||||
'translatable': 0
|
||||
'translatable': 0,
|
||||
'length': 30
|
||||
},
|
||||
{
|
||||
'fieldname': 'ewaybill',
|
||||
@@ -453,7 +462,8 @@ def make_custom_fields(update=True):
|
||||
'depends_on': 'eval:((doc.docstatus === 1 || doc.ewaybill) && doc.eway_bill_cancelled === 0)',
|
||||
'allow_on_submit': 1,
|
||||
'insert_after': 'tax_id',
|
||||
'translatable': 0
|
||||
'translatable': 0,
|
||||
'length': 20
|
||||
}
|
||||
]
|
||||
|
||||
@@ -719,7 +729,8 @@ def make_custom_fields(update=True):
|
||||
}
|
||||
]
|
||||
}
|
||||
create_custom_fields(custom_fields, update=update)
|
||||
|
||||
return custom_fields
|
||||
|
||||
def make_fixtures(company=None):
|
||||
docs = []
|
||||
|
||||
Reference in New Issue
Block a user