ERPNext Conference 2019* ERPNext.com Blog

Attach Documents to RFQ from Item Master


#1

Hello All,
I want to fetch attachments from Item master to RFQ, came across this Custom Script https://github.com/frappe/erpnext/wiki/Community-Developed-Custom-Scripts#attachment-transfer

It is not working for me. Has anyone used it? Would like to know how to use it


#2

What is the problem you are getting when you use it?


#3

@aakvatech
i am have same issue. i wanted to attach file from item into quotation . using following script

frappe.ui.form.on("Quotation",{
refresh: function(frm) {
frm.add_custom_button(__("Load Attachments"), function(foo) {

frappe.call({
	method:"my_app.my_app.controller.attach_all_docs",
	args: {
		document: cur_frm.doc,
		
	}, 
	callback: function(r) { 
		frm.reload_doc();
              

	}
});
});
}

});

it is giving me error as bellow after clicking on button


#4

my_app.my_app.controller.attach_all_docs

This expects you to have your own app and it’s controller. Do you have that in place? It needs custom app and a python file within to be existing.


#5

You need to press F12 in chrome to see the exact error on the right.


#6

Yup, I realised, need to have a custom app in place before running the Client-side Custom Script
Thanks


#7

@Manan_Shah
thank you
is it working for you?
can you please explain in steps and why the custom app needed for this?


#8

I have not implemented this yet.
But the reason a custom app is required is, we need to define the method mentioned here in the custom script

The JS Custom Script on its own is no good because the method needs to be defined on Server Side.

Will comeback with detailed steps, once we implement this


#9

@Manan_Shah
thank you
i am also trying to solve it. i will be trying it on server side in custom app.
please keep everyone posted. so that we can achieve this