mirror of
https://github.com/frappe/erpnext.git
synced 2026-03-21 16:02:15 +00:00
fix: not able to update default supplier from Supplier Quotation Comparison report
(cherry picked from commit ad8e189c26)
This commit is contained in:
committed by
Mergify
parent
77a764e5bd
commit
80891daaed
@@ -133,6 +133,13 @@ frappe.query_reports["Supplier Quotation Comparison"] = {
|
|||||||
return row.supplier_name;
|
return row.supplier_name;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
let items = [];
|
||||||
|
report.data.forEach((d) => {
|
||||||
|
if (!items.includes(d.item_code)) {
|
||||||
|
items.push(d.item_code);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// Create a dialog window for the user to pick their supplier
|
// Create a dialog window for the user to pick their supplier
|
||||||
let dialog = new frappe.ui.Dialog({
|
let dialog = new frappe.ui.Dialog({
|
||||||
title: __("Select Default Supplier"),
|
title: __("Select Default Supplier"),
|
||||||
@@ -151,20 +158,34 @@ frappe.query_reports["Supplier Quotation Comparison"] = {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
reqd: 1,
|
||||||
|
label: "Item",
|
||||||
|
fieldtype: "Link",
|
||||||
|
options: "Item",
|
||||||
|
fieldname: "item_code",
|
||||||
|
get_query: () => {
|
||||||
|
return {
|
||||||
|
filters: {
|
||||||
|
name: ["in", items],
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
},
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
dialog.set_primary_action(__("Set Default Supplier"), () => {
|
dialog.set_primary_action(__("Set Default Supplier"), () => {
|
||||||
let values = dialog.get_values();
|
let values = dialog.get_values();
|
||||||
|
|
||||||
if (values) {
|
if (values) {
|
||||||
// Set the default_supplier field of the appropriate Item to the selected supplier
|
// Set the default_supplier field of the appropriate Item to the selected supplier
|
||||||
frappe.call({
|
frappe.call({
|
||||||
method: "frappe.client.set_value",
|
method: "erpnext.buying.report.supplier_quotation_comparison.supplier_quotation_comparison.set_default_supplier",
|
||||||
args: {
|
args: {
|
||||||
doctype: "Item",
|
item_code: values.item_code,
|
||||||
name: item_code,
|
supplier: values.supplier,
|
||||||
fieldname: "default_supplier",
|
company: filters.company,
|
||||||
value: values.supplier,
|
|
||||||
},
|
},
|
||||||
freeze: true,
|
freeze: true,
|
||||||
callback: (r) => {
|
callback: (r) => {
|
||||||
|
|||||||
@@ -292,3 +292,13 @@ def get_message():
|
|||||||
<span class="indicator red">
|
<span class="indicator red">
|
||||||
Expires today / Already Expired
|
Expires today / Already Expired
|
||||||
</span>"""
|
</span>"""
|
||||||
|
|
||||||
|
|
||||||
|
@frappe.whitelist()
|
||||||
|
def set_default_supplier(item_code, supplier, company):
|
||||||
|
frappe.db.set_value(
|
||||||
|
"Item Default",
|
||||||
|
{"parent": item_code, "company": company},
|
||||||
|
"default_supplier",
|
||||||
|
supplier,
|
||||||
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user