Redirect from one doctype to the other doctype using python script

Redirect from one doctype to the other doctype using python script

In my Python script, I utilized the redirect_post_login function from Frappe to handle redirection after logging in from an external provider. Here’s a snippet of the code I used:

from frappe.utils.oauth import redirect_post_login

redirect_to = state.get("redirect_to")
redirect_post_login(
    desk_user=frappe.local.response.get('message') == 'Logged In',
    redirect_to={{ "redirect_url" }},
    provider=provider
)

Please refer redirect_post_login function from the below link :

1 Like

Thanks for your replay .
consider this case
i have cust doc type when its work flow state changes to start application i want to redirect it to application doc type .

Thanks for your replay .
consider this case
i have cust doc type when its work flow state changes to start application i want to redirect it to application doc type .

Can you please elaborate? I am not clear from which point the redirection is starting.

Thanks for the reply ,
In my project redirect_to location in python is not working .

frappe.local.response[“type”] = “redirect”
desk_uri = “/app/mortgageapplication”
redirect_to = frappe.utils.get_url(desk_uri)
frappe.local.response[“location”] = redirect_to

i am currently on lead doctype and reditct to mortgageapplication doctype using above code , so my screen get stuck on lead doctype not able to redirect