mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-25 16:04:46 +00:00
fix: set default filters on unchecking box, code cleanup
This commit is contained in:
@@ -3,24 +3,23 @@
|
|||||||
|
|
||||||
frappe.ui.form.on("Address", {
|
frappe.ui.form.on("Address", {
|
||||||
is_your_company_address: function(frm) {
|
is_your_company_address: function(frm) {
|
||||||
if(frm.doc.is_your_company_address){
|
frm.clear_table('links');
|
||||||
|
if(frm.doc.is_your_company_address) {
|
||||||
frm.add_child('links', {
|
frm.add_child('links', {
|
||||||
link_doctype: 'Company',
|
link_doctype: 'Company',
|
||||||
link_name: frappe.defaults.get_user_default('Company')
|
link_name: frappe.defaults.get_user_default('Company')
|
||||||
});
|
});
|
||||||
frm.fields_dict.links.grid.get_field('link_doctype').get_query = function() {
|
frm.set_query('link_doctype', 'links', () => {
|
||||||
return {
|
return {
|
||||||
filters: {
|
filters: {
|
||||||
name: 'Company'
|
name: 'Company'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
});
|
||||||
frm.refresh_field('links');
|
frm.refresh_field('links');
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
frm.fields_dict.links.grid.get_field('link_doctype').get_query = null;
|
frm.trigger('refresh');
|
||||||
frm.clear_table('links');
|
|
||||||
}
|
}
|
||||||
frm.refresh_field('links');
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user