Invoice copy, state code in gst print format, hsn code in other sales/purchase docs (#9658)
* Invoice copy, state code in gst print format, hsn code in other sales/purchase docs * Formatted Net Amount in item-tax-breakup * GST print format fixes * removed trailing whitespace * removed trailing whitespace
This commit is contained in:
committed by
Makarand Bauskar
parent
5d5a81f375
commit
f3f0dfef2a
@@ -1,7 +1,19 @@
|
||||
import frappe
|
||||
from frappe.custom.doctype.custom_field.custom_field import create_custom_field
|
||||
from erpnext.regional.india.setup import update_address_template
|
||||
|
||||
def execute():
|
||||
frappe.db.sql("""update `tabCustom Field` set label = 'HSN/SAC Code'
|
||||
company = frappe.get_all('Company', filters = {'country': 'India'})
|
||||
if not company:
|
||||
return
|
||||
|
||||
update_existing_custom_fields()
|
||||
add_custom_fields()
|
||||
update_address_template()
|
||||
frappe.reload_doc("regional", "print_format", "gst_tax_invoice")
|
||||
|
||||
def update_existing_custom_fields():
|
||||
frappe.db.sql("""update `tabCustom Field` set label = 'HSN/SAC'
|
||||
where fieldname='gst_hsn_code' and label='GST HSN Code'
|
||||
""")
|
||||
|
||||
@@ -21,7 +33,26 @@ def execute():
|
||||
where fieldname='gst_hsn_code' and dt in ('Sales Invoice Item', 'Purchase Invoice Item')
|
||||
""")
|
||||
|
||||
# reload gst print format for Indian users
|
||||
company = frappe.get_all('Company', filters = {'country': 'India'})
|
||||
if company:
|
||||
frappe.reload_doc("regional", "print_format", "gst_tax_invoice")
|
||||
def add_custom_fields():
|
||||
hsn_sac_field = dict(fieldname='gst_hsn_code', label='HSN/SAC',
|
||||
fieldtype='Data', options='item_code.gst_hsn_code', insert_after='description')
|
||||
|
||||
custom_fields = {
|
||||
'Address': [
|
||||
dict(fieldname='gst_state_number', label='GST State Number',
|
||||
fieldtype='Int', insert_after='gst_state'),
|
||||
],
|
||||
'Sales Invoice': [
|
||||
dict(fieldname='invoice_copy', label='Invoice Copy',
|
||||
fieldtype='Select', insert_after='project', print_hide=1,
|
||||
options='ORIGINAL FOR RECIPIENT\nDUPLICATE FOR TRANSPORTER\nTRIPLICATE FOR SUPPLIER'),
|
||||
],
|
||||
'Sales Order Item': [hsn_sac_field],
|
||||
'Delivery Note Item': [hsn_sac_field],
|
||||
'Purchase Order Item': [hsn_sac_field],
|
||||
'Purchase Receipt Item': [hsn_sac_field]
|
||||
}
|
||||
|
||||
for doctype, fields in custom_fields.items():
|
||||
for df in fields:
|
||||
create_custom_field(doctype, df)
|
||||
|
||||
Reference in New Issue
Block a user