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