Now we added a custom button in sales order which will create anew 'job order" and copy some fields from sales order into our new 'job order' we wrote this custom script to copy fields but couldn't copy items from sales order into 'job order item' how to work around that?
frappe.ui.form.on('Sales Order', {
refresh: function(frm) {
if (frm.doc.docstatus==1) {
if(cur_frm.has_perm("submit")) {
frm.add_custom_button(__('Job Order'), function() {
frappe.route_options = {
customer: cur_frm.doc.customer,
sales_order: cur_frm.doc.name,
'customer_address':frm.doc.customer_address,
'contact_mobile':frm.doc.contact_mobile,
'contact_person':frm.doc.contact_person,
job_order_item:frm.doc.items
};
frappe.set_route('Form', 'Job Order', 'New Job Order');
}, __('Create'));
// }
}}}})