fix: do not add gst fields if no indian company

This commit is contained in:
hrwx 2021-11-27 21:46:13 +00:00
parent cdaf0a04cf
commit 43038aab79
3 changed files with 26 additions and 21 deletions

View File

@ -287,7 +287,7 @@ erpnext.patches.v14_0.delete_einvoicing_doctypes
erpnext.patches.v13_0.custom_fields_for_taxjar_integration #08-11-2021 erpnext.patches.v13_0.custom_fields_for_taxjar_integration #08-11-2021
erpnext.patches.v13_0.set_operation_time_based_on_operating_cost erpnext.patches.v13_0.set_operation_time_based_on_operating_cost
erpnext.patches.v13_0.validate_options_for_data_field erpnext.patches.v13_0.validate_options_for_data_field
erpnext.patches.v13_0.create_gst_payment_entry_fields erpnext.patches.v13_0.create_gst_payment_entry_fields #27-11-2021
erpnext.patches.v14_0.delete_shopify_doctypes erpnext.patches.v14_0.delete_shopify_doctypes
erpnext.patches.v13_0.fix_invoice_statuses erpnext.patches.v13_0.fix_invoice_statuses
erpnext.patches.v13_0.replace_supplier_item_group_with_party_specific_item erpnext.patches.v13_0.replace_supplier_item_group_with_party_specific_item

View File

@ -9,24 +9,29 @@ def execute():
frappe.reload_doc('accounts', 'doctype', 'advance_taxes_and_charges') frappe.reload_doc('accounts', 'doctype', 'advance_taxes_and_charges')
frappe.reload_doc('accounts', 'doctype', 'payment_entry') frappe.reload_doc('accounts', 'doctype', 'payment_entry')
custom_fields = { if frappe.db.exists('Company', {'country': 'India'}):
'Payment Entry': [ custom_fields = {
dict(fieldname='gst_section', label='GST Details', fieldtype='Section Break', insert_after='deductions', 'Payment Entry': [
print_hide=1, collapsible=1), dict(fieldname='gst_section', label='GST Details', fieldtype='Section Break', insert_after='deductions',
dict(fieldname='company_address', label='Company Address', fieldtype='Link', insert_after='gst_section', print_hide=1, collapsible=1),
print_hide=1, options='Address'), dict(fieldname='company_address', label='Company Address', fieldtype='Link', insert_after='gst_section',
dict(fieldname='company_gstin', label='Company GSTIN', print_hide=1, options='Address'),
fieldtype='Data', insert_after='company_address', dict(fieldname='company_gstin', label='Company GSTIN',
fetch_from='company_address.gstin', print_hide=1, read_only=1), fieldtype='Data', insert_after='company_address',
dict(fieldname='place_of_supply', label='Place of Supply', fetch_from='company_address.gstin', print_hide=1, read_only=1),
fieldtype='Data', insert_after='company_gstin', dict(fieldname='place_of_supply', label='Place of Supply',
print_hide=1, read_only=1), fieldtype='Data', insert_after='company_gstin',
dict(fieldname='customer_address', label='Customer Address', fieldtype='Link', insert_after='place_of_supply', print_hide=1, read_only=1),
print_hide=1, options='Address', depends_on = 'eval:doc.party_type == "Customer"'), dict(fieldname='customer_address', label='Customer Address', fieldtype='Link', insert_after='place_of_supply',
dict(fieldname='customer_gstin', label='Customer GSTIN', print_hide=1, options='Address', depends_on = 'eval:doc.party_type == "Customer"'),
fieldtype='Data', insert_after='customer_address', dict(fieldname='customer_gstin', label='Customer GSTIN',
fetch_from='customer_address.gstin', print_hide=1, read_only=1) fieldtype='Data', insert_after='customer_address',
] fetch_from='customer_address.gstin', print_hide=1, read_only=1)
} ]
}
create_custom_fields(custom_fields, update=True) create_custom_fields(custom_fields, update=True)
else:
fields = ['gst_section', 'company_address', 'company_gstin', 'place_of_supply', 'customer_address', 'customer_gstin']
for field in fields:
frappe.delete_doc_if_exists("Custom Field", f"Payment Entry-{field}")

View File