From 1cd32fcfde0e4edcfc2b619ef372a4db088abb71 Mon Sep 17 00:00:00 2001 From: "RGA(OpenERP)" <> Date: Thu, 9 Aug 2012 12:20:42 +0530 Subject: [PATCH] [IMP] progress bar and reload formon destroy of reconcile wizard bzr revid: rgaopenerp-20120809065042-bl8tyauxovr07r2v --- addons/account/account_move_reconciliation.py | 16 +++++++--------- .../static/src/js/account_move_reconciliation.js | 10 ++++++---- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/addons/account/account_move_reconciliation.py b/addons/account/account_move_reconciliation.py index f885214ec65..eaf9d31f976 100644 --- a/addons/account/account_move_reconciliation.py +++ b/addons/account/account_move_reconciliation.py @@ -22,8 +22,6 @@ import tools from osv import fields,osv -#1. Remove field from res.partner - #4 remove get_unreconcile_entry method mange it with domain class account_move_line(osv.osv): @@ -50,11 +48,11 @@ class account_move_reconciliation(osv.osv): res = 0 if active_ids: total_records = self.search(cr, uid, [('id','in',active_ids)]) - total_reconcile = 0 - for record in self.read(cr, uid, total_records, ['reconcile_count'], context=context): - if record['reconcile_count'] > 0: - total_reconcile += 1 - res = float(total_reconcile)/len(total_records) * 100 + total_unreconcile = 0 + for record in self.read(cr, uid, total_records, ['unreconcile_count'], context=context): + if record['unreconcile_count'] > 0: + total_unreconcile += 1 + res = float(len(total_records) - total_unreconcile)/len(total_records) * 100 res_all = {} for id in ids: res_all[id] = res @@ -66,7 +64,7 @@ class account_move_reconciliation(osv.osv): 'last_reconciliation_date':fields.related('partner_id', 'last_reconciliation_date' ,type='datetime', relation='res.partner', string='Last Reconciliation'), 'latest_date' :fields.date('Latest Entry'), 'reconciliation_progress': fields.function(_rec_progress, string='Progress (%)', type='float'), - 'reconcile_count':fields.integer('Reconcile Count'), + 'unreconcile_count':fields.integer('Unreconcile Count'), } def init(self, cr): tools.drop_view_if_exists(cr, 'account_move_reconciliation') @@ -74,7 +72,7 @@ class account_move_reconciliation(osv.osv): CREATE or REPLACE VIEW account_move_reconciliation as ( SELECT move_line.partner_id as id, move_line.partner_id, MAX(move_line.date) as latest_date, - (select count(reconcile.id) from account_move_line as reconcile where reconcile.reconcile_id is not null and reconcile.partner_id = move_line.partner_id) as reconcile_count + (select count(unreconcile.id) from account_move_line as unreconcile where unreconcile.reconcile_id is null and unreconcile.partner_id = move_line.partner_id) as unreconcile_count FROM account_move_line as move_line where move_line.state <> 'draft' GROUP by move_line.partner_id ) diff --git a/addons/account/static/src/js/account_move_reconciliation.js b/addons/account/static/src/js/account_move_reconciliation.js index 03a41fef8a3..765a48af13b 100644 --- a/addons/account/static/src/js/account_move_reconciliation.js +++ b/addons/account/static/src/js/account_move_reconciliation.js @@ -68,15 +68,17 @@ instance.account.extend_form_view = instance.web.FormView.extend({ self.do_action(result.result, function () { // reload view list_view.reload(); + self.reload(); }); }); }, - do_nothing_to_reconcile:function(event){ - viewmanager = this.getParent(); + do_nothing_to_reconcile:function(){ this.dataset.ids = _.without(this.dataset.ids, this.datarecord.id) - viewmanager.action.context.active_ids = viewmanager.dataset_form.ids; - this.on_pager_action(); + // viewmanager = this.getParent(); + // viewmanager.action.context.active_ids = viewmanager.dataset_form.ids; + if (!_.isEmpty(this.dataset.ids)) + this.on_pager_action('first'); }, do_update_pager: function(hide_index) {