Redirecting to new doc

Did you update the python code?

Remember, im just creating new doc, i’m not saving that…

Yes i did:

@frappe.whitelist()
def make_payment_entry():
payment_entry = frappe.new_doc("Payment Entry")
payment_entry.party_type = "Supplier"
return ()

That’s not the code I provided!

Apologies, i didn’t saw the new py code.
Trying

@Ben_Cornwell_Mott , how i expected… I can’t save the document(has some mandatory fields to fill), because i wanna set some values, and open the new document without saving.
Im working with installments, so, when the user select the installment and click on the “Rascunho” button, this generate a new Payment Entry and this form generated will receive some values of the installment, like due_date, installment_value and another things…
But, HOW this will be paid, just the user will fill, so i can’t save, i just wanna create, set some values, and the user will fill the mandatory fields and save the document.

File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 282, in _raise_exception
raise raise_exception(encode(msg))
ValidationError: Party is mandatory

I’ll set party after, but i don’t will set the type of payment, if’s cash or bank and another things, the user will fill that and save after

Then you need to create the document in Javascript. You can’t create a document server-side and open it in Javascript without saving it. Just save without mandatory and validation, then follow the script I provided, or create in javascript.

Cool… If the script save without mandatory fields, the user will can access the document after and fill the fields?

Why don’t you try and find out?

Good ideia!
PY:

@frappe.whitelist()
def make_payment_entry():
    payment_entry = frappe.new_doc("Payment Entry")
    payment_entry.party_type = "Supplier"
    payment_entry.flags.ignore_mandatory = True
    payment_entry.save()
    return payment_entry.name

File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 282, in _raise_exception
    raise raise_exception(encode(msg))
ValidationError: Party is mandatory

It’s ignoring my ignore function…

try
payment_entry.flags.ignore_validate = True payment_entry.flags.ignore_permissions = True

as well

Created!!
But not routed, i’ll try every case of route that you passed me and feeback the result in soon…
By the way, thank you very much for expend your time helping me! @Ben_Cornwell_Mott

Regards.