ERPNext Conference 2019* ERPNext.com Blog

Get Items From Purchase Orders selection popup

customization

#1

Hello, I want to add a new column ‘amount’ in purchase orders selection popup in Purchase Invoice. So, how can i do that…?
Do i need to modify the /frappe-bench/apps/frappe/frappe/public/js/frappe/form/multi_select_dialog.js?


#2

Currently not configurable.

Also, Don’t make changes in core.

One hack, add field required field as setter and value as undefined.

Eg

erpnext.utils.map_current_doc({
	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,
		**total: undefined**
	},
	get_query_filters: {
		docstatus: 1,
		status: ["!=", "Closed"],
		per_billed: ["<", 99.99],
		company: me.frm.doc.company
	}
})
}, __("Get items from"));

Note It just a hack, please create a git issue.


#3

When I’m trying similar functionality with Request for Quotation, this hack isn’t working. The below error is being thrown in the browser console.

TypeError: Cannot read property ‘df’ of undefined
at desk.min.js?ver=1522600299.0:4968
at Array.forEach ()
at Class.make (desk.min.js?ver=1522600299.0:4966)
at desk.min.js?ver=1522600299.0:4944
at Object.callback (desk.min.js?ver=1522600299.0:5477)
at Object.callback [as success_callback] (desk.min.js?ver=1522600299.0:1437)
at _ (desk.min.js?ver=1522600299.0:1461)
at Object. (desk.min.js?ver=1522600299.0:1562)
at i (jquery.min.js:2)
at Object.fireWith [as resolveWith] (jquery.min.js:2)

My Code:

Also, is it possible to get item_code from Material Request Item and display in the table?
i.e., I need to display Item Code in place of Company and Date(see below screenshot) (I understand Name field will be duplicate in this case which is not an issue for us)


#4

Hello,

Currently the order of results is based on Date field ascending. Is it possible to sort it in descending order so the newest entry is placed on top of the list ?

Thank you