Merge lp:~camptocamp/banking-addons/6.1-banking-addons-statement-reconcile-account_easy_reconcile-empty_history-1095677 into lp:banking-addons/bank-statement-reconcile-61

Proposed by Guewen Baconnier @ Camptocamp
Status: Merged
Merged at revision: 76
Proposed branch: lp:~camptocamp/banking-addons/6.1-banking-addons-statement-reconcile-account_easy_reconcile-empty_history-1095677
Merge into: lp:banking-addons/bank-statement-reconcile-61
Diff against target: 49 lines (+18/-2)
1 file modified
account_easy_reconcile/easy_reconcile.py (+18/-2)
To merge this branch: bzr merge lp:~camptocamp/banking-addons/6.1-banking-addons-statement-reconcile-account_easy_reconcile-empty_history-1095677
Reviewer Review Type Date Requested Status
Alexandre Fayolle - camptocamp code review, no test Approve
Joël Grand-Guillaume @ camptocamp Approve
Review via email: mp+141765@code.launchpad.net

Description of the change

fix lp:1095677

The fix for the 7 version will be included in the migration of the module that I'm currently doing.

To post a comment you must log in.
Revision history for this message
Joël Grand-Guillaume @ camptocamp (jgrandguillaume-c2c) wrote :

LGTM

review: Approve
Revision history for this message
Alexandre Fayolle - camptocamp (alexandre-fayolle-c2c) wrote :

LGTM

review: Approve (code review, no test)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'account_easy_reconcile/easy_reconcile.py'
--- account_easy_reconcile/easy_reconcile.py 2012-12-20 11:05:28 +0000
+++ account_easy_reconcile/easy_reconcile.py 2013-01-03 15:30:31 +0000
@@ -140,8 +140,10 @@
140 def _last_history(self, cr, uid, ids, name, args, context=None):140 def _last_history(self, cr, uid, ids, name, args, context=None):
141 result = {}141 result = {}
142 for history in self.browse(cr, uid, ids, context=context):142 for history in self.browse(cr, uid, ids, context=context):
143 # history is sorted by date desc143 result[history.id] = False
144 result[history.id] = history.history_ids[0].id144 if history.history_ids:
145 # history is sorted by date desc
146 result[history.id] = history.history_ids[0].id
145 return result147 return result
146148
147 _columns = {149 _columns = {
@@ -222,6 +224,16 @@
222 context=context)224 context=context)
223 return True225 return True
224226
227 def _no_history(self, cr, uid, rec, context=None):
228 """ Raise an `osv.except_osv` error, supposed to
229 be called when there is no history on the reconciliation
230 task.
231 """
232 raise osv.except_osv(
233 _('Error'),
234 _('There is no history of reconciled '
235 'entries on the task: %s.') % rec.name)
236
225 def last_history_reconcile(self, cr, uid, rec_id, context=None):237 def last_history_reconcile(self, cr, uid, rec_id, context=None):
226 """ Get the last history record for this reconciliation profile238 """ Get the last history record for this reconciliation profile
227 and return the action which opens move lines reconciled239 and return the action which opens move lines reconciled
@@ -231,6 +243,8 @@
231 "Only 1 id expected"243 "Only 1 id expected"
232 rec_id = rec_id[0]244 rec_id = rec_id[0]
233 rec = self.browse(cr, uid, rec_id, context=context)245 rec = self.browse(cr, uid, rec_id, context=context)
246 if not rec.last_history:
247 self._no_history(cr, uid, rec, context=context)
234 return rec.last_history.open_reconcile()248 return rec.last_history.open_reconcile()
235249
236 def last_history_partial(self, cr, uid, rec_id, context=None):250 def last_history_partial(self, cr, uid, rec_id, context=None):
@@ -242,4 +256,6 @@
242 "Only 1 id expected"256 "Only 1 id expected"
243 rec_id = rec_id[0]257 rec_id = rec_id[0]
244 rec = self.browse(cr, uid, rec_id, context=context)258 rec = self.browse(cr, uid, rec_id, context=context)
259 if not rec.last_history:
260 self._no_history(cr, uid, rec, context=context)
245 return rec.last_history.open_partial()261 return rec.last_history.open_partial()

Subscribers

People subscribed via source and target branches