Add the custom field from Get Item From button

Is this possible to add my custom field under “Get Item From” button. please see attach image below.

Im searching in the forum but no luck to find this also tried Googling.

I’m using ERPNext V12.10.1

You can do that by using custom script.

  1. Add your custom field
  2. Copy Get Items From function from sales_invoice.js then modify it to add your custom field. Put it under Custom Script on_refresh

Thank you so much, but can you please elaborate what needs to be done? I am newbie in ERPNext? can you please give the step by step please



In what line I put my custom field
I found file in this path ./apps/erpnext/erpnext/accounts/doctype/sales_invoice/sales_invoice.js, is this the file where talking about?

is this the function?

    sales_order_btn: function() {
            var me = this;
            this.$sales_order_btn = this.frm.add_custom_button(__('Sales Order'),
                    function() {
                                    method: "erpnext.selling.doctype.sales_order.sales_order.make_sales_invoice",
                                    source_doctype: "Sales Order",
                                    target: me.frm,
                                    setters: {
                                            customer: me.frm.doc.customer || undefined,
                                    get_query_filters: {
                                            docstatus: 1,
                                            status: ["not in", ["Closed", "On Hold"]],
                                            per_billed: ["<", 99.99],
                    }, __("Get items from"));

Yes put your custom field in the setters

customer: me.frm.doc.customer || undefined,
referenceno: me.frm.doc.referenceno || undefined,

Put it under Custom Script on_refresh can you give sample to this?



Is there anyone point me the right direction?


any update here, is this problem is solved can you share the solution here