From 6461c5e31f18fd1fa7352b95cb7bbf46567a94c8 Mon Sep 17 00:00:00 2001 From: "Harry (OpenERP)" Date: Thu, 30 Aug 2012 18:56:29 +0530 Subject: [PATCH] [FIX] account: rector js of account reconcilation bzr revid: hmo@tinyerp.com-20120830132629-72mnqvtwespvik0b --- .../src/js/account_move_reconciliation.js | 41 +++++++++---------- 1 file changed, 19 insertions(+), 22 deletions(-) diff --git a/addons/account/static/src/js/account_move_reconciliation.js b/addons/account/static/src/js/account_move_reconciliation.js index 9b5aacf28bf..8196779fa1d 100644 --- a/addons/account/static/src/js/account_move_reconciliation.js +++ b/addons/account/static/src/js/account_move_reconciliation.js @@ -18,7 +18,7 @@ instance.account.extend_viewmanager = instance.web.ViewManagerAction.include({ obj_from_view.template = 'ExtendedFormView'; view_form = obj_from_view.appendTo(self.$el.find('.oe_extended_form_view')); $.when(view_form, this.dataset_loaded).then(function() { - obj_from_view.post_action(); + obj_from_view.on_pager_action('first'); }); } @@ -56,32 +56,20 @@ instance.account.extend_form_view = instance.web.FormView.extend({ result.result.flags = result.result.flags || {}; result.result.flags.new_window = true; self.do_action(result.result, function () { - self.post_action(); + self.dataset.read_slice().done(function(){ + self.on_pager_action('next'); + }); }); }); }, - post_action: function(){ - // hide if not records otherwise go next record - var self = this; - var viewmanager = this.getParent(); - this.dataset.read_slice().done(function(){ - if (_.isEmpty(self.dataset.ids)){ - viewmanager.action.context.next_partner_only = true; - /*self.$el.hide(); - viewmanager.action.context.next_partner_only = false; - viewmanager.searchview.do_search();*/ - } - else{ - self.on_pager_action('first'); - } - }); - }, - + do_nothing_to_reconcile:function(){ var self = this; this.dataset.call(event.target.name, [[self.datarecord.id], self.dataset.context]).then(function() { - self.post_action(); + self.dataset.read_slice().done(function(){ + self.on_pager_action('next'); + }); }); }, @@ -97,12 +85,21 @@ instance.account.extend_form_view = instance.web.FormView.extend({ on_pager_action: function(action) { var self = this var viewmanager = self.getParent(); + viewmanager.action.context.next_partner_only = true; + //TODO: if no records, than it's not working, it giving error + if (this.dataset.ids.length == 0){ + self.dataset.index = null; + viewmanager.action.context.partner_id = []; + viewmanager.searchview.do_search(); + self.reload(); + return + } + $.when(this._super(action)).then(function() { var id = self.get_fields_values().partner_id; - viewmanager.action.context.next_partner_only = true; viewmanager.action.context.partner_id = [id]; viewmanager.searchview.do_search(); - }) + }); }, })