mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-07 23:31:20 +00:00
fix: correct project filter in buying doctypes (#54644)
(cherry picked from commit a04c028522)
Co-authored-by: Mihir Kandoi <kandoimihir@gmail.com>
This commit is contained in:
@@ -559,12 +559,6 @@ cur_frm.fields_dict["items"].grid.get_field("cost_center").get_query = function
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
cur_frm.fields_dict["items"].grid.get_field("project").get_query = function (doc, cdt, cdn) {
|
|
||||||
return {
|
|
||||||
filters: [["Project", "status", "not in", "Completed, Cancelled"]],
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
frappe.ui.form.on("Purchase Invoice", {
|
frappe.ui.form.on("Purchase Invoice", {
|
||||||
setup: function (frm) {
|
setup: function (frm) {
|
||||||
frm.custom_make_buttons = {
|
frm.custom_make_buttons = {
|
||||||
|
|||||||
@@ -748,12 +748,6 @@ cur_frm.cscript.update_status = function (label, status) {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
cur_frm.fields_dict["items"].grid.get_field("project").get_query = function (doc, cdt, cdn) {
|
|
||||||
return {
|
|
||||||
filters: [["Project", "status", "not in", "Completed, Cancelled"]],
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
if (cur_frm.doc.is_old_subcontracting_flow) {
|
if (cur_frm.doc.is_old_subcontracting_flow) {
|
||||||
cur_frm.fields_dict["items"].grid.get_field("bom").get_query = function (doc, cdt, cdn) {
|
cur_frm.fields_dict["items"].grid.get_field("bom").get_query = function (doc, cdt, cdn) {
|
||||||
var d = locals[cdt][cdn];
|
var d = locals[cdt][cdn];
|
||||||
|
|||||||
@@ -126,9 +126,3 @@ erpnext.buying.SupplierQuotationController = class SupplierQuotationController e
|
|||||||
|
|
||||||
// for backward compatibility: combine new and previous states
|
// for backward compatibility: combine new and previous states
|
||||||
extend_cscript(cur_frm.cscript, new erpnext.buying.SupplierQuotationController({ frm: cur_frm }));
|
extend_cscript(cur_frm.cscript, new erpnext.buying.SupplierQuotationController({ frm: cur_frm }));
|
||||||
|
|
||||||
cur_frm.fields_dict["items"].grid.get_field("project").get_query = function (doc, cdt, cdn) {
|
|
||||||
return {
|
|
||||||
filters: [["Project", "status", "not in", "Completed, Cancelled"]],
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|||||||
@@ -25,13 +25,15 @@ erpnext.buying = {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
this.frm.set_query("project", function (doc) {
|
const project_filters = {
|
||||||
return {
|
query: "erpnext.controllers.queries.get_project_name",
|
||||||
filters: {
|
filters: {
|
||||||
company: doc.company,
|
company: doc.company,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
});
|
|
||||||
|
this.frm.set_query("project", (_) => project_filters);
|
||||||
|
this.frm.set_query("project", "items", (_, __, ___) => project_filters);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
this.frm.doc.__islocal &&
|
this.frm.doc.__islocal &&
|
||||||
|
|||||||
Reference in New Issue
Block a user