Calling another Doctype

I am trying to call the doctype stockentry after clicking a button but i am getting errors can any one hepl me out below is my code…
the js file

the py file

Where did you write the get_doctype function? If its inside the Class, then you need to pass docs: in method. And if you written outside the class, then you should pass the value of stock_entry in args and the server side function should be whitelisted.

I did it nothing is happening the screen is hanging

It will looks like below:{
	method: path-to-function,
	args: {
		stock_entry_id: frm.doc.stock_entry
	callback: function(r) {

def get_doctype(stock_entry_id):
	data = frappe.get_doc("Stock Entry", stock_entry_id)
	return data.as_dict()

but i want to create a new one will it creates a new stock entry

Ok, if you want to create a new entry, then you don’t need to pass anything. But in the server side function, you should use frappe.new_doc('Stock Entry')

1 Like

Well although it’s not giving an error it sin’t opening a new stock entry doctype
Did i have to write anything in the call back function

If you want to create a new doctype on client side, just use frappe.new_doc('Stock Entry') in your js file, no need to call a server side function.

thanks it worked ,a little help how can i enter the detials in to that stock entry items table automatically that i am having in the current doctype child tables items …

Can u suggest me anything in the next post

What you are trying to achieve is similar to the “Transfer Material” functionality in Material Request. Please check related code here.