convert select to chosen, if specified in filters

This commit is contained in:
Anand Doshi
2012-11-22 16:53:04 +05:30
parent d7f1bcbde6
commit 293e0124cd
2 changed files with 6 additions and 3 deletions

View File

@@ -69,7 +69,8 @@ erpnext.GeneralLedger = wn.views.GridReport.extend({
filter: function(val, item, opts) { filter: function(val, item, opts) {
return item.company == val || val == opts.default_value; return item.company == val || val == opts.default_value;
}}, }},
{fieldtype:"Select", label: "Account", link:"Account", default_value: "Select Account...", {fieldtype:"Select", label: "Account", link:"Account",
default_value: "Select Account...", chosen: true,
filter: function(val, item, opts, me) { filter: function(val, item, opts, me) {
if(val == opts.default_value) { if(val == opts.default_value) {
return true; return true;
@@ -120,7 +121,9 @@ erpnext.GeneralLedger = wn.views.GridReport.extend({
} }
// chosen // chosen
$filter.trigger("liszt:updated"); if(me.filter_inputs.company.get(0).opts.chosen) {
$filter.trigger("liszt:updated");
}
me.filter_inputs.refresh.click(); me.filter_inputs.refresh.click();
}); });

View File

@@ -32,7 +32,7 @@ erpnext.PurchaseAnalytics = wn.views.TreeGridReport.extend({
parent: $(wrapper).find('.layout-main'), parent: $(wrapper).find('.layout-main'),
appframe: wrapper.appframe, appframe: wrapper.appframe,
doctypes: ["Item", "Item Group", "Supplier", "Supplier Type", "Company", doctypes: ["Item", "Item Group", "Supplier", "Supplier Type", "Company",
"Purchase Invoice", "Purchase Invoice Item"], "Purchase Invoice", "Purchase Invoice Item", "Fiscal Year"],
tree_grid: { show: true } tree_grid: { show: true }
}); });