fix: Fixed setters for getting items from quotation/opportunity
This commit is contained in:
@@ -90,22 +90,29 @@ erpnext.selling.QuotationController = erpnext.selling.SellingController.extend({
|
|||||||
if (this.frm.doc.docstatus===0) {
|
if (this.frm.doc.docstatus===0) {
|
||||||
this.frm.add_custom_button(__('Opportunity'),
|
this.frm.add_custom_button(__('Opportunity'),
|
||||||
function() {
|
function() {
|
||||||
var setters = {};
|
|
||||||
if(me.frm.doc.quotation_to == "Customer" && me.frm.doc.party_name) {
|
|
||||||
setters.customer = me.frm.doc.party_name || undefined;
|
|
||||||
} else if (me.frm.doc.quotation_to == "Lead" && me.frm.doc.party_name) {
|
|
||||||
setters.lead = me.frm.doc.party_name || undefined;
|
|
||||||
}
|
|
||||||
erpnext.utils.map_current_doc({
|
erpnext.utils.map_current_doc({
|
||||||
method: "erpnext.crm.doctype.opportunity.opportunity.make_quotation",
|
method: "erpnext.crm.doctype.opportunity.opportunity.make_quotation",
|
||||||
source_doctype: "Opportunity",
|
source_doctype: "Opportunity",
|
||||||
target: me.frm,
|
target: me.frm,
|
||||||
setters: setters,
|
setters: [
|
||||||
|
{
|
||||||
|
label: "Party",
|
||||||
|
fieldname: "party_name",
|
||||||
|
fieldtype: "Link",
|
||||||
|
options: me.frm.doc.quotation_to,
|
||||||
|
default: me.frm.doc.party_name || undefined
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Opportunity Type",
|
||||||
|
fieldname: "opportunity_type",
|
||||||
|
fieldtype: "Link",
|
||||||
|
options: "Opportunity Type",
|
||||||
|
default: me.frm.doc.order_type || undefined
|
||||||
|
}
|
||||||
|
],
|
||||||
get_query_filters: {
|
get_query_filters: {
|
||||||
status: ["not in", ["Lost", "Closed"]],
|
status: ["not in", ["Lost", "Closed"]],
|
||||||
company: me.frm.doc.company,
|
company: me.frm.doc.company
|
||||||
// cannot set opportunity_type as setter, as the fieldname is order_type
|
|
||||||
opportunity_type: me.frm.doc.order_type,
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}, __("Get items from"), "btn-default");
|
}, __("Get items from"), "btn-default");
|
||||||
|
|||||||
@@ -219,13 +219,19 @@ erpnext.selling.SalesOrderController = erpnext.selling.SellingController.extend(
|
|||||||
method: "erpnext.selling.doctype.quotation.quotation.make_sales_order",
|
method: "erpnext.selling.doctype.quotation.quotation.make_sales_order",
|
||||||
source_doctype: "Quotation",
|
source_doctype: "Quotation",
|
||||||
target: me.frm,
|
target: me.frm,
|
||||||
setters: {
|
setters: [
|
||||||
customer: me.frm.doc.customer || undefined
|
{
|
||||||
},
|
label: "Customer",
|
||||||
|
fieldname: "party_name",
|
||||||
|
fieldtype: "Link",
|
||||||
|
options: "Customer",
|
||||||
|
default: me.frm.doc.customer || undefined
|
||||||
|
}
|
||||||
|
],
|
||||||
get_query_filters: {
|
get_query_filters: {
|
||||||
company: me.frm.doc.company,
|
company: me.frm.doc.company,
|
||||||
docstatus: 1,
|
docstatus: 1,
|
||||||
status: ["!=", "Lost"],
|
status: ["!=", "Lost"]
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}, __("Get items from"));
|
}, __("Get items from"));
|
||||||
|
|||||||
Reference in New Issue
Block a user