refactor: set queries during setup
This commit is contained in:
parent
e77c379cbb
commit
1b16eb7667
@ -2,13 +2,31 @@
|
|||||||
// License: GNU General Public License v3. See license.txt
|
// License: GNU General Public License v3. See license.txt
|
||||||
|
|
||||||
frappe.ui.form.on("Warehouse", {
|
frappe.ui.form.on("Warehouse", {
|
||||||
onload: function (frm) {
|
setup: function (frm) {
|
||||||
frm.set_query("default_in_transit_warehouse", function () {
|
frm.set_query("default_in_transit_warehouse", function (doc) {
|
||||||
return {
|
return {
|
||||||
filters: {
|
filters: {
|
||||||
warehouse_type: "Transit",
|
warehouse_type: "Transit",
|
||||||
is_group: 0,
|
is_group: 0,
|
||||||
company: frm.doc.company,
|
company: doc.company,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
frm.set_query("parent_warehouse", function () {
|
||||||
|
return {
|
||||||
|
filters: {
|
||||||
|
is_group: 1,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
frm.set_query("account", function (doc) {
|
||||||
|
return {
|
||||||
|
filters: {
|
||||||
|
is_group: 0,
|
||||||
|
account_type: "Stock",
|
||||||
|
company: doc.company,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
@ -59,24 +77,6 @@ frappe.ui.form.on("Warehouse", {
|
|||||||
fieldname: "name",
|
fieldname: "name",
|
||||||
doctype: "Warehouse",
|
doctype: "Warehouse",
|
||||||
};
|
};
|
||||||
|
|
||||||
frm.fields_dict["parent_warehouse"].get_query = function (doc) {
|
|
||||||
return {
|
|
||||||
filters: {
|
|
||||||
is_group: 1,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
frm.fields_dict["account"].get_query = function (doc) {
|
|
||||||
return {
|
|
||||||
filters: {
|
|
||||||
is_group: 0,
|
|
||||||
account_type: "Stock",
|
|
||||||
company: doc.company,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
};
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user