diff --git a/account_easy_reconcile/easy_reconcile.xml b/account_easy_reconcile/easy_reconcile.xml
index 4bf049a9..6c3bc820 100644
--- a/account_easy_reconcile/easy_reconcile.xml
+++ b/account_easy_reconcile/easy_reconcile.xml
@@ -35,7 +35,8 @@ The lines should have the same amount (with the write-off) and the same partner
-
+
@@ -52,6 +53,8 @@ The lines should have the same amount (with the write-off) and the same partner
+
diff --git a/account_easy_reconcile/easy_reconcile_history.py b/account_easy_reconcile/easy_reconcile_history.py
index 251745fa..7dbbdf30 100644
--- a/account_easy_reconcile/easy_reconcile_history.py
+++ b/account_easy_reconcile/easy_reconcile_history.py
@@ -20,6 +20,7 @@
##############################################################################
from openerp.osv import orm, fields
+from openerp.tools.translate import _
class easy_reconcile_history(orm.Model):
@@ -43,3 +44,70 @@ class easy_reconcile_history(orm.Model):
'account_move_reconcile_history_partial_rel',
string='Partial Reconciliations', readonly=True),
}
+
+ def _open_move_lines(self, cr, uid, history_id, rec_type='full', context=None):
+ """ For an history record, open the view of move line with
+ the reconciled or partially reconciled move lines
+
+ :param history_id: id of the history
+ :param rec_type: 'full' or 'partial'
+ :return: action to open the move lines
+ """
+ assert rec_type in ('full', 'partial'), \
+ "rec_type must be 'full' or 'partial'"
+
+ history = self.browse(cr, uid, history_id, context=context)
+
+ if rec_type == 'full':
+ field = 'reconcile_ids'
+ rec_field = 'line_id'
+ name = _('Reconciliations')
+ else:
+ field = 'reconcile_partial_ids'
+ rec_field = 'line_partial_ids'
+ name = _('Partial Reconciliations')
+
+ move_line_ids = []
+ for reconcile in getattr(history, field):
+ move_line_ids.extend(
+ [line.id for line
+ in getattr(reconcile, rec_field)])
+ return {
+ 'name': name,
+ 'view_mode': 'tree,form',
+ 'view_id': False,
+ 'view_type': 'form',
+ 'res_model': 'account.move.line',
+ 'type': 'ir.actions.act_window',
+ 'nodestroy': True,
+ 'target': 'current',
+ 'domain': unicode([('id', '=', move_line_ids)]),
+ }
+
+ def open_reconcile(self, cr, uid, history_ids, context=None):
+ """ For an history record, open the view of move line
+ with the reconciled move lines
+
+ :param history_ids: id of the record as int or long
+ Accept a list with 1 id too to be
+ used from the client.
+ """
+ if isinstance(history_ids, (tuple, list)):
+ assert len(history_ids) == 1, "only 1 ID is accepted"
+ history_ids = history_ids[0]
+ return self._open_move_lines(
+ cr, uid, history_ids, rec_type='full', context=None)
+
+ def open_partial(self, cr, uid, history_ids, context=None):
+ """ For an history record, open the view of move line
+ with the partially reconciled move lines
+
+ :param history_ids: id of the record as int or long
+ Accept a list with 1 id too to be
+ used from the client.
+ """
+ if isinstance(history_ids, (tuple, list)):
+ assert len(history_ids) == 1, "only 1 ID is accepted"
+ history_ids = history_ids[0]
+ return self._open_move_lines(
+ cr, uid, history_ids, rec_type='partial', context=None)
diff --git a/account_easy_reconcile/easy_reconcile_history_view.xml b/account_easy_reconcile/easy_reconcile_history_view.xml
index be1a2b57..a15765f0 100644
--- a/account_easy_reconcile/easy_reconcile_history_view.xml
+++ b/account_easy_reconcile/easy_reconcile_history_view.xml
@@ -41,8 +41,18 @@