I found it too extreme to mandate WRITE access to GST settings Doctype to access GST Balance Report.
Settings should only be editable for admins. The operators who will access the reports need not have write access to settings. The current check makes it mandatory to provide write access to settings, which is dangerous. Including the code below. I suggest, the check should be removed or changed to Read Access:
frappe.has_permission(“GST Settings”, “write”, throw=True)
@frappe.whitelist()
def get_pending_voucher_types(company=None):
frappe.has_permission("GST Settings", "write", throw=True)
company_accounts = ""
if company:
company_accounts = get_all_gst_accounts(company)
return verify_gstin_update(company_accounts), company_accounts
Path: india_compliance/india_compliance/gst_india/report/gst_balance/gst_balance.py
Alternatively, if the check is truly required to toggle Allow_on_update field for company_gstin, the check could be moved inside the function and made optional:
In the following code,
Path: india_compliance/india_compliance/patches/post_install/update_company_gstin.py
def verify_gstin_update(gst_accounts=None):
if not gst_accounts:
gst_accounts = get_gst_accounts()
voucher_types = get_pending_voucher_types(gst_accounts)
if voucher_types:
toggle_allow_on_submit(True, voucher_types)
return voucher_types
toggle_allow_on_submit(False)
Change this to
if voucher_types:
toggle_allow_on_submit(True, voucher_types)
return voucher_types
this
if voucher_types:
if frappe.has_permission("GST Settings", "write", throw=False):
toggle_allow_on_submit(True, voucher_types)
return voucher_types