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 267fed2d23
commit c8caafa680

View File

@ -2,6 +2,34 @@
// For license information, please see license.txt // For license information, please see license.txt
frappe.ui.form.on('Asset Repair', { 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) { refresh: function(frm) {
if (frm.doc.docstatus) { if (frm.doc.docstatus) {
frm.add_custom_button("View General Ledger", function() { frm.add_custom_button("View General Ledger", function() {
@ -41,29 +69,3 @@ frappe.ui.form.on('Asset Repair Consumed Item', {
frappe.model.set_value(cdt, cdn, 'total_value', row.consumed_quantity * row.valuation_rate); 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
}
};
};