From 87fbc31538b4ea1cc7593ecca5f54afb7a86fa54 Mon Sep 17 00:00:00 2001 From: "@" <@> Date: Wed, 19 Dec 2012 16:40:41 +0100 Subject: [PATCH] [ADD] account_easy_reconcile: jump buttons to display the move lines and display the count of move lines --- account_easy_reconcile/easy_reconcile.py | 39 +++++++++---- account_easy_reconcile/easy_reconcile.xml | 28 +++++++++- .../easy_reconcile_history.py | 55 +++++++++++++++---- .../easy_reconcile_history_view.xml | 12 +++- 4 files changed, 107 insertions(+), 27 deletions(-) diff --git a/account_easy_reconcile/easy_reconcile.py b/account_easy_reconcile/easy_reconcile.py index 53b7cf42..979a187d 100644 --- a/account_easy_reconcile/easy_reconcile.py +++ b/account_easy_reconcile/easy_reconcile.py @@ -206,7 +206,7 @@ class account_easy_reconcile(Model): partial_ids = find_reconcile_ids( 'reconcile_partial_id', all_ml_partial_ids) - history_id = self.pool.get('easy.reconcile.history').create( + self.pool.get('easy.reconcile.history').create( cr, uid, {'easy_reconcile_id': rec.id, @@ -214,15 +214,30 @@ class account_easy_reconcile(Model): 'reconcile_ids': [(4, rid) for rid in reconcile_ids], 'reconcile_partial_ids': [(4, rid) for rid in partial_ids]}, context=context) + return True - return { - 'name':_("Reconciliations"), - 'view_mode': 'tree,form', # FIXME: In OpenERP 6.1 we can't display - 'view_id': False, # only the form, check in version 7.0 - 'view_type': 'form', - 'res_model': 'easy.reconcile.history', - 'type': 'ir.actions.act_window', - 'nodestroy': True, - 'target': 'current', - 'domain': unicode([('id', '=', history_id)]), - } + def last_history_reconcile(self, cr, uid, rec_id, context=None): + """ Get the last history record for this reconciliation profile + and return the action which opens move lines reconciled + """ + if isinstance(rec_id, (tuple, list)): + assert len(rec_id) == 1, \ + "Only 1 id expected" + rec_id = rec_id[0] + rec = self.browse(cr, uid, rec_id, context=context) + # the history is ordered by date desc + last_history = rec.history_ids[0] + return last_history.open_reconcile() + + def last_history_partial(self, cr, uid, rec_id, context=None): + """ Get the last history record for this reconciliation profile + and return the action which opens move lines reconciled + """ + if isinstance(rec_id, (tuple, list)): + assert len(rec_id) == 1, \ + "Only 1 id expected" + rec_id = rec_id[0] + rec = self.browse(cr, uid, rec_id, context=context) + # the history is ordered by date desc + last_history = rec.history_ids[0] + return last_history.open_partial() diff --git a/account_easy_reconcile/easy_reconcile.xml b/account_easy_reconcile/easy_reconcile.xml index 6c3bc820..7f7f8334 100644 --- a/account_easy_reconcile/easy_reconcile.xml +++ b/account_easy_reconcile/easy_reconcile.xml @@ -20,9 +20,28 @@ +