Error while send additional parameter to open_mapped_doc

While using frappe.model.open_mapped_doc() it just takes only object with two parameters :

			frappe.model.open_mapped_doc({
				method: ,
				frm: ,
			}) 

I am trying to add a third parameter but python always throw an error

missing 1 required positional

Here is my code in Java Script file

function fun(frm){
	let selected = frm.get_selected()
	frappe.model.open_mapped_doc({
		method: 'my_func_path_in_python_file',
		frm: frm,
		my_third_paramter: selected
	})
}

Here is my code in Python File

@frappe.whitelist()
def my_fun(source_name,my_third_paramter):
	def update_item(source, target, source_parent):
		target.field = selected_row

	doclist = get_mapped_doc("Customer",source_name, {
		"Customer": {
			"doctype": "Maintenance Work Order",
			"field_map": {
			}
		},"postprocess": update_item
	})
	return doclist

So Any Help Please !!!

Did you find the solution for this??

@AlinYellow @ibalajib

You should use function like this.

JS Side

frappe.model.open_mapped_doc({
			method: "path to your method,
			frm: frm,
			args: {
				doctype: 'Customer',
				customer: frm.doc.name
			}
		});

Py side

@frappe.whitelist()
def function_name(source_name, target_doc=None):
	doctype = frappe.flags.args.doctype
	customer = frappe.flags.args.customer

Try this solution

2 Likes

Thank you so much! @Hardik_Gadesha

This saved me a lot of time. :))

@ibalajib it will be good if you can mark it as solution, it will save others time too

1 Like

FYI @Hardik_Gadesha , Iā€™m not the one who raised a question so I could not mark this answer as a solution.