fix(Asset Repair): Move filters for cost_center, warehouse and project to setup

This commit is contained in:
GangaManoj 2021-06-24 22:25:45 +05:30
parent 289b449f2b
commit b44e4121da

View File

@ -2,6 +2,34 @@
// For license information, please see license.txt
frappe.ui.form.on('Asset Repair', {
setup: function(frm) {
frm.fields_dict.cost_center.get_query = function(doc) {
return {
filters: {
'is_group': 0,
'company': doc.company
}
};
};
frm.fields_dict.project.get_query = function(doc) {
return {
filters: {
'company': doc.company
}
};
};
frm.fields_dict.warehouse.get_query = function(doc) {
return {
filters: {
'is_group': 0,
'company': doc.company
}
};
};
},
refresh: function(frm) {
if (frm.doc.docstatus) {
frm.add_custom_button("View General Ledger", function() {
@ -40,30 +68,4 @@ frappe.ui.form.on('Asset Repair Consumed Item', {
var row = locals[cdt][cdn];
frappe.model.set_value(cdt, cdn, 'total_value', row.consumed_quantity * row.valuation_rate);
},
});
cur_frm.fields_dict.cost_center.get_query = function(doc) {
return {
filters: {
'is_group': 0,
'company': doc.company
}
};
};
cur_frm.fields_dict.project.get_query = function(doc) {
return {
filters: {
'company': doc.company
}
};
};
cur_frm.fields_dict.warehouse.get_query = function(doc) {
return {
filters: {
'is_group': 0,
'company': doc.company
}
};
};
});