Rushabh Mehta | b3c8f44 | 2017-06-21 17:22:38 +0530 | [diff] [blame] | 1 | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors |
| 2 | # License: GNU General Public License v3. See license.txt |
| 3 | |
| 4 | from __future__ import unicode_literals |
| 5 | |
| 6 | import frappe, os, json |
Rushabh Mehta | f056974 | 2017-09-13 12:52:30 +0530 | [diff] [blame] | 7 | from frappe.custom.doctype.custom_field.custom_field import create_custom_fields |
Nabin Hait | 49b41e4 | 2019-01-24 17:55:44 +0530 | [diff] [blame] | 8 | from frappe.permissions import add_permission, update_permission_property |
Rushabh Mehta | b3c8f44 | 2017-06-21 17:22:38 +0530 | [diff] [blame] | 9 | from erpnext.regional.india import states |
Zarrar | 7f8024c | 2018-08-01 17:45:05 +0530 | [diff] [blame] | 10 | from erpnext.accounts.utils import get_fiscal_year |
| 11 | from frappe.utils import today |
Rushabh Mehta | b3c8f44 | 2017-06-21 17:22:38 +0530 | [diff] [blame] | 12 | |
Rushabh Mehta | 0165927 | 2017-06-27 18:05:17 +0530 | [diff] [blame] | 13 | def setup(company=None, patch=True): |
Prateeksha Singh | dabf349 | 2018-11-13 15:56:15 +0530 | [diff] [blame] | 14 | setup_company_independent_fixtures() |
Prateeksha Singh | 39b8765 | 2018-11-12 17:19:56 +0530 | [diff] [blame] | 15 | if not patch: |
Prateeksha Singh | dabf349 | 2018-11-13 15:56:15 +0530 | [diff] [blame] | 16 | make_fixtures(company) |
Prateeksha Singh | 39b8765 | 2018-11-12 17:19:56 +0530 | [diff] [blame] | 17 | |
| 18 | # TODO: for all countries |
| 19 | def setup_company_independent_fixtures(): |
Rushabh Mehta | b3c8f44 | 2017-06-21 17:22:38 +0530 | [diff] [blame] | 20 | make_custom_fields() |
Rushabh Mehta | b3c8f44 | 2017-06-21 17:22:38 +0530 | [diff] [blame] | 21 | add_permissions() |
Rushabh Mehta | 919a74a | 2017-06-22 16:37:04 +0530 | [diff] [blame] | 22 | add_custom_roles_for_reports() |
Nabin Hait | c314485 | 2017-09-28 18:55:40 +0530 | [diff] [blame] | 23 | frappe.enqueue('erpnext.regional.india.setup.add_hsn_sac_codes', now=frappe.flags.in_test) |
Nabin Hait | 852cb64 | 2017-07-05 12:58:19 +0530 | [diff] [blame] | 24 | add_print_formats() |
Rushabh Mehta | 919a74a | 2017-06-22 16:37:04 +0530 | [diff] [blame] | 25 | |
Nabin Hait | 1a60931 | 2017-07-13 12:16:04 +0530 | [diff] [blame] | 26 | def add_hsn_sac_codes(): |
| 27 | # HSN codes |
Rushabh Mehta | b3c8f44 | 2017-06-21 17:22:38 +0530 | [diff] [blame] | 28 | with open(os.path.join(os.path.dirname(__file__), 'hsn_code_data.json'), 'r') as f: |
| 29 | hsn_codes = json.loads(f.read()) |
| 30 | |
Nabin Hait | 1a60931 | 2017-07-13 12:16:04 +0530 | [diff] [blame] | 31 | create_hsn_codes(hsn_codes, code_field="hsn_code") |
Prateeksha Singh | 95d8fd3 | 2017-09-04 11:14:04 +0530 | [diff] [blame] | 32 | |
Nabin Hait | 1a60931 | 2017-07-13 12:16:04 +0530 | [diff] [blame] | 33 | # SAC Codes |
| 34 | with open(os.path.join(os.path.dirname(__file__), 'sac_code_data.json'), 'r') as f: |
| 35 | sac_codes = json.loads(f.read()) |
| 36 | create_hsn_codes(sac_codes, code_field="sac_code") |
Prateeksha Singh | 95d8fd3 | 2017-09-04 11:14:04 +0530 | [diff] [blame] | 37 | |
Nabin Hait | 1a60931 | 2017-07-13 12:16:04 +0530 | [diff] [blame] | 38 | def create_hsn_codes(data, code_field): |
| 39 | for d in data: |
Rushabh Mehta | f702d72 | 2017-09-27 15:31:30 +0530 | [diff] [blame] | 40 | hsn_code = frappe.new_doc('GST HSN Code') |
| 41 | hsn_code.description = d["description"] |
| 42 | hsn_code.hsn_code = d[code_field] |
| 43 | hsn_code.name = d[code_field] |
| 44 | try: |
Nabin Hait | 1a60931 | 2017-07-13 12:16:04 +0530 | [diff] [blame] | 45 | hsn_code.db_insert() |
Rushabh Mehta | f702d72 | 2017-09-27 15:31:30 +0530 | [diff] [blame] | 46 | except frappe.DuplicateEntryError: |
| 47 | pass |
Rushabh Mehta | b3c8f44 | 2017-06-21 17:22:38 +0530 | [diff] [blame] | 48 | |
Rushabh Mehta | 919a74a | 2017-06-22 16:37:04 +0530 | [diff] [blame] | 49 | def add_custom_roles_for_reports(): |
| 50 | for report_name in ('GST Sales Register', 'GST Purchase Register', |
rohitwaghchaure | 8cca61f | 2018-08-20 17:53:56 +0530 | [diff] [blame] | 51 | 'GST Itemised Sales Register', 'GST Itemised Purchase Register', 'Eway Bill'): |
Rushabh Mehta | 919a74a | 2017-06-22 16:37:04 +0530 | [diff] [blame] | 52 | |
Rushabh Mehta | 919a74a | 2017-06-22 16:37:04 +0530 | [diff] [blame] | 53 | if not frappe.db.get_value('Custom Role', dict(report=report_name)): |
| 54 | frappe.get_doc(dict( |
| 55 | doctype='Custom Role', |
| 56 | report=report_name, |
| 57 | roles= [ |
| 58 | dict(role='Accounts User'), |
| 59 | dict(role='Accounts Manager') |
| 60 | ] |
| 61 | )).insert() |
| 62 | |
Anurag Mishra | 289c822 | 2020-06-19 19:17:57 +0530 | [diff] [blame] | 63 | for report_name in ('Professional Tax Deductions', 'Provident Fund Deductions'): |
| 64 | |
| 65 | if not frappe.db.get_value('Custom Role', dict(report=report_name)): |
| 66 | frappe.get_doc(dict( |
| 67 | doctype='Custom Role', |
| 68 | report=report_name, |
| 69 | roles= [ |
| 70 | dict(role='HR User'), |
| 71 | dict(role='HR Manager'), |
| 72 | dict(role='Employee') |
| 73 | ] |
| 74 | )).insert() |
| 75 | |
Rushabh Mehta | b3c8f44 | 2017-06-21 17:22:38 +0530 | [diff] [blame] | 76 | def add_permissions(): |
Deepesh Garg | d78cf97 | 2020-04-26 20:08:52 +0530 | [diff] [blame] | 77 | for doctype in ('GST HSN Code', 'GST Settings', 'GSTR 3B Report', 'Lower Deduction Certificate'): |
Rushabh Mehta | b3c8f44 | 2017-06-21 17:22:38 +0530 | [diff] [blame] | 78 | add_permission(doctype, 'All', 0) |
Deepesh Garg | 6c8efde | 2020-04-04 20:05:17 +0530 | [diff] [blame] | 79 | for role in ('Accounts Manager', 'Accounts User', 'System Manager'): |
Saqib | 5e6ce88 | 2020-02-03 15:40:35 +0530 | [diff] [blame] | 80 | add_permission(doctype, role, 0) |
| 81 | update_permission_property(doctype, role, 0, 'write', 1) |
| 82 | update_permission_property(doctype, role, 0, 'create', 1) |
Rushabh Mehta | b3c8f44 | 2017-06-21 17:22:38 +0530 | [diff] [blame] | 83 | |
Deepesh Garg | 6c8efde | 2020-04-04 20:05:17 +0530 | [diff] [blame] | 84 | if doctype == 'GST HSN Code': |
| 85 | for role in ('Item Manager', 'Stock Manager'): |
| 86 | add_permission(doctype, role, 0) |
| 87 | update_permission_property(doctype, role, 0, 'write', 1) |
| 88 | update_permission_property(doctype, role, 0, 'create', 1) |
| 89 | |
Nabin Hait | 852cb64 | 2017-07-05 12:58:19 +0530 | [diff] [blame] | 90 | def add_print_formats(): |
| 91 | frappe.reload_doc("regional", "print_format", "gst_tax_invoice") |
rohitwaghchaure | e3b5c0f | 2017-12-16 10:53:53 +0530 | [diff] [blame] | 92 | frappe.reload_doc("accounts", "print_format", "gst_pos_invoice") |
| 93 | |
| 94 | frappe.db.sql(""" update `tabPrint Format` set disabled = 0 where |
| 95 | name in('GST POS Invoice', 'GST Tax Invoice') """) |
Nabin Hait | 852cb64 | 2017-07-05 12:58:19 +0530 | [diff] [blame] | 96 | |
Rushabh Mehta | 69fa808 | 2018-07-17 18:22:51 +0530 | [diff] [blame] | 97 | def make_custom_fields(update=True): |
Nabin Hait | f3f0dfe | 2017-07-06 14:49:34 +0530 | [diff] [blame] | 98 | hsn_sac_field = dict(fieldname='gst_hsn_code', label='HSN/SAC', |
Nabin Hait | d34bfa8 | 2018-11-13 18:19:58 +0530 | [diff] [blame] | 99 | fieldtype='Data', fetch_from='item_code.gst_hsn_code', insert_after='description', |
Nabin Hait | f4af608 | 2019-04-01 11:51:54 +0530 | [diff] [blame] | 100 | allow_on_submit=1, print_hide=1, fetch_if_empty=1) |
Marica | 9942acd | 2020-04-21 13:13:39 +0530 | [diff] [blame] | 101 | nil_rated_exempt = dict(fieldname='is_nil_exempt', label='Is Nil Rated or Exempted', |
Deepesh Garg | 22b6160 | 2019-03-21 20:47:47 +0530 | [diff] [blame] | 102 | fieldtype='Check', fetch_from='item_code.is_nil_exempt', insert_after='gst_hsn_code', |
| 103 | print_hide=1) |
| 104 | is_non_gst = dict(fieldname='is_non_gst', label='Is Non GST', |
| 105 | fieldtype='Check', fetch_from='item_code.is_non_gst', insert_after='is_nil_exempt', |
| 106 | print_hide=1) |
| 107 | |
| 108 | purchase_invoice_gst_category = [ |
Nabin Hait | 879e162 | 2017-08-21 08:28:55 +0530 | [diff] [blame] | 109 | dict(fieldname='gst_section', label='GST Details', fieldtype='Section Break', |
vishdha | 109b408 | 2018-01-30 12:11:13 +0530 | [diff] [blame] | 110 | insert_after='language', print_hide=1, collapsible=1), |
Deepesh Garg | 22b6160 | 2019-03-21 20:47:47 +0530 | [diff] [blame] | 111 | dict(fieldname='gst_category', label='GST Category', |
Nabin Hait | 10dae5d | 2019-04-01 20:56:51 +0530 | [diff] [blame] | 112 | fieldtype='Select', insert_after='gst_section', print_hide=1, |
Nabin Hait | 89b0613 | 2019-05-01 14:18:21 +0530 | [diff] [blame] | 113 | options='\nRegistered Regular\nRegistered Composition\nUnregistered\nSEZ\nOverseas\nUIN Holders', |
Deepesh Garg | 6e2c13f | 2019-12-10 15:55:05 +0530 | [diff] [blame] | 114 | fetch_from='supplier.gst_category', fetch_if_empty=1), |
| 115 | dict(fieldname='export_type', label='Export Type', |
| 116 | fieldtype='Select', insert_after='gst_category', print_hide=1, |
| 117 | depends_on='eval:in_list(["SEZ", "Overseas"], doc.gst_category)', |
| 118 | options='\nWith Payment of Tax\nWithout Payment of Tax', fetch_from='supplier.export_type', |
| 119 | fetch_if_empty=1), |
Deepesh Garg | 22b6160 | 2019-03-21 20:47:47 +0530 | [diff] [blame] | 120 | ] |
| 121 | |
| 122 | sales_invoice_gst_category = [ |
| 123 | dict(fieldname='gst_section', label='GST Details', fieldtype='Section Break', |
| 124 | insert_after='language', print_hide=1, collapsible=1), |
| 125 | dict(fieldname='gst_category', label='GST Category', |
Nabin Hait | 10dae5d | 2019-04-01 20:56:51 +0530 | [diff] [blame] | 126 | fieldtype='Select', insert_after='gst_section', print_hide=1, |
Nabin Hait | 89b0613 | 2019-05-01 14:18:21 +0530 | [diff] [blame] | 127 | options='\nRegistered Regular\nRegistered Composition\nUnregistered\nSEZ\nOverseas\nConsumer\nDeemed Export\nUIN Holders', |
Deepesh Garg | 6e2c13f | 2019-12-10 15:55:05 +0530 | [diff] [blame] | 128 | fetch_from='customer.gst_category', fetch_if_empty=1), |
| 129 | dict(fieldname='export_type', label='Export Type', |
| 130 | fieldtype='Select', insert_after='gst_category', print_hide=1, |
| 131 | depends_on='eval:in_list(["SEZ", "Overseas", "Deemed Export"], doc.gst_category)', |
| 132 | options='\nWith Payment of Tax\nWithout Payment of Tax', fetch_from='customer.export_type', |
| 133 | fetch_if_empty=1), |
Deepesh Garg | 22b6160 | 2019-03-21 20:47:47 +0530 | [diff] [blame] | 134 | ] |
| 135 | |
| 136 | invoice_gst_fields = [ |
Nabin Hait | 879e162 | 2017-08-21 08:28:55 +0530 | [diff] [blame] | 137 | dict(fieldname='invoice_copy', label='Invoice Copy', |
Deepesh Garg | 6e2c13f | 2019-12-10 15:55:05 +0530 | [diff] [blame] | 138 | fieldtype='Select', insert_after='export_type', print_hide=1, allow_on_submit=1, |
Nabin Hait | 879e162 | 2017-08-21 08:28:55 +0530 | [diff] [blame] | 139 | options='Original for Recipient\nDuplicate for Transporter\nDuplicate for Supplier\nTriplicate for Supplier'), |
| 140 | dict(fieldname='reverse_charge', label='Reverse Charge', |
| 141 | fieldtype='Select', insert_after='invoice_copy', print_hide=1, |
| 142 | options='Y\nN', default='N'), |
Nabin Hait | 879e162 | 2017-08-21 08:28:55 +0530 | [diff] [blame] | 143 | dict(fieldname='ecommerce_gstin', label='E-commerce GSTIN', |
Vishal Dhayagude | c463c06 | 2018-01-26 11:27:22 +0530 | [diff] [blame] | 144 | fieldtype='Data', insert_after='export_type', print_hide=1), |
Nabin Hait | e6d65bc | 2018-02-14 17:44:06 +0530 | [diff] [blame] | 145 | dict(fieldname='gst_col_break', fieldtype='Column Break', insert_after='ecommerce_gstin'), |
Vishal Dhayagude | c463c06 | 2018-01-26 11:27:22 +0530 | [diff] [blame] | 146 | dict(fieldname='reason_for_issuing_document', label='Reason For Issuing document', |
Nabin Hait | b02c109 | 2018-02-05 16:09:51 +0530 | [diff] [blame] | 147 | fieldtype='Select', insert_after='gst_col_break', print_hide=1, |
Nabin Hait | e6d65bc | 2018-02-14 17:44:06 +0530 | [diff] [blame] | 148 | depends_on='eval:doc.is_return==1', |
Nabin Hait | a8d10b7 | 2018-02-12 16:54:13 +0530 | [diff] [blame] | 149 | 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') |
Nabin Hait | 879e162 | 2017-08-21 08:28:55 +0530 | [diff] [blame] | 150 | ] |
Prateeksha Singh | 95d8fd3 | 2017-09-04 11:14:04 +0530 | [diff] [blame] | 151 | |
Nabin Hait | 879e162 | 2017-08-21 08:28:55 +0530 | [diff] [blame] | 152 | purchase_invoice_gst_fields = [ |
| 153 | dict(fieldname='supplier_gstin', label='Supplier GSTIN', |
| 154 | fieldtype='Data', insert_after='supplier_address', |
Deepesh Garg | 6e2c13f | 2019-12-10 15:55:05 +0530 | [diff] [blame] | 155 | fetch_from='supplier_address.gstin', print_hide=1, read_only=1), |
Nabin Hait | 879e162 | 2017-08-21 08:28:55 +0530 | [diff] [blame] | 156 | dict(fieldname='company_gstin', label='Company GSTIN', |
Shreya Shah | 4fa600a | 2018-06-05 11:27:53 +0530 | [diff] [blame] | 157 | fieldtype='Data', insert_after='shipping_address_display', |
Deepesh Garg | 6e2c13f | 2019-12-10 15:55:05 +0530 | [diff] [blame] | 158 | fetch_from='shipping_address.gstin', print_hide=1, read_only=1), |
Nabin Hait | b02c109 | 2018-02-05 16:09:51 +0530 | [diff] [blame] | 159 | dict(fieldname='place_of_supply', label='Place of Supply', |
| 160 | fieldtype='Data', insert_after='shipping_address', |
Deepesh Garg | 6e2c13f | 2019-12-10 15:55:05 +0530 | [diff] [blame] | 161 | print_hide=1, read_only=1), |
deepeshgarg007 | d29ee97 | 2019-01-09 17:09:11 +0530 | [diff] [blame] | 162 | ] |
| 163 | |
| 164 | purchase_invoice_itc_fields = [ |
vishdha | 98e33c3 | 2018-01-29 13:57:34 +0530 | [diff] [blame] | 165 | dict(fieldname='eligibility_for_itc', label='Eligibility For ITC', |
| 166 | fieldtype='Select', insert_after='reason_for_issuing_document', print_hide=1, |
Deepesh Garg | 22b6160 | 2019-03-21 20:47:47 +0530 | [diff] [blame] | 167 | options='Input Service Distributor\nImport Of Service\nImport Of Capital Goods\nIneligible\nAll Other ITC', default="All Other ITC"), |
vishdha | 98e33c3 | 2018-01-29 13:57:34 +0530 | [diff] [blame] | 168 | dict(fieldname='itc_integrated_tax', label='Availed ITC Integrated Tax', |
| 169 | fieldtype='Data', insert_after='eligibility_for_itc', print_hide=1), |
| 170 | dict(fieldname='itc_central_tax', label='Availed ITC Central Tax', |
| 171 | fieldtype='Data', insert_after='itc_integrated_tax', print_hide=1), |
| 172 | dict(fieldname='itc_state_tax', label='Availed ITC State/UT Tax', |
| 173 | fieldtype='Data', insert_after='itc_central_tax', print_hide=1), |
| 174 | dict(fieldname='itc_cess_amount', label='Availed ITC Cess', |
| 175 | fieldtype='Data', insert_after='itc_state_tax', print_hide=1), |
Nabin Hait | 879e162 | 2017-08-21 08:28:55 +0530 | [diff] [blame] | 176 | ] |
Prateeksha Singh | 95d8fd3 | 2017-09-04 11:14:04 +0530 | [diff] [blame] | 177 | |
Nabin Hait | 879e162 | 2017-08-21 08:28:55 +0530 | [diff] [blame] | 178 | sales_invoice_gst_fields = [ |
rohitwaghchaure | 1664580 | 2017-09-28 11:05:03 +0530 | [diff] [blame] | 179 | dict(fieldname='billing_address_gstin', label='Billing Address GSTIN', |
Deepesh Garg | 6e2c13f | 2019-12-10 15:55:05 +0530 | [diff] [blame] | 180 | fieldtype='Data', insert_after='customer_address', read_only=1, |
Shreya Shah | 4fa600a | 2018-06-05 11:27:53 +0530 | [diff] [blame] | 181 | fetch_from='customer_address.gstin', print_hide=1), |
Nabin Hait | 879e162 | 2017-08-21 08:28:55 +0530 | [diff] [blame] | 182 | dict(fieldname='customer_gstin', label='Customer GSTIN', |
Shreya Shah | 4fa600a | 2018-06-05 11:27:53 +0530 | [diff] [blame] | 183 | fieldtype='Data', insert_after='shipping_address_name', |
| 184 | fetch_from='shipping_address_name.gstin', print_hide=1), |
Nabin Hait | 879e162 | 2017-08-21 08:28:55 +0530 | [diff] [blame] | 185 | dict(fieldname='place_of_supply', label='Place of Supply', |
Nabin Hait | 619c42b | 2018-01-10 17:48:03 +0530 | [diff] [blame] | 186 | fieldtype='Data', insert_after='customer_gstin', |
Deepesh Garg | 6e2c13f | 2019-12-10 15:55:05 +0530 | [diff] [blame] | 187 | print_hide=1, read_only=1), |
Nabin Hait | 879e162 | 2017-08-21 08:28:55 +0530 | [diff] [blame] | 188 | dict(fieldname='company_gstin', label='Company GSTIN', |
| 189 | fieldtype='Data', insert_after='company_address', |
Deepesh Garg | 6e2c13f | 2019-12-10 15:55:05 +0530 | [diff] [blame] | 190 | fetch_from='company_address.gstin', print_hide=1, read_only=1), |
deepeshgarg007 | d29ee97 | 2019-01-09 17:09:11 +0530 | [diff] [blame] | 191 | ] |
| 192 | |
| 193 | sales_invoice_shipping_fields = [ |
vishdha | 98e33c3 | 2018-01-29 13:57:34 +0530 | [diff] [blame] | 194 | dict(fieldname='port_code', label='Port Code', |
| 195 | fieldtype='Data', insert_after='reason_for_issuing_document', print_hide=1, |
Deepesh Garg | 22b6160 | 2019-03-21 20:47:47 +0530 | [diff] [blame] | 196 | depends_on="eval:doc.gst_category=='Overseas' "), |
vishdha | 98e33c3 | 2018-01-29 13:57:34 +0530 | [diff] [blame] | 197 | dict(fieldname='shipping_bill_number', label=' Shipping Bill Number', |
| 198 | fieldtype='Data', insert_after='port_code', print_hide=1, |
Deepesh Garg | 22b6160 | 2019-03-21 20:47:47 +0530 | [diff] [blame] | 199 | depends_on="eval:doc.gst_category=='Overseas' "), |
vishdha | 98e33c3 | 2018-01-29 13:57:34 +0530 | [diff] [blame] | 200 | dict(fieldname='shipping_bill_date', label='Shipping Bill Date', |
| 201 | fieldtype='Date', insert_after='shipping_bill_number', print_hide=1, |
Deepesh Garg | 22b6160 | 2019-03-21 20:47:47 +0530 | [diff] [blame] | 202 | depends_on="eval:doc.gst_category=='Overseas' "), |
Nabin Hait | 879e162 | 2017-08-21 08:28:55 +0530 | [diff] [blame] | 203 | ] |
Prateeksha Singh | 95d8fd3 | 2017-09-04 11:14:04 +0530 | [diff] [blame] | 204 | |
Shreya Shah | 4fa600a | 2018-06-05 11:27:53 +0530 | [diff] [blame] | 205 | inter_state_gst_field = [ |
| 206 | dict(fieldname='is_inter_state', label='Is Inter State', |
Deepesh Garg | 6e2c13f | 2019-12-10 15:55:05 +0530 | [diff] [blame] | 207 | fieldtype='Check', insert_after='disabled', print_hide=1), |
| 208 | dict(fieldname='tax_category_column_break', fieldtype='Column Break', |
| 209 | insert_after='is_inter_state'), |
| 210 | dict(fieldname='gst_state', label='Source State', fieldtype='Select', |
| 211 | options='\n'.join(states), insert_after='company') |
Shreya Shah | 4fa600a | 2018-06-05 11:27:53 +0530 | [diff] [blame] | 212 | ] |
| 213 | |
Sagar Vora | d92f3ac | 2018-10-10 14:51:26 +0530 | [diff] [blame] | 214 | ewaybill_fields = [ |
| 215 | { |
| 216 | 'fieldname': 'distance', |
| 217 | 'label': 'Distance (in km)', |
| 218 | 'fieldtype': 'Float', |
| 219 | 'insert_after': 'vehicle_no', |
| 220 | 'print_hide': 1 |
| 221 | }, |
| 222 | { |
| 223 | 'fieldname': 'gst_transporter_id', |
| 224 | 'label': 'GST Transporter ID', |
| 225 | 'fieldtype': 'Data', |
Nabin Hait | 34c551d | 2019-07-03 10:34:31 +0530 | [diff] [blame] | 226 | 'insert_after': 'transporter', |
Sagar Vora | d92f3ac | 2018-10-10 14:51:26 +0530 | [diff] [blame] | 227 | 'fetch_from': 'transporter.gst_transporter_id', |
Nabin Hait | 34c551d | 2019-07-03 10:34:31 +0530 | [diff] [blame] | 228 | 'print_hide': 1, |
| 229 | 'translatable': 0 |
Sagar Vora | d92f3ac | 2018-10-10 14:51:26 +0530 | [diff] [blame] | 230 | }, |
| 231 | { |
| 232 | 'fieldname': 'mode_of_transport', |
| 233 | 'label': 'Mode of Transport', |
| 234 | 'fieldtype': 'Select', |
| 235 | 'options': '\nRoad\nAir\nRail\nShip', |
| 236 | 'default': 'Road', |
Nabin Hait | 34c551d | 2019-07-03 10:34:31 +0530 | [diff] [blame] | 237 | 'insert_after': 'transporter_name', |
| 238 | 'print_hide': 1, |
| 239 | 'translatable': 0 |
| 240 | }, |
| 241 | { |
| 242 | 'fieldname': 'gst_vehicle_type', |
| 243 | 'label': 'GST Vehicle Type', |
| 244 | 'fieldtype': 'Select', |
| 245 | 'options': 'Regular\nOver Dimensional Cargo (ODC)', |
| 246 | 'depends_on': 'eval:(doc.mode_of_transport === "Road")', |
| 247 | 'default': 'Regular', |
Sagar Vora | d92f3ac | 2018-10-10 14:51:26 +0530 | [diff] [blame] | 248 | 'insert_after': 'lr_date', |
Nabin Hait | 34c551d | 2019-07-03 10:34:31 +0530 | [diff] [blame] | 249 | 'print_hide': 1, |
| 250 | 'translatable': 0 |
Deepesh Garg | 15ff6a5 | 2020-02-18 12:28:41 +0530 | [diff] [blame] | 251 | }, |
| 252 | { |
| 253 | 'fieldname': 'ewaybill', |
| 254 | 'label': 'E-Way Bill No.', |
| 255 | 'fieldtype': 'Data', |
| 256 | 'depends_on': 'eval:(doc.docstatus === 1)', |
| 257 | 'allow_on_submit': 1, |
| 258 | 'insert_after': 'customer_name_in_arabic', |
| 259 | 'translatable': 0, |
| 260 | } |
Nabin Hait | 34c551d | 2019-07-03 10:34:31 +0530 | [diff] [blame] | 261 | ] |
| 262 | |
| 263 | si_ewaybill_fields = [ |
| 264 | { |
| 265 | 'fieldname': 'transporter_info', |
| 266 | 'label': 'Transporter Info', |
| 267 | 'fieldtype': 'Section Break', |
| 268 | 'insert_after': 'terms', |
| 269 | 'collapsible': 1, |
| 270 | 'collapsible_depends_on': 'transporter', |
| 271 | 'print_hide': 1 |
| 272 | }, |
| 273 | { |
| 274 | 'fieldname': 'transporter', |
| 275 | 'label': 'Transporter', |
| 276 | 'fieldtype': 'Link', |
| 277 | 'insert_after': 'transporter_info', |
| 278 | 'options': 'Supplier', |
| 279 | 'print_hide': 1 |
| 280 | }, |
| 281 | { |
| 282 | 'fieldname': 'gst_transporter_id', |
| 283 | 'label': 'GST Transporter ID', |
| 284 | 'fieldtype': 'Data', |
| 285 | 'insert_after': 'transporter', |
| 286 | 'fetch_from': 'transporter.gst_transporter_id', |
| 287 | 'print_hide': 1, |
| 288 | 'translatable': 0 |
| 289 | }, |
| 290 | { |
| 291 | 'fieldname': 'driver', |
| 292 | 'label': 'Driver', |
| 293 | 'fieldtype': 'Link', |
| 294 | 'insert_after': 'gst_transporter_id', |
| 295 | 'options': 'Driver', |
| 296 | 'print_hide': 1 |
| 297 | }, |
| 298 | { |
| 299 | 'fieldname': 'lr_no', |
| 300 | 'label': 'Transport Receipt No', |
| 301 | 'fieldtype': 'Data', |
| 302 | 'insert_after': 'driver', |
| 303 | 'print_hide': 1, |
| 304 | 'translatable': 0 |
| 305 | }, |
| 306 | { |
| 307 | 'fieldname': 'vehicle_no', |
| 308 | 'label': 'Vehicle No', |
| 309 | 'fieldtype': 'Data', |
| 310 | 'insert_after': 'lr_no', |
| 311 | 'print_hide': 1, |
| 312 | 'translatable': 0 |
| 313 | }, |
| 314 | { |
| 315 | 'fieldname': 'distance', |
| 316 | 'label': 'Distance (in km)', |
| 317 | 'fieldtype': 'Float', |
| 318 | 'insert_after': 'vehicle_no', |
| 319 | 'print_hide': 1 |
| 320 | }, |
| 321 | { |
| 322 | 'fieldname': 'transporter_col_break', |
| 323 | 'fieldtype': 'Column Break', |
| 324 | 'insert_after': 'distance' |
| 325 | }, |
| 326 | { |
| 327 | 'fieldname': 'transporter_name', |
| 328 | 'label': 'Transporter Name', |
| 329 | 'fieldtype': 'Data', |
| 330 | 'insert_after': 'transporter_col_break', |
| 331 | 'fetch_from': 'transporter.name', |
| 332 | 'read_only': 1, |
| 333 | 'print_hide': 1, |
| 334 | 'translatable': 0 |
| 335 | }, |
| 336 | { |
| 337 | 'fieldname': 'mode_of_transport', |
| 338 | 'label': 'Mode of Transport', |
| 339 | 'fieldtype': 'Select', |
| 340 | 'options': '\nRoad\nAir\nRail\nShip', |
| 341 | 'default': 'Road', |
| 342 | 'insert_after': 'transporter_name', |
| 343 | 'print_hide': 1, |
| 344 | 'translatable': 0 |
| 345 | }, |
| 346 | { |
| 347 | 'fieldname': 'driver_name', |
| 348 | 'label': 'Driver Name', |
| 349 | 'fieldtype': 'Data', |
| 350 | 'insert_after': 'mode_of_transport', |
| 351 | 'fetch_from': 'driver.full_name', |
| 352 | 'print_hide': 1, |
| 353 | 'translatable': 0 |
| 354 | }, |
| 355 | { |
| 356 | 'fieldname': 'lr_date', |
| 357 | 'label': 'Transport Receipt Date', |
| 358 | 'fieldtype': 'Date', |
| 359 | 'insert_after': 'driver_name', |
| 360 | 'default': 'Today', |
Sagar Vora | d92f3ac | 2018-10-10 14:51:26 +0530 | [diff] [blame] | 361 | 'print_hide': 1 |
| 362 | }, |
| 363 | { |
| 364 | 'fieldname': 'gst_vehicle_type', |
| 365 | 'label': 'GST Vehicle Type', |
| 366 | 'fieldtype': 'Select', |
Nabin Hait | 34c551d | 2019-07-03 10:34:31 +0530 | [diff] [blame] | 367 | 'options': 'Regular\nOver Dimensional Cargo (ODC)', |
Sagar Vora | d92f3ac | 2018-10-10 14:51:26 +0530 | [diff] [blame] | 368 | 'depends_on': 'eval:(doc.mode_of_transport === "Road")', |
Nabin Hait | 34c551d | 2019-07-03 10:34:31 +0530 | [diff] [blame] | 369 | 'default': 'Regular', |
| 370 | 'insert_after': 'lr_date', |
| 371 | 'print_hide': 1, |
| 372 | 'translatable': 0 |
| 373 | }, |
| 374 | { |
| 375 | 'fieldname': 'ewaybill', |
Deepesh Garg | 15ff6a5 | 2020-02-18 12:28:41 +0530 | [diff] [blame] | 376 | 'label': 'E-Way Bill No.', |
Nabin Hait | 34c551d | 2019-07-03 10:34:31 +0530 | [diff] [blame] | 377 | 'fieldtype': 'Data', |
| 378 | 'depends_on': 'eval:(doc.docstatus === 1)', |
| 379 | 'allow_on_submit': 1, |
deepeshgarg007 | a85db66 | 2019-07-14 18:15:19 +0530 | [diff] [blame] | 380 | 'insert_after': 'tax_id', |
Nabin Hait | 34c551d | 2019-07-03 10:34:31 +0530 | [diff] [blame] | 381 | 'translatable': 0 |
Sagar Vora | d92f3ac | 2018-10-10 14:51:26 +0530 | [diff] [blame] | 382 | } |
| 383 | ] |
| 384 | |
Rushabh Mehta | b3c8f44 | 2017-06-21 17:22:38 +0530 | [diff] [blame] | 385 | custom_fields = { |
| 386 | 'Address': [ |
Rushabh Mehta | 919a74a | 2017-06-22 16:37:04 +0530 | [diff] [blame] | 387 | dict(fieldname='gstin', label='Party GSTIN', fieldtype='Data', |
| 388 | insert_after='fax'), |
Rushabh Mehta | b3c8f44 | 2017-06-21 17:22:38 +0530 | [diff] [blame] | 389 | dict(fieldname='gst_state', label='GST State', fieldtype='Select', |
Nabin Hait | f3f0dfe | 2017-07-06 14:49:34 +0530 | [diff] [blame] | 390 | options='\n'.join(states), insert_after='gstin'), |
| 391 | dict(fieldname='gst_state_number', label='GST State Number', |
Nabin Hait | 562d942 | 2018-09-07 16:14:44 +0530 | [diff] [blame] | 392 | fieldtype='Data', insert_after='gst_state', read_only=1), |
Rushabh Mehta | b3c8f44 | 2017-06-21 17:22:38 +0530 | [diff] [blame] | 393 | ], |
Deepesh Garg | 22b6160 | 2019-03-21 20:47:47 +0530 | [diff] [blame] | 394 | 'Purchase Invoice': purchase_invoice_gst_category + invoice_gst_fields + purchase_invoice_itc_fields + purchase_invoice_gst_fields, |
deepeshgarg007 | d29ee97 | 2019-01-09 17:09:11 +0530 | [diff] [blame] | 395 | 'Purchase Order': purchase_invoice_gst_fields, |
| 396 | 'Purchase Receipt': purchase_invoice_gst_fields, |
Nabin Hait | 34c551d | 2019-07-03 10:34:31 +0530 | [diff] [blame] | 397 | 'Sales Invoice': sales_invoice_gst_category + invoice_gst_fields + sales_invoice_shipping_fields + sales_invoice_gst_fields + si_ewaybill_fields, |
| 398 | 'Delivery Note': sales_invoice_gst_fields + ewaybill_fields + sales_invoice_shipping_fields, |
deepeshgarg007 | d29ee97 | 2019-01-09 17:09:11 +0530 | [diff] [blame] | 399 | 'Sales Order': sales_invoice_gst_fields, |
Deepesh Garg | 6e2c13f | 2019-12-10 15:55:05 +0530 | [diff] [blame] | 400 | 'Tax Category': inter_state_gst_field, |
Rushabh Mehta | b3c8f44 | 2017-06-21 17:22:38 +0530 | [diff] [blame] | 401 | 'Item': [ |
Nabin Hait | f3f0dfe | 2017-07-06 14:49:34 +0530 | [diff] [blame] | 402 | dict(fieldname='gst_hsn_code', label='HSN/SAC', |
Rushabh Mehta | b3c8f44 | 2017-06-21 17:22:38 +0530 | [diff] [blame] | 403 | fieldtype='Link', options='GST HSN Code', insert_after='item_group'), |
Marica | 9942acd | 2020-04-21 13:13:39 +0530 | [diff] [blame] | 404 | dict(fieldname='is_nil_exempt', label='Is Nil Rated or Exempted', |
Deepesh Garg | 22b6160 | 2019-03-21 20:47:47 +0530 | [diff] [blame] | 405 | fieldtype='Check', insert_after='gst_hsn_code'), |
| 406 | dict(fieldname='is_non_gst', label='Is Non GST ', |
| 407 | fieldtype='Check', insert_after='is_nil_exempt') |
Rushabh Mehta | b3c8f44 | 2017-06-21 17:22:38 +0530 | [diff] [blame] | 408 | ], |
Deepesh Garg | 22b6160 | 2019-03-21 20:47:47 +0530 | [diff] [blame] | 409 | 'Quotation Item': [hsn_sac_field, nil_rated_exempt, is_non_gst], |
| 410 | 'Supplier Quotation Item': [hsn_sac_field, nil_rated_exempt, is_non_gst], |
| 411 | 'Sales Order Item': [hsn_sac_field, nil_rated_exempt, is_non_gst], |
| 412 | 'Delivery Note Item': [hsn_sac_field, nil_rated_exempt, is_non_gst], |
| 413 | 'Sales Invoice Item': [hsn_sac_field, nil_rated_exempt, is_non_gst], |
| 414 | 'Purchase Order Item': [hsn_sac_field, nil_rated_exempt, is_non_gst], |
| 415 | 'Purchase Receipt Item': [hsn_sac_field, nil_rated_exempt, is_non_gst], |
| 416 | 'Purchase Invoice Item': [hsn_sac_field, nil_rated_exempt, is_non_gst], |
Himanshu Warekar | 656d8e4 | 2019-04-01 19:38:43 +0530 | [diff] [blame] | 417 | 'Material Request Item': [hsn_sac_field, nil_rated_exempt, is_non_gst], |
Anurag Mishra | 289c822 | 2020-06-19 19:17:57 +0530 | [diff] [blame] | 418 | 'Salary Component': [ |
| 419 | dict(fieldname= 'component_type', |
| 420 | label= 'Component Type', |
| 421 | fieldtype= 'Select', |
| 422 | insert_after= 'description', |
| 423 | options= "\nProvident Fund\nAdditional Provident Fund\nProvident Fund Loan\nProfessional Tax", |
| 424 | depends_on = 'eval:doc.type == "Deduction"' |
| 425 | ) |
| 426 | ], |
Pawan Mehta | f419635 | 2018-04-05 14:54:51 +0530 | [diff] [blame] | 427 | 'Employee': [ |
Anurag Mishra | 289c822 | 2020-06-19 19:17:57 +0530 | [diff] [blame] | 428 | dict(fieldname='ifsc_code', |
| 429 | label='IFSC Code', |
| 430 | fieldtype='Data', |
| 431 | insert_after='bank_ac_no', |
| 432 | print_hide=1, |
| 433 | depends_on='eval:doc.salary_mode == "Bank"' |
| 434 | ), |
| 435 | dict( |
| 436 | fieldname = 'pan_number', |
| 437 | label = 'PAN Number', |
| 438 | fieldtype = 'Data', |
| 439 | insert_after = 'payroll_cost_center', |
| 440 | print_hide = 1 |
| 441 | ), |
| 442 | dict( |
| 443 | fieldname = 'micr_code', |
| 444 | label = 'MICR Code', |
| 445 | fieldtype = 'Data', |
| 446 | insert_after = 'ifsc_code', |
| 447 | print_hide = 1, |
| 448 | depends_on='eval:doc.salary_mode == "Bank"' |
| 449 | ), |
| 450 | dict( |
| 451 | fieldname = 'provident_fund_account', |
| 452 | label = 'Provident Fund Account', |
| 453 | fieldtype = 'Data', |
| 454 | insert_after = 'pan_number' |
| 455 | ) |
| 456 | |
Ranjith Kurungadam | a8e047a | 2018-06-14 17:56:16 +0530 | [diff] [blame] | 457 | ], |
| 458 | 'Company': [ |
| 459 | dict(fieldname='hra_section', label='HRA Settings', |
Anurag Mishra | a552722 | 2019-06-14 15:25:57 +0530 | [diff] [blame] | 460 | fieldtype='Section Break', insert_after='asset_received_but_not_billed', collapsible=1), |
Ranjith Kurungadam | b1a756c | 2018-07-01 16:42:38 +0530 | [diff] [blame] | 461 | dict(fieldname='basic_component', label='Basic Component', |
Ranjith Kurungadam | a8e047a | 2018-06-14 17:56:16 +0530 | [diff] [blame] | 462 | fieldtype='Link', options='Salary Component', insert_after='hra_section'), |
Ranjith Kurungadam | b1a756c | 2018-07-01 16:42:38 +0530 | [diff] [blame] | 463 | dict(fieldname='hra_component', label='HRA Component', |
| 464 | fieldtype='Link', options='Salary Component', insert_after='basic_component'), |
Ranjith Kurungadam | a8e047a | 2018-06-14 17:56:16 +0530 | [diff] [blame] | 465 | dict(fieldname='arrear_component', label='Arrear Component', |
Mangesh-Khairnar | 9215de0 | 2019-05-06 16:24:10 +0530 | [diff] [blame] | 466 | fieldtype='Link', options='Salary Component', insert_after='hra_component'), |
Ranjith Kurungadam | a8e047a | 2018-06-14 17:56:16 +0530 | [diff] [blame] | 467 | ], |
| 468 | 'Employee Tax Exemption Declaration':[ |
| 469 | dict(fieldname='hra_section', label='HRA Exemption', |
| 470 | fieldtype='Section Break', insert_after='declarations'), |
Ranjith Kurungadam | a8e047a | 2018-06-14 17:56:16 +0530 | [diff] [blame] | 471 | dict(fieldname='monthly_house_rent', label='Monthly House Rent', |
Nabin Hait | 04e7bf4 | 2019-04-25 18:44:10 +0530 | [diff] [blame] | 472 | fieldtype='Currency', insert_after='hra_section'), |
Ranjith Kurungadam | a8e047a | 2018-06-14 17:56:16 +0530 | [diff] [blame] | 473 | dict(fieldname='rented_in_metro_city', label='Rented in Metro City', |
Nabin Hait | 04e7bf4 | 2019-04-25 18:44:10 +0530 | [diff] [blame] | 474 | fieldtype='Check', insert_after='monthly_house_rent', depends_on='monthly_house_rent'), |
| 475 | dict(fieldname='salary_structure_hra', label='HRA as per Salary Structure', |
| 476 | fieldtype='Currency', insert_after='rented_in_metro_city', read_only=1, depends_on='monthly_house_rent'), |
Ranjith Kurungadam | a8e047a | 2018-06-14 17:56:16 +0530 | [diff] [blame] | 477 | dict(fieldname='hra_column_break', fieldtype='Column Break', |
Nabin Hait | 04e7bf4 | 2019-04-25 18:44:10 +0530 | [diff] [blame] | 478 | insert_after='salary_structure_hra', depends_on='monthly_house_rent'), |
Ranjith Kurungadam | a8e047a | 2018-06-14 17:56:16 +0530 | [diff] [blame] | 479 | dict(fieldname='annual_hra_exemption', label='Annual HRA Exemption', |
Nabin Hait | 04e7bf4 | 2019-04-25 18:44:10 +0530 | [diff] [blame] | 480 | fieldtype='Currency', insert_after='hra_column_break', read_only=1, depends_on='monthly_house_rent'), |
Ranjith Kurungadam | a8e047a | 2018-06-14 17:56:16 +0530 | [diff] [blame] | 481 | dict(fieldname='monthly_hra_exemption', label='Monthly HRA Exemption', |
Nabin Hait | 04e7bf4 | 2019-04-25 18:44:10 +0530 | [diff] [blame] | 482 | fieldtype='Currency', insert_after='annual_hra_exemption', read_only=1, depends_on='monthly_house_rent') |
Ranjith Kurungadam | a8e047a | 2018-06-14 17:56:16 +0530 | [diff] [blame] | 483 | ], |
| 484 | 'Employee Tax Exemption Proof Submission': [ |
| 485 | dict(fieldname='hra_section', label='HRA Exemption', |
| 486 | fieldtype='Section Break', insert_after='tax_exemption_proofs'), |
| 487 | dict(fieldname='house_rent_payment_amount', label='House Rent Payment Amount', |
| 488 | fieldtype='Currency', insert_after='hra_section'), |
| 489 | dict(fieldname='rented_in_metro_city', label='Rented in Metro City', |
Nabin Hait | 04e7bf4 | 2019-04-25 18:44:10 +0530 | [diff] [blame] | 490 | fieldtype='Check', insert_after='house_rent_payment_amount', depends_on='house_rent_payment_amount'), |
Ranjith Kurungadam | a8e047a | 2018-06-14 17:56:16 +0530 | [diff] [blame] | 491 | dict(fieldname='rented_from_date', label='Rented From Date', |
Nabin Hait | 04e7bf4 | 2019-04-25 18:44:10 +0530 | [diff] [blame] | 492 | fieldtype='Date', insert_after='rented_in_metro_city', depends_on='house_rent_payment_amount'), |
Ranjith Kurungadam | a8e047a | 2018-06-14 17:56:16 +0530 | [diff] [blame] | 493 | dict(fieldname='rented_to_date', label='Rented To Date', |
Nabin Hait | 04e7bf4 | 2019-04-25 18:44:10 +0530 | [diff] [blame] | 494 | fieldtype='Date', insert_after='rented_from_date', depends_on='house_rent_payment_amount'), |
Ranjith Kurungadam | a8e047a | 2018-06-14 17:56:16 +0530 | [diff] [blame] | 495 | dict(fieldname='hra_column_break', fieldtype='Column Break', |
Nabin Hait | 04e7bf4 | 2019-04-25 18:44:10 +0530 | [diff] [blame] | 496 | insert_after='rented_to_date', depends_on='house_rent_payment_amount'), |
Ranjith Kurungadam | a8e047a | 2018-06-14 17:56:16 +0530 | [diff] [blame] | 497 | dict(fieldname='monthly_house_rent', label='Monthly House Rent', |
Nabin Hait | 04e7bf4 | 2019-04-25 18:44:10 +0530 | [diff] [blame] | 498 | fieldtype='Currency', insert_after='hra_column_break', read_only=1, depends_on='house_rent_payment_amount'), |
Ranjith Kurungadam | a8e047a | 2018-06-14 17:56:16 +0530 | [diff] [blame] | 499 | dict(fieldname='monthly_hra_exemption', label='Monthly Eligible Amount', |
Nabin Hait | 04e7bf4 | 2019-04-25 18:44:10 +0530 | [diff] [blame] | 500 | fieldtype='Currency', insert_after='monthly_house_rent', read_only=1, depends_on='house_rent_payment_amount'), |
Ranjith Kurungadam | a8e047a | 2018-06-14 17:56:16 +0530 | [diff] [blame] | 501 | dict(fieldname='total_eligible_hra_exemption', label='Total Eligible HRA Exemption', |
Nabin Hait | 04e7bf4 | 2019-04-25 18:44:10 +0530 | [diff] [blame] | 502 | fieldtype='Currency', insert_after='monthly_hra_exemption', read_only=1, depends_on='house_rent_payment_amount') |
Sagar Vora | d92f3ac | 2018-10-10 14:51:26 +0530 | [diff] [blame] | 503 | ], |
| 504 | 'Supplier': [ |
| 505 | { |
| 506 | 'fieldname': 'gst_transporter_id', |
| 507 | 'label': 'GST Transporter ID', |
| 508 | 'fieldtype': 'Data', |
| 509 | 'insert_after': 'supplier_type', |
| 510 | 'depends_on': 'eval:doc.is_transporter' |
Deepesh Garg | 22b6160 | 2019-03-21 20:47:47 +0530 | [diff] [blame] | 511 | }, |
| 512 | { |
| 513 | 'fieldname': 'gst_category', |
| 514 | 'label': 'GST Category', |
| 515 | 'fieldtype': 'Select', |
| 516 | 'insert_after': 'gst_transporter_id', |
| 517 | 'options': 'Registered Regular\nRegistered Composition\nUnregistered\nSEZ\nOverseas\nUIN Holders', |
| 518 | 'default': 'Unregistered' |
Deepesh Garg | 6e2c13f | 2019-12-10 15:55:05 +0530 | [diff] [blame] | 519 | }, |
| 520 | { |
| 521 | 'fieldname': 'export_type', |
| 522 | 'label': 'Export Type', |
| 523 | 'fieldtype': 'Select', |
| 524 | 'insert_after': 'gst_category', |
| 525 | 'default': 'Without Payment of Tax', |
| 526 | 'depends_on':'eval:in_list(["SEZ", "Overseas"], doc.gst_category)', |
| 527 | 'options': '\nWith Payment of Tax\nWithout Payment of Tax' |
Deepesh Garg | 22b6160 | 2019-03-21 20:47:47 +0530 | [diff] [blame] | 528 | } |
| 529 | ], |
| 530 | 'Customer': [ |
| 531 | { |
| 532 | 'fieldname': 'gst_category', |
| 533 | 'label': 'GST Category', |
| 534 | 'fieldtype': 'Select', |
| 535 | 'insert_after': 'customer_type', |
| 536 | 'options': 'Registered Regular\nRegistered Composition\nUnregistered\nSEZ\nOverseas\nConsumer\nDeemed Export\nUIN Holders', |
| 537 | 'default': 'Unregistered' |
Deepesh Garg | 6e2c13f | 2019-12-10 15:55:05 +0530 | [diff] [blame] | 538 | }, |
| 539 | { |
| 540 | 'fieldname': 'export_type', |
| 541 | 'label': 'Export Type', |
| 542 | 'fieldtype': 'Select', |
| 543 | 'insert_after': 'gst_category', |
| 544 | 'default': 'Without Payment of Tax', |
| 545 | 'depends_on':'eval:in_list(["SEZ", "Overseas", "Deemed Export"], doc.gst_category)', |
| 546 | 'options': '\nWith Payment of Tax\nWithout Payment of Tax' |
Sagar Vora | d92f3ac | 2018-10-10 14:51:26 +0530 | [diff] [blame] | 547 | } |
Shivam Mishra | 1d6395c | 2020-03-30 18:14:44 +0530 | [diff] [blame] | 548 | ], |
| 549 | "Member": [ |
| 550 | { |
| 551 | 'fieldname': 'pan_number', |
| 552 | 'label': 'PAN Details', |
| 553 | 'fieldtype': 'Data', |
| 554 | 'insert_after': 'email' |
| 555 | } |
Ranjith Kurungadam | a8e047a | 2018-06-14 17:56:16 +0530 | [diff] [blame] | 556 | ] |
Rushabh Mehta | b3c8f44 | 2017-06-21 17:22:38 +0530 | [diff] [blame] | 557 | } |
Deepesh Garg | 22b6160 | 2019-03-21 20:47:47 +0530 | [diff] [blame] | 558 | create_custom_fields(custom_fields, update=update) |
Nabin Hait | 9c42161 | 2017-07-20 13:32:01 +0530 | [diff] [blame] | 559 | |
Saurabh | 2d8a7ee | 2018-05-11 13:16:16 +0530 | [diff] [blame] | 560 | def make_fixtures(company=None): |
| 561 | docs = [] |
| 562 | company = company.name if company else frappe.db.get_value("Global Defaults", None, "default_company") |
| 563 | |
| 564 | set_salary_components(docs) |
Ranjith Kurungadam | e51c175 | 2018-07-24 11:07:28 +0530 | [diff] [blame] | 565 | set_tds_account(docs, company) |
Rushabh Mehta | b3c8f44 | 2017-06-21 17:22:38 +0530 | [diff] [blame] | 566 | |
| 567 | for d in docs: |
| 568 | try: |
| 569 | doc = frappe.get_doc(d) |
| 570 | doc.flags.ignore_permissions = True |
| 571 | doc.insert() |
| 572 | except frappe.NameError: |
Faris Ansari | ec7b064 | 2019-05-14 16:21:09 +0530 | [diff] [blame] | 573 | frappe.clear_messages() |
Zarrar | 7f8024c | 2018-08-01 17:45:05 +0530 | [diff] [blame] | 574 | except frappe.DuplicateEntryError: |
Faris Ansari | ec7b064 | 2019-05-14 16:21:09 +0530 | [diff] [blame] | 575 | frappe.clear_messages() |
Saurabh | 2d8a7ee | 2018-05-11 13:16:16 +0530 | [diff] [blame] | 576 | |
Zarrar | 7f8024c | 2018-08-01 17:45:05 +0530 | [diff] [blame] | 577 | # create records for Tax Withholding Category |
Ranjith Kurungadam | e51c175 | 2018-07-24 11:07:28 +0530 | [diff] [blame] | 578 | set_tax_withholding_category(company) |
| 579 | |
Saurabh | 2d8a7ee | 2018-05-11 13:16:16 +0530 | [diff] [blame] | 580 | def set_salary_components(docs): |
| 581 | docs.extend([ |
Nabin Hait | 58ee6c1 | 2020-04-26 17:45:57 +0530 | [diff] [blame] | 582 | {'doctype': 'Salary Component', 'salary_component': 'Professional Tax', |
| 583 | 'description': 'Professional Tax', 'type': 'Deduction', 'exempted_from_income_tax': 1}, |
| 584 | {'doctype': 'Salary Component', 'salary_component': 'Provident Fund', |
| 585 | 'description': 'Provident fund', 'type': 'Deduction', 'is_tax_applicable': 1}, |
| 586 | {'doctype': 'Salary Component', 'salary_component': 'House Rent Allowance', |
| 587 | 'description': 'House Rent Allowance', 'type': 'Earning', 'is_tax_applicable': 1}, |
| 588 | {'doctype': 'Salary Component', 'salary_component': 'Basic', |
| 589 | 'description': 'Basic', 'type': 'Earning', 'is_tax_applicable': 1}, |
| 590 | {'doctype': 'Salary Component', 'salary_component': 'Arrear', |
| 591 | 'description': 'Arrear', 'type': 'Earning', 'is_tax_applicable': 1}, |
| 592 | {'doctype': 'Salary Component', 'salary_component': 'Leave Encashment', |
| 593 | 'description': 'Leave Encashment', 'type': 'Earning', 'is_tax_applicable': 1} |
Saurabh | 2d8a7ee | 2018-05-11 13:16:16 +0530 | [diff] [blame] | 594 | ]) |
| 595 | |
Ranjith Kurungadam | e51c175 | 2018-07-24 11:07:28 +0530 | [diff] [blame] | 596 | def set_tax_withholding_category(company): |
Saurabh | 2d8a7ee | 2018-05-11 13:16:16 +0530 | [diff] [blame] | 597 | accounts = [] |
Ranjith Kurungadam | e51c175 | 2018-07-24 11:07:28 +0530 | [diff] [blame] | 598 | abbr = frappe.get_value("Company", company, "abbr") |
| 599 | tds_account = frappe.get_value("Account", 'TDS Payable - {0}'.format(abbr), 'name') |
Saurabh | 2d8a7ee | 2018-05-11 13:16:16 +0530 | [diff] [blame] | 600 | |
| 601 | if company and tds_account: |
Ranjith Kurungadam | e51c175 | 2018-07-24 11:07:28 +0530 | [diff] [blame] | 602 | accounts = [dict(company=company, account=tds_account)] |
Saurabh | 2d8a7ee | 2018-05-11 13:16:16 +0530 | [diff] [blame] | 603 | |
Nabin Hait | afef9c1 | 2019-02-12 11:28:20 +0530 | [diff] [blame] | 604 | fiscal_year = get_fiscal_year(today(), company=company)[0] |
Zarrar | 7f8024c | 2018-08-01 17:45:05 +0530 | [diff] [blame] | 605 | docs = get_tds_details(accounts, fiscal_year) |
Ranjith Kurungadam | e51c175 | 2018-07-24 11:07:28 +0530 | [diff] [blame] | 606 | |
Zarrar | 7f8024c | 2018-08-01 17:45:05 +0530 | [diff] [blame] | 607 | for d in docs: |
| 608 | try: |
| 609 | doc = frappe.get_doc(d) |
| 610 | doc.flags.ignore_permissions = True |
Nabin Hait | afef9c1 | 2019-02-12 11:28:20 +0530 | [diff] [blame] | 611 | doc.flags.ignore_mandatory = True |
Zarrar | 7f8024c | 2018-08-01 17:45:05 +0530 | [diff] [blame] | 612 | doc.insert() |
| 613 | except frappe.DuplicateEntryError: |
| 614 | doc = frappe.get_doc("Tax Withholding Category", d.get("name")) |
Zarrar | 963d62b | 2019-03-23 10:30:12 +0530 | [diff] [blame] | 615 | |
| 616 | if accounts: |
| 617 | doc.append("accounts", accounts[0]) |
Zarrar | 7f8024c | 2018-08-01 17:45:05 +0530 | [diff] [blame] | 618 | |
| 619 | # if fiscal year don't match with any of the already entered data, append rate row |
| 620 | fy_exist = [k for k in doc.get('rates') if k.get('fiscal_year')==fiscal_year] |
| 621 | if not fy_exist: |
| 622 | doc.append("rates", d.get('rates')[0]) |
| 623 | |
| 624 | doc.save() |
Saurabh | 2d8a7ee | 2018-05-11 13:16:16 +0530 | [diff] [blame] | 625 | |
| 626 | def set_tds_account(docs, company): |
Ranjith Kurungadam | e51c175 | 2018-07-24 11:07:28 +0530 | [diff] [blame] | 627 | abbr = frappe.get_value("Company", company, "abbr") |
Nabin Hait | f77cd54 | 2018-11-20 16:46:25 +0530 | [diff] [blame] | 628 | parent_account = frappe.db.get_value("Account", filters = {"account_name": "Duties and Taxes", "company": company}) |
| 629 | if parent_account: |
| 630 | docs.extend([ |
| 631 | { |
| 632 | "doctype": "Account", |
| 633 | "account_name": "TDS Payable", |
| 634 | "account_type": "Tax", |
| 635 | "parent_account": parent_account, |
| 636 | "company": company |
| 637 | } |
| 638 | ]) |
Zarrar | 7f8024c | 2018-08-01 17:45:05 +0530 | [diff] [blame] | 639 | |
| 640 | def get_tds_details(accounts, fiscal_year): |
| 641 | # bootstrap default tax withholding sections |
| 642 | return [ |
| 643 | dict(name="TDS - 194C - Company", |
| 644 | category_name="Payment to Contractors (Single / Aggregate)", |
| 645 | doctype="Tax Withholding Category", accounts=accounts, |
| 646 | rates=[{"fiscal_year": fiscal_year, "tax_withholding_rate": 2, |
| 647 | "single_threshold": 30000, "cumulative_threshold": 100000}]), |
| 648 | dict(name="TDS - 194C - Individual", |
| 649 | category_name="Payment to Contractors (Single / Aggregate)", |
| 650 | doctype="Tax Withholding Category", accounts=accounts, |
| 651 | rates=[{"fiscal_year": fiscal_year, "tax_withholding_rate": 1, |
| 652 | "single_threshold": 30000, "cumulative_threshold": 100000}]), |
| 653 | dict(name="TDS - 194C - No PAN / Invalid PAN", |
| 654 | category_name="Payment to Contractors (Single / Aggregate)", |
| 655 | doctype="Tax Withholding Category", accounts=accounts, |
| 656 | rates=[{"fiscal_year": fiscal_year, "tax_withholding_rate": 20, |
| 657 | "single_threshold": 30000, "cumulative_threshold": 100000}]), |
| 658 | dict(name="TDS - 194D - Company", |
| 659 | category_name="Insurance Commission", |
| 660 | doctype="Tax Withholding Category", accounts=accounts, |
| 661 | rates=[{"fiscal_year": fiscal_year, "tax_withholding_rate": 5, |
| 662 | "single_threshold": 15000, "cumulative_threshold": 0}]), |
| 663 | dict(name="TDS - 194D - Company Assessee", |
| 664 | category_name="Insurance Commission", |
| 665 | doctype="Tax Withholding Category", accounts=accounts, |
| 666 | rates=[{"fiscal_year": fiscal_year, "tax_withholding_rate": 10, |
| 667 | "single_threshold": 15000, "cumulative_threshold": 0}]), |
| 668 | dict(name="TDS - 194D - Individual", |
| 669 | category_name="Insurance Commission", |
| 670 | doctype="Tax Withholding Category", accounts=accounts, |
| 671 | rates=[{"fiscal_year": fiscal_year, "tax_withholding_rate": 5, |
| 672 | "single_threshold": 15000, "cumulative_threshold": 0}]), |
| 673 | dict(name="TDS - 194D - No PAN / Invalid PAN", |
| 674 | category_name="Insurance Commission", |
| 675 | doctype="Tax Withholding Category", accounts=accounts, |
| 676 | rates=[{"fiscal_year": fiscal_year, "tax_withholding_rate": 20, |
| 677 | "single_threshold": 15000, "cumulative_threshold": 0}]), |
| 678 | dict(name="TDS - 194DA - Company", |
| 679 | category_name="Non-exempt payments made under a life insurance policy", |
| 680 | doctype="Tax Withholding Category", accounts=accounts, |
| 681 | rates=[{"fiscal_year": fiscal_year, "tax_withholding_rate": 1, |
| 682 | "single_threshold": 100000, "cumulative_threshold": 0}]), |
| 683 | dict(name="TDS - 194DA - Individual", |
| 684 | category_name="Non-exempt payments made under a life insurance policy", |
| 685 | doctype="Tax Withholding Category", accounts=accounts, |
| 686 | rates=[{"fiscal_year": fiscal_year, "tax_withholding_rate": 1, |
| 687 | "single_threshold": 100000, "cumulative_threshold": 0}]), |
| 688 | dict(name="TDS - 194DA - No PAN / Invalid PAN", |
| 689 | category_name="Non-exempt payments made under a life insurance policy", |
| 690 | doctype="Tax Withholding Category", accounts=accounts, |
| 691 | rates=[{"fiscal_year": fiscal_year, "tax_withholding_rate": 20, |
| 692 | "single_threshold": 100000, "cumulative_threshold": 0}]), |
| 693 | dict(name="TDS - 194H - Company", |
| 694 | category_name="Commission / Brokerage", |
| 695 | doctype="Tax Withholding Category", accounts=accounts, |
| 696 | rates=[{"fiscal_year": fiscal_year, "tax_withholding_rate": 5, |
| 697 | "single_threshold": 15000, "cumulative_threshold": 0}]), |
| 698 | dict(name="TDS - 194H - Individual", |
| 699 | category_name="Commission / Brokerage", |
| 700 | doctype="Tax Withholding Category", accounts=accounts, |
| 701 | rates=[{"fiscal_year": fiscal_year, "tax_withholding_rate": 5, |
| 702 | "single_threshold": 15000, "cumulative_threshold": 0}]), |
| 703 | dict(name="TDS - 194H - No PAN / Invalid PAN", |
| 704 | category_name="Commission / Brokerage", |
| 705 | doctype="Tax Withholding Category", accounts=accounts, |
| 706 | rates=[{"fiscal_year": fiscal_year, "tax_withholding_rate": 20, |
| 707 | "single_threshold": 15000, "cumulative_threshold": 0}]), |
| 708 | dict(name="TDS - 194I - Rent - Company", |
| 709 | category_name="Rent", |
| 710 | doctype="Tax Withholding Category", accounts=accounts, |
| 711 | rates=[{"fiscal_year": fiscal_year, "tax_withholding_rate": 10, |
| 712 | "single_threshold": 180000, "cumulative_threshold": 0}]), |
| 713 | dict(name="TDS - 194I - Rent - Individual", |
| 714 | category_name="Rent", |
| 715 | doctype="Tax Withholding Category", accounts=accounts, |
| 716 | rates=[{"fiscal_year": fiscal_year, "tax_withholding_rate": 10, |
| 717 | "single_threshold": 180000, "cumulative_threshold": 0}]), |
| 718 | dict(name="TDS - 194I - Rent - No PAN / Invalid PAN", |
| 719 | category_name="Rent", |
| 720 | doctype="Tax Withholding Category", accounts=accounts, |
| 721 | rates=[{"fiscal_year": fiscal_year, "tax_withholding_rate": 20, |
| 722 | "single_threshold": 180000, "cumulative_threshold": 0}]), |
| 723 | dict(name="TDS - 194I - Rent/Machinery - Company", |
| 724 | category_name="Rent-Plant / Machinery", |
| 725 | doctype="Tax Withholding Category", accounts=accounts, |
| 726 | rates=[{"fiscal_year": fiscal_year, "tax_withholding_rate": 2, |
| 727 | "single_threshold": 180000, "cumulative_threshold": 0}]), |
| 728 | dict(name="TDS - 194I - Rent/Machinery - Individual", |
| 729 | category_name="Rent-Plant / Machinery", |
| 730 | doctype="Tax Withholding Category", accounts=accounts, |
| 731 | rates=[{"fiscal_year": fiscal_year, "tax_withholding_rate": 2, |
| 732 | "single_threshold": 180000, "cumulative_threshold": 0}]), |
| 733 | dict(name="TDS - 194I - Rent/Machinery - No PAN / Invalid PAN", |
| 734 | category_name="Rent-Plant / Machinery", |
| 735 | doctype="Tax Withholding Category", accounts=accounts, |
| 736 | rates=[{"fiscal_year": fiscal_year, "tax_withholding_rate": 20, |
| 737 | "single_threshold": 180000, "cumulative_threshold": 0}]), |
| 738 | dict(name="TDS - 194J - Professional Fees - Company", |
| 739 | category_name="Professional Fees", |
| 740 | doctype="Tax Withholding Category", accounts=accounts, |
| 741 | rates=[{"fiscal_year": fiscal_year, "tax_withholding_rate": 10, |
| 742 | "single_threshold": 30000, "cumulative_threshold": 0}]), |
| 743 | dict(name="TDS - 194J - Professional Fees - Individual", |
| 744 | category_name="Professional Fees", |
| 745 | doctype="Tax Withholding Category", accounts=accounts, |
| 746 | rates=[{"fiscal_year": fiscal_year, "tax_withholding_rate": 10, |
| 747 | "single_threshold": 30000, "cumulative_threshold": 0}]), |
| 748 | dict(name="TDS - 194J - Professional Fees - No PAN / Invalid PAN", |
| 749 | category_name="Professional Fees", |
| 750 | doctype="Tax Withholding Category", accounts=accounts, |
| 751 | rates=[{"fiscal_year": fiscal_year, "tax_withholding_rate": 20, |
| 752 | "single_threshold": 30000, "cumulative_threshold": 0}]), |
| 753 | dict(name="TDS - 194J - Director Fees - Company", |
| 754 | category_name="Director Fees", |
| 755 | doctype="Tax Withholding Category", accounts=accounts, |
| 756 | rates=[{"fiscal_year": fiscal_year, "tax_withholding_rate": 10, |
| 757 | "single_threshold": 0, "cumulative_threshold": 0}]), |
| 758 | dict(name="TDS - 194J - Director Fees - Individual", |
| 759 | category_name="Director Fees", |
| 760 | doctype="Tax Withholding Category", accounts=accounts, |
| 761 | rates=[{"fiscal_year": fiscal_year, "tax_withholding_rate": 10, |
| 762 | "single_threshold": 0, "cumulative_threshold": 0}]), |
| 763 | dict(name="TDS - 194J - Director Fees - No PAN / Invalid PAN", |
| 764 | category_name="Director Fees", |
| 765 | doctype="Tax Withholding Category", accounts=accounts, |
| 766 | rates=[{"fiscal_year": fiscal_year, "tax_withholding_rate": 20, |
| 767 | "single_threshold": 0, "cumulative_threshold": 0}]), |
| 768 | dict(name="TDS - 194 - Dividends - Company", |
| 769 | category_name="Dividends", |
| 770 | doctype="Tax Withholding Category", accounts=accounts, |
| 771 | rates=[{"fiscal_year": fiscal_year, "tax_withholding_rate": 10, |
| 772 | "single_threshold": 2500, "cumulative_threshold": 0}]), |
| 773 | dict(name="TDS - 194 - Dividends - Individual", |
| 774 | category_name="Dividends", |
| 775 | doctype="Tax Withholding Category", accounts=accounts, |
| 776 | rates=[{"fiscal_year": fiscal_year, "tax_withholding_rate": 10, |
| 777 | "single_threshold": 2500, "cumulative_threshold": 0}]), |
| 778 | dict(name="TDS - 194 - Dividends - No PAN / Invalid PAN", |
| 779 | category_name="Dividends", |
| 780 | doctype="Tax Withholding Category", accounts=accounts, |
| 781 | rates=[{"fiscal_year": fiscal_year, "tax_withholding_rate": 20, |
| 782 | "single_threshold": 2500, "cumulative_threshold": 0}]) |
Shivam Mishra | 1d6395c | 2020-03-30 18:14:44 +0530 | [diff] [blame] | 783 | ] |