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