Hi All,
Is there anyone was done adding custom field filter in GetItems button from Sales Invoice?
My scenario is, I have a custom field or_no from Sales Order and We want to add that field in Get Items’ button during Invoicing in Sales Invoice. What we want to achieve during Invoicing is getting Items from Sales Order using GetItems button, include a or_no field to the list and filter to get all Sales Orders have a or_no to include in Sales Invoice.
Thanks
Hi, finally added or_no column and filter Get Items button from Sales Invoice to this scripts
./apps/erpnext/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
sales_order_btn: function() {
var me = this;
this.$sales_order_btn = this.frm.add_custom_button(__('Sales Order'),
function() {
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,
},
get_query_filters: {
docstatus: 1,
status: ["not in", ["Closed", "On Hold"]],
per_billed: ["<", 99.99],
company: me.frm.doc.company
}
})
}, __("Get items from"));
},
sales_order_btn: function() {
var me = this;
this.$sales_order_btn = this.frm.add_custom_button(__('Sales Order'),
function() {
erpnext.utils.map_current_doc({
method: "erpnext.selling.doctype.sales_order.sales_order.make_sales_invoice",
source_doctype: "Sales Order",
target: me.frm,
setters: [{
fieldtype: 'Data',
label: __('OR No'),
fieldname: 'or_no',
}],
customer: me.frm.doc.customer || undefined,
get_query_filters: {
docstatus: 1,
status: ["not in", ["Closed", "On Hold"]],
per_billed: ["<", 99.99],
company: me.frm.doc.company
}
})
}, __("Get items from"));
},
but the Customer column is disappeared, is there anything wrong with this scripts
Before:
After:
Goal:
Is it possible to override exiting functionality in ./apps/erpnext/erpnext/accounts/doctype/sales_invoice/sales_invoice.js much better.
thanks
anyone can help on this, thanks
sales_order_btn: function() {
var me = this;
this.$sales_order_btn = this.frm.add_custom_button(__('Sales Order'),
function() {
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,
**or_no: me.frm.doc.or_no**
},
get_query_filters: {
docstatus: 1,
status: ["not in", ["Closed", "On Hold"]],
per_billed: ["<", 99.99],
company: me.frm.doc.company
}
})
}, __("Get items from"));
},