When I visit http://host/app/xxx/new?args, what does Frappe do specifically?

Hello everyone!!
I want Python to manage new form data based on args from url.
Currently, I’m using frappe.call in JavaScript to send a request to Python, which returns the data. However, when I use frm.set_value in JavaScript to set the fields, it triggers field events that I don’t want.
So is there a way for Python to set the fields and have the web side just display the form?

Best Regards

I found function call order, still not find where to add default field value. anyone help me??
d:\frappe\frappe-bench\apps\frappe\frappe\app.py.application
("GET", "HEAD", "POST"):

  1. d:\frappe\frappe-bench\apps\frappe\frappe\website\serve.py.get_response
  2. d:\frappe\frappe-bench\apps\frappe\frappe\website\path_resolver.py.resolve
  3. d:\frappe\frappe-bench\apps\frappe\frappe\website\page_renderers\not_found_page.py
  4. d:\frappe\frappe-bench\apps\frappe\frappe\website\page_renderers\template_page.py.get_html

and then puzzled. :smirk:

I’m trying to create a new Stock Entry in ERPNext using a URL. Specifically, I want to pre-fill the item codes in the child table. However, the following URL format is not working:

http://host/app/stock-entry/new?stock_entry_type=Material%20Transfer&items=[{"item_code":"xxx"}]

I intend to specify the item codes in the items array, but it seems to be ineffective. Could someone please advise on the correct format or method to achieve this?

Any help would be greatly appreciated!

Thanks in advance

Hi there,

I’m not really sure what you’re trying to do. If you want to create new documents, wouldn’t the REST API work better?

https://docs.frappe.io/framework/user/en/api/rest

Thanks for your reply!
I want to create a hyperlink that, when clicked, opens a URL and automatically fills in some values. This operation is not related to the database and will not affect it in any way

Fills in some values where (list filters, new form entry fields, etc)?

http://host/app/stock-entry/new?stock_entry_type=Material%20Transfer
can auto fill stock_entry_type = “Material Transfer”, auto fill child table is not supported yet!
Thanks to all.