From b96fef980238cb96b8760170e4b15dd9f2235f68 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Thu, 7 Mar 2013 15:35:36 +0530 Subject: [PATCH] remove cancelled entries from grid report when fetching data based on modified --- accounts/general_ledger.py | 8 +++++--- .../financial_analytics/financial_analytics.js | 8 +++++--- accounts/page/general_ledger/general_ledger.js | 2 +- .../page/purchase_analytics/purchase_analytics.js | 14 ++------------ selling/page/sales_analytics/sales_analytics.js | 12 +----------- 5 files changed, 14 insertions(+), 30 deletions(-) diff --git a/accounts/general_ledger.py b/accounts/general_ledger.py index 215c351421..8e0f4082bc 100644 --- a/accounts/general_ledger.py +++ b/accounts/general_ledger.py @@ -16,7 +16,7 @@ from __future__ import unicode_literals import webnotes -from webnotes.utils import flt, cstr +from webnotes.utils import flt, cstr, now from webnotes.model.doc import Document def make_gl_entries(gl_map, cancel=False, adv_adj=False, merge_entries=True, @@ -109,5 +109,7 @@ def validate_total_debit_credit(total_debit, total_credit): (total_debit - total_credit), raise_exception=1) def set_as_cancel(voucher_type, voucher_no): - webnotes.conn.sql("""update `tabGL Entry` set is_cancelled='Yes' - where voucher_type=%s and voucher_no=%s""", (voucher_type, voucher_no)) \ No newline at end of file + webnotes.conn.sql("""update `tabGL Entry` set is_cancelled='Yes', + modified=%s, modified_by=%s + where voucher_type=%s and voucher_no=%s""", + (now(), webnotes.session.user, voucher_type, voucher_no)) \ No newline at end of file diff --git a/accounts/page/financial_analytics/financial_analytics.js b/accounts/page/financial_analytics/financial_analytics.js index f0bafdb07b..f7145490a1 100644 --- a/accounts/page/financial_analytics/financial_analytics.js +++ b/accounts/page/financial_analytics/financial_analytics.js @@ -71,9 +71,11 @@ erpnext.FinancialAnalytics = erpnext.AccountTreeGrid.extend({ setup_filters: function() { var me = this; this._super(); - this.filter_inputs.pl_or_bs.change(function() { - me.filter_inputs.refresh.click(); - }).add_options($.map(wn.report_dump.data["Cost Center"], function(v) {return v.name;})); + this.trigger_refresh_on_change(["pl_or_bs"]); + + this.filter_inputs.pl_or_bs + .add_options($.map(wn.report_dump.data["Cost Center"], function(v) {return v.name;})); + this.setup_plot_check(); }, init_filter_values: function() { diff --git a/accounts/page/general_ledger/general_ledger.js b/accounts/page/general_ledger/general_ledger.js index 8f6b598d56..4a3f21ea92 100644 --- a/accounts/page/general_ledger/general_ledger.js +++ b/accounts/page/general_ledger/general_ledger.js @@ -108,7 +108,7 @@ erpnext.GeneralLedger = wn.views.GridReport.extend({ // filter accounts options by company this.filter_inputs.company.change(function() { me.setup_account_filter(this); - me.filter_inputs.refresh.click(); + me.set_route() }); this.filter_inputs.account.change(function() { diff --git a/buying/page/purchase_analytics/purchase_analytics.js b/buying/page/purchase_analytics/purchase_analytics.js index 7d8171ebbd..fc082eae13 100644 --- a/buying/page/purchase_analytics/purchase_analytics.js +++ b/buying/page/purchase_analytics/purchase_analytics.js @@ -120,19 +120,9 @@ erpnext.PurchaseAnalytics = wn.views.TreeGridReport.extend({ setup_filters: function() { var me = this; this._super(); - - this.filter_inputs.value_or_qty.change(function() { - me.filter_inputs.refresh.click(); - }); - - this.filter_inputs.tree_type.change(function() { - me.filter_inputs.refresh.click(); - }); - - this.filter_inputs.based_on.change(function() { - me.filter_inputs.refresh.click(); - }); + this.trigger_refresh_on_change(["value_or_qty", "tree_type", "based_on"]); + this.show_zero_check() this.setup_plot_check(); }, diff --git a/selling/page/sales_analytics/sales_analytics.js b/selling/page/sales_analytics/sales_analytics.js index 499c6c0156..0b35af5f31 100644 --- a/selling/page/sales_analytics/sales_analytics.js +++ b/selling/page/sales_analytics/sales_analytics.js @@ -122,18 +122,8 @@ erpnext.SalesAnalytics = wn.views.TreeGridReport.extend({ setup_filters: function() { var me = this; this._super(); - - this.filter_inputs.value_or_qty.change(function() { - me.filter_inputs.refresh.click(); - }); - - this.filter_inputs.tree_type.change(function() { - me.filter_inputs.refresh.click(); - }); - this.filter_inputs.based_on.change(function() { - me.filter_inputs.refresh.click(); - }); + this.trigger_refresh_on_change(["value_or_qty", "tree_type", "based_on"]); this.show_zero_check() this.setup_plot_check();