i have tried to code but fails:
frappe.ui.form.on("Purchase Order", {
refresh: function(frm) {
frm.add_custom_button(__('Sales Order'), function() {
erpnext.utils.map_current_doc({
method: "erpnext.selling.doctype.sales_order.sales_order.make_purchase_order_for_drop_shipment",
source_doctype: "Sales Order",
target: frm,
for_supplier: frm.doc.supplier,
setters: {
customer: frm.doc.customer || undefined,
},
get_query_filters: {
docstatus: 1,
status: ["!=", "Closed"],
per_billed: ["<", 99.99],
company: frm.doc.company
}
})
}, __('Get items from'));
},
})
i got error
Traceback (most recent call last):
File “/home/frappe/frappe-bench/apps/frappe/frappe/app.py”, line 62, in application
response = frappe.handler.handle()
File “/home/frappe/frappe-bench/apps/frappe/frappe/handler.py”, line 22, in handle
data = execute_cmd(cmd)
File “/home/frappe/frappe-bench/apps/frappe/frappe/handler.py”, line 53, in execute_cmd
return frappe.call(method, **frappe.form_dict)
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 939, in call
return fn(*args, **newargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/mapper.py”, line 38, in map_docs
target_doc = method(src, target_doc)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/selling/doctype/sales_order/sales_order.py”, line 744, in make_purchase_order_for_drop_shipment
}, target_doc, set_missing_values)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/mapper.py”, line 110, in get_mapped_doc
postprocess(source_doc, target_doc)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/selling/doctype/sales_order/sales_order.py”, line 704, in set_missing_values
target.run_method(“set_missing_values”)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 755, in run_method
out = Document.hook(fn)(self, *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 1024, in composer
return composed(self, method, *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 1007, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 749, in
fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/controllers/buying_controller.py”, line 67, in set_missing_values
self.update_if_missing(get_party_details(self.supplier, party_type=“Supplier”, ignore_permissions=self.flags.ignore_permissions, doctype=self.doctype, company=self.company))
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/accounts/party.py”, line 31, in get_party_details
frappe.throw(_(“{0}: {1} does not exists”).format(party_type, party))
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 323, in throw
msgprint(msg, raise_exception=exc, title=title, indicator=‘red’)
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 309, in msgprint
_raise_exception()
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 282, in _raise_exception
raise raise_exception(encode(msg))