banking-addons-team team mailing list archive
-
banking-addons-team team
-
Mailing list archive
-
Message #00259
lp:~c2c/banking-addons/6.1-banking-addons-statement-reconcile-account_easy_reconcile-empty_history-1095677 into lp:banking-addons/bank-statement-reconcile-61
Guewen Baconnier @ Camptocamp has proposed merging lp:~c2c/banking-addons/6.1-banking-addons-statement-reconcile-account_easy_reconcile-empty_history-1095677 into lp:banking-addons/bank-statement-reconcile-61.
Requested reviews:
Banking Addons Team (banking-addons-team)
Related bugs:
Bug #1095677 in Banking Addons: "account_easy_reconcile: error on click on "last history" when no history exists"
https://bugs.launchpad.net/banking-addons/+bug/1095677
For more details, see:
https://code.launchpad.net/~c2c/banking-addons/6.1-banking-addons-statement-reconcile-account_easy_reconcile-empty_history-1095677/+merge/141765
fix lp:1095677
The fix for the 7 version will be included in the migration of the module that I'm currently doing.
--
https://code.launchpad.net/~c2c/banking-addons/6.1-banking-addons-statement-reconcile-account_easy_reconcile-empty_history-1095677/+merge/141765
Your team Banking Addons Team is requested to review the proposed merge of lp:~c2c/banking-addons/6.1-banking-addons-statement-reconcile-account_easy_reconcile-empty_history-1095677 into lp:banking-addons/bank-statement-reconcile-61.
=== 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 @@
def _last_history(self, cr, uid, ids, name, args, context=None):
result = {}
for history in self.browse(cr, uid, ids, context=context):
- # history is sorted by date desc
- result[history.id] = history.history_ids[0].id
+ result[history.id] = False
+ if history.history_ids:
+ # history is sorted by date desc
+ result[history.id] = history.history_ids[0].id
return result
_columns = {
@@ -222,6 +224,16 @@
context=context)
return True
+ def _no_history(self, cr, uid, rec, context=None):
+ """ Raise an `osv.except_osv` error, supposed to
+ be called when there is no history on the reconciliation
+ task.
+ """
+ raise osv.except_osv(
+ _('Error'),
+ _('There is no history of reconciled '
+ 'entries on the task: %s.') % rec.name)
+
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
@@ -231,6 +243,8 @@
"Only 1 id expected"
rec_id = rec_id[0]
rec = self.browse(cr, uid, rec_id, context=context)
+ if not rec.last_history:
+ self._no_history(cr, uid, rec, context=context)
return rec.last_history.open_reconcile()
def last_history_partial(self, cr, uid, rec_id, context=None):
@@ -242,4 +256,6 @@
"Only 1 id expected"
rec_id = rec_id[0]
rec = self.browse(cr, uid, rec_id, context=context)
+ if not rec.last_history:
+ self._no_history(cr, uid, rec, context=context)
return rec.last_history.open_partial()
Follow ups