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