Hello! I made a custom script to fetch Sales Partner from Territory.
Here is the script:
cur_frm.add_fetch(‘territory’,‘default_sales_partner’,‘default_sales_partner’)
The problem is that I want the script to perform like when I select the sales partner manually from the list, so that also the sales commission is fetched.
Any suggestion on what I should add?
Thank you!
@somicoito
you can get required value on fields trigger using frappe.client.get_value
or frappe.call
and simply set the result to the field.
e.g. frm.set_value(“fieldname”, field_value);
Check this,
if(doc.docstatus===0) {
this.frm.add_custom_button(__('Purchase Order'), function() {
erpnext.utils.map_current_doc({
method: "erpnext.buying.doctype.purchase_order.purchase_order.make_purchase_invoice",
source_doctype: "Purchase Order",
target: me.frm,
setters: {
supplier: me.frm.doc.supplier || undefined,
schedule_date: undefined
},
get_query_filters: {
docstatus: 1,
status: ["not in", ["Closed", "On Hold"]],
per_billed: ["<", 99.99],
company: me.frm.doc.company
}
})
}, __("Get Items From"));
Thank you @Sangram for your help.
Can you please tell me in my case how this should be?
I am not a super expert…