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