From 3a4a7ddd0ede5dae94ed58a65a3ea10655fb277b Mon Sep 17 00:00:00 2001 From: "RGA(OpenERP)" <> Date: Mon, 20 Aug 2012 19:56:45 +0530 Subject: [PATCH] [IMP] nothing to reconcile button shuould remove partner from list and this partner should added back when new related move line created bzr revid: rgaopenerp-20120820142645-z0x2252s18wa0yt9 --- addons/account/account_move_reconciliation.py | 24 ++++++++++++++++++- .../src/js/account_move_reconciliation.js | 11 +++++---- 2 files changed, 29 insertions(+), 6 deletions(-) diff --git a/addons/account/account_move_reconciliation.py b/addons/account/account_move_reconciliation.py index eaf9d31f976..992c1f2a906 100644 --- a/addons/account/account_move_reconciliation.py +++ b/addons/account/account_move_reconciliation.py @@ -18,6 +18,9 @@ # along with this program. If not, see . # ############################################################################## +import time +from datetime import datetime + import tools from osv import fields,osv @@ -58,7 +61,26 @@ class account_move_reconciliation(osv.osv): res_all[id] = res return res_all - + def search(self, cr, uid, args, offset=0, limit=None, order=None, context=None, count=False): + obj_move_line = self.pool.get('account.move.line') + ids = super(account_move_reconciliation, self).search(cr, uid, args, offset, limit, order, context, count) + res_ids = [] + for id in ids: + last_reconciliation_date = self.browse(cr, uid, id, context=context).last_reconciliation_date + if not last_reconciliation_date: + res_ids.append(id) + else: + move_ids = obj_move_line.search(cr, uid, [('partner_id','=', id),('create_date','>', last_reconciliation_date)]) + if move_ids: + res_ids.append(id) + return res_ids + + def skip_partner(self, cr, uid, ids, context): + res_partner = self.pool.get('res.partner') + for partner in self.browse(cr, uid, ids, context=context): + res_partner.write(cr, uid, [partner.id] ,{'last_reconciliation_date':time.strftime("%Y-%m-%d %H:%M:%S")}) + + _columns = { 'partner_id':fields.many2one('res.partner', 'Partner'), 'last_reconciliation_date':fields.related('partner_id', 'last_reconciliation_date' ,type='datetime', relation='res.partner', string='Last Reconciliation'), diff --git a/addons/account/static/src/js/account_move_reconciliation.js b/addons/account/static/src/js/account_move_reconciliation.js index 765a48af13b..a061730cd90 100644 --- a/addons/account/static/src/js/account_move_reconciliation.js +++ b/addons/account/static/src/js/account_move_reconciliation.js @@ -74,11 +74,12 @@ instance.account.extend_form_view = instance.web.FormView.extend({ }, do_nothing_to_reconcile:function(){ - this.dataset.ids = _.without(this.dataset.ids, this.datarecord.id) - // viewmanager = this.getParent(); - // viewmanager.action.context.active_ids = viewmanager.dataset_form.ids; - if (!_.isEmpty(this.dataset.ids)) - this.on_pager_action('first'); + self = this + this.dataset.call(event.target.name, [[self.datarecord.id], self.dataset.context]).then(function() { + self.dataset.read_slice().done(function(){ + self.on_pager_action('first'); + }); + }) }, do_update_pager: function(hide_index) {