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: handle PermissionError for auto repeat email notifications #9405

Merged

Conversation

ruchamahabal
Copy link
Member

Backport of: #9404

Fix for:

  • Handle PermissionError while attaching auto created recurring document in the Auto Repeat Notifcation email:
Traceback (most recent call last):
  File "/home/frappe/benches/bench-2019-12-20/apps/frappe/frappe/automation/doctype/autorepeat/autorepeat.py", line 138, in createdocuments
    self.sendnotification(newdoc)
  File "/home/frappe/benches/bench-2019-12-20/apps/frappe/frappe/automation/doctype/autorepeat/autorepeat.py", line 223, in sendnotification
    filename=newdoc.name, printformat=printformat)]
  File "/home/frappe/benches/bench-2019-12-20/apps/frappe/frappe/init.py", line 1405, in attachprint
    "fcontent": getprint(doctype, name, printformat=printformat, style=style, html=html, aspdf=True, doc=doc, noletterhead=noletterhead, password=password)
  File "/home/frappe/benches/bench-2019-12-20/apps/frappe/frappe/init.py", line 1379, in getprint
    html = buildpage("printview")
  File "/home/frappe/benches/bench-2019-12-20/apps/frappe/frappe/website/render.py", line 188, in buildpage
    context = getcontext(path)
  File "/home/frappe/benches/bench-2019-12-20/apps/frappe/frappe/website/context.py", line 28, in getcontext
    context = buildcontext(context)
  File "/home/frappe/benches/bench-2019-12-20/apps/frappe/frappe/website/context.py", line 98, in buildcontext
    updatecontrollercontext(context, context.controller)
  File "/home/frappe/benches/bench-2019-12-20/apps/frappe/frappe/website/context.py", line 48, in updatecontrollercontext
    ret = module.getcontext(context)
  File "/home/frappe/benches/bench-2019-12-20/apps/frappe/frappe/www/printview.py", line 42, in getcontext
    noletterhead=frappe.formdict.noletterhead),
  File "/home/frappe/benches/bench-2019-12-20/apps/frappe/frappe/www/printview.py", line 82, in getrenderedtemplate
    frappe.throw(("Not allowed to print draft documents"), frappe.PermissionError)
  File "/home/frappe/benches/bench-2019-12-20/apps/frappe/frappe/init.py", line 364, in throw
    msgprint(msg, raiseexception=exc, title=title, indicator='red')
  File "/home/frappe/benches/bench-2019-12-20/apps/frappe/frappe/init.py", line 350, in msgprint
    _raiseexception()
  File "/home/frappe/benches/bench-2019-12-20/apps/frappe/frappe/init.py", line 316, in raiseexception
    raise raise_exception(msg)
frappe.exceptions.PermissionError: Not allowed to print draft documents
  • The mail:

mail--auto

failing_test

@surajshetty3416 surajshetty3416 merged commit 28252e7 into frappe:version-12-hotfix Feb 3, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants