Workflow Email Next State Not Being Sent

i have set the workflow state with workflow builder, but email notification on next state isn’t sent

i created an email template also in every state

image

i got this error

Traceback with variables (most recent call last):
  File "apps/frappe/frappe/utils/background_jobs.py", line 213, in execute_job
    retval = method(**kwargs)
      site = 'app.barareca.co.id'
      method = <function send_workflow_action_email at 0x7f54572dfa30>
      event = None
      job_name = '<function send_workflow_action_email at 0x7f33fb945f30>'
      kwargs = {'doc': <LeaveApplication: Nurkholis>, 'transitions': [{'allowed': 'HR Manager', 'action': 'Approve', 'state': 'Approved By SPV', 'allow_self_approval': 1, 'next_state': 'Approved', 'condition': None}, {'allowed': 'HR Manager', 'action': 'Reject', 'state': 'Approved By SPV', 'allow_self_approval': 1, 'next_state': 'Rejected', 'condition': None}]}
      user = 'Administrator'
      is_async = True
      retry = 0
      retval = None
      method_name = 'frappe.workflow.doctype.workflow_action.workflow_action.send_workflow_action_email'
      before_job_task = 'frappe.monitor.start'
  File "apps/frappe/frappe/workflow/doctype/workflow_action/workflow_action.py", line 379, in send_workflow_action_email
    users_data = get_users_next_action_data(transitions, doc)
      doc = <LeaveApplication: Nurkholis>
      transitions = [{'allowed': 'HR Manager', 'action': 'Approve', 'state': 'Approved By SPV', 'allow_self_approval': 1, 'next_state': 'Approved', 'condition': None}, {'allowed': 'HR Manager', 'action': 'Reject', 'state': 'Approved By SPV', 'allow_self_approval': 1, 'next_state': 'Rejected', 'condition': None}]
  File "apps/frappe/frappe/workflow/doctype/workflow_action/workflow_action.py", line 335, in get_users_next_action_data
    filtered_users = [
      transitions = [{'allowed': 'HR Manager', 'action': 'Approve', 'state': 'Approved By SPV', 'allow_self_approval': 1, 'next_state': 'Approved', 'condition': None}, {'allowed': 'HR Manager', 'action': 'Reject', 'state': 'Approved By SPV', 'allow_self_approval': 1, 'next_state': 'Rejected', 'condition': None}]
      user_data_map = {}
      users = ['renjanasemesta87@gmail.com']
      doc = <LeaveApplication: Nurkholis>
      transition = {'allowed': 'HR Manager', 'action': 'Approve', 'state': 'Approved By SPV', 'allow_self_approval': 1, 'next_state': 'Approved', 'condition': None}
      user_has_permission = <function get_users_next_action_data.<locals>.user_has_permission at 0x7f5457234040>
  File "apps/frappe/frappe/workflow/doctype/workflow_action/workflow_action.py", line 336, in <listcomp>
    user for user in users if has_approval_access(user, doc, transition) and user_has_permission(user)
      .0 = <list_iterator object at 0x7f5457352ec0>
      user = 'renjanasemesta87@gmail.com'
      doc = <LeaveApplication: Nurkholis>
      transition = {'allowed': 'HR Manager', 'action': 'Approve', 'state': 'Approved By SPV', 'allow_self_approval': 1, 'next_state': 'Approved', 'condition': None}
      user_has_permission = <function get_users_next_action_data.<locals>.user_has_permission at 0x7f5457234040>
  File "apps/frappe/frappe/utils/caching.py", line 57, in wrapper
    return_val = func(*args, **kwargs)
      args = ('renjanasemesta87@gmail.com',)
      kwargs = {}
      args_key = ********
      func = <function get_users_next_action_data.<locals>.user_has_permission at 0x7f5457391000>
  File "apps/frappe/frappe/workflow/doctype/workflow_action/workflow_action.py", line 331, in user_has_permission
    return has_permission(doctype=doc, user=user, print_logs=False)
      user = 'renjanasemesta87@gmail.com'
      has_permission = <function has_permission at 0x7f545c2e1240>
      doc = <LeaveApplication: Nurkholis>
  File "apps/frappe/frappe/permissions.py", line 49, in inner
    result = func(*args, **kwargs)
      args = ()
      kwargs = {'doctype': <LeaveApplication: Nurkholis>, 'user': 'renjanasemesta87@gmail.com', 'print_logs': False}
      raise_exception = True
      self_perm_check = False
      func = <function has_permission at 0x7f545c2e11b0>
builtins.TypeError: has_permission() got an unexpected keyword argument 'print_logs'

how to fix this?

I am also facing same issue please anyone knows share your solutions.

1 Like

@NCP Hello sir, maybe you will assist us with this error, thank you

@NCP Sir, Need your assistance here.

Hi @Yaswanth_Kumar_Dasar and @aqilmujahidiin,

I’ll review and let you know because I need to check the situation on my side.

Thank You!

thank you

Yes Please review once and let me know sir.

Thank You!

Right @aqilmujahidiin and @Yaswanth_Kumar_Dasar,

But we raised the Pull Request in GitHub for the issue:

If merged then your problem will solved.

Thank You!

1 Like

thank you for your help sir

Thank You Sir!

Sir, it’s only working in version 15, but we need it to work in version 14. Currently, my version is v14.66.0. Additionally, could you please guide me on how to override a function that is not whitelisted and not within a class?

Hi @Yaswanth_Kumar_Dasar,

Your issue will solved in the upcoming update of version 14.

Thank You!

Thank You Sir,
could you please guide me on how to override a function that is not whitelisted and not within a class?

Hi @Yaswanth_Kumar_Dasar,

Please check the references:


Note: Please create a new thread for the new issue.
It has a large community. so if anybody has an answer then will reply to you. :slightly_smiling_face:

Thank You!

after following your instruction for this

now i am facing an error that the email not sent as an email template

image

this is my actual email template

Hi @aqilmujahidiin,

It’s working properly from my side.

Thank You!

i don’t know why

what should i do sir for this?

@NCP Sir, I’ve referred to all those videos earlier, but they only explained how to override class functions and whitelist functions. However, I need a sample function to override, similar to the functions below.

we like to switch off e-mail functionality from workflow and create extra records of Notfication Doctype to cover the e-mail part.

Also this gives you extra options too.

Maybe that will also work for you :slight_smile: