Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Permission issue in Tax Detail report #33313

Merged
merged 1 commit into from
Dec 13, 2022

Conversation

nabinhait
Copy link
Member

Permission issue was coming due to unsufficient permission on doctype DocType

Error Traceback:

request.js:462 Traceback (most recent call last):
  File "apps/frappe/frappe/app.py", line 56, in application
    response = frappe.api.handle()
  File "apps/frappe/frappe/api.py", line 53, in handle
    return _RESTAPIHandler(call, doctype, name).get_response()
  File "apps/frappe/frappe/api.py", line 69, in get_response
    return self.handle_method()
  File "apps/frappe/frappe/api.py", line 79, in handle_method
    return frappe.handler.handle()
  File "apps/frappe/frappe/handler.py", line 45, in handle
    data = execute_cmd(cmd)
  File "apps/frappe/frappe/handler.py", line 83, in execute_cmd
    return frappe.call(method, **frappe.form_dict)
  File "apps/frappe/frappe/__init__.py", line 1586, in call
    return fn(*args, **newargs)
  File "apps/frappe/frappe/__init__.py", line 780, in wrapper_fn
    retval = fn(*args, **get_newargs(fn, kwargs))
  File "apps/frappe/frappe/desk/query_report.py", line 249, in run
    result = generate_report_result(report, filters, user, custom_columns, is_tree, parent_field)
  File "apps/frappe/frappe/__init__.py", line 780, in wrapper_fn
    retval = fn(*args, **get_newargs(fn, kwargs))
  File "apps/frappe/frappe/desk/query_report.py", line 114, in generate_report_result
    result = get_filtered_data(report.ref_doctype, columns, result, user)
  File "apps/frappe/frappe/desk/query_report.py", line 563, in get_filtered_data
    match_filters_per_doctype = get_user_match_filters(linked_doctypes, user=user)
  File "apps/frappe/frappe/desk/query_report.py", line 746, in get_user_match_filters
    filter_list = frappe.desk.reportview.build_match_conditions(dt, user, False)
  File "apps/frappe/frappe/desk/reportview.py", line 682, in build_match_conditions
    match_conditions = DatabaseQuery(doctype, user=user).build_match_conditions(
  File "apps/frappe/frappe/model/db_query.py", line 746, in build_match_conditions
    frappe.throw(_("No permission to read {0}").format(_(self.doctype)), frappe.PermissionError)
  File "apps/frappe/frappe/__init__.py", line 521, in throw
    msgprint(
  File "apps/frappe/frappe/__init__.py", line 489, in msgprint
    _raise_exception()
  File "apps/frappe/frappe/__init__.py", line 441, in _raise_exception
    raise raise_exception(msg)
frappe.exceptions.PermissionError: No permission to read DocType

@github-actions github-actions bot added the needs-tests This PR needs automated unit-tests. label Dec 13, 2022
@codecov
Copy link

codecov bot commented Dec 13, 2022

Codecov Report

Merging #33313 (aa787e4) into develop (31f463d) will increase coverage by 0.13%.
The diff coverage is 100.00%.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #33313      +/-   ##
===========================================
+ Coverage    63.83%   63.96%   +0.13%     
===========================================
  Files          820      818       -2     
  Lines        58771    58620     -151     
===========================================
- Hits         37514    37497      -17     
+ Misses       21257    21123     -134     
Impacted Files Coverage Δ
erpnext/accounts/report/tax_detail/tax_detail.py 90.04% <100.00%> (+0.15%) ⬆️
...pnext/setup/setup_wizard/operations/taxes_setup.py 90.83% <0.00%> (-6.88%) ⬇️
erpnext/stock/doctype/warehouse/warehouse.py 78.04% <0.00%> (-2.75%) ⬇️
erpnext/erpnext_integrations/stripe_integration.py 16.21% <0.00%> (-1.97%) ⬇️
...rpnext/accounts/doctype/fiscal_year/fiscal_year.py 56.00% <0.00%> (-1.15%) ⬇️
...t/support/doctype/warranty_claim/warranty_claim.py 31.25% <0.00%> (-1.11%) ⬇️
.../accounts/doctype/bank_clearance/bank_clearance.py 65.67% <0.00%> (-1.00%) ⬇️
...nce/doctype/maintenance_visit/maintenance_visit.py 59.25% <0.00%> (-0.99%) ⬇️
erpnext/selling/doctype/customer/customer.py 73.61% <0.00%> (-0.66%) ⬇️
erpnext/stock/report/stock_ledger/stock_ledger.py 75.15% <0.00%> (-0.63%) ⬇️
... and 53 more

@ruthra-kumar ruthra-kumar merged commit 3db446e into frappe:develop Dec 13, 2022
@ruthra-kumar
Copy link
Member

@Mergifyio backport version-14-hotfix

@mergify
Copy link
Contributor

mergify bot commented Dec 13, 2022

backport version-14-hotfix

✅ Backports have been created

nabinhait added a commit that referenced this pull request Dec 13, 2022
…-33313

fix: Permission issue in Tax Detail report (backport #33313)
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs-tests This PR needs automated unit-tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants