From 583b156df79d4026b3f942713f5f1abbda4ebe09 Mon Sep 17 00:00:00 2001 From: Guewen Baconnier Date: Mon, 25 Aug 2014 09:11:28 +0200 Subject: [PATCH] Cron fails to run when there is no "last history". Fixes #39 --- account_easy_reconcile/easy_reconcile.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/account_easy_reconcile/easy_reconcile.py b/account_easy_reconcile/easy_reconcile.py index 164f0ac0..8b12ee82 100644 --- a/account_easy_reconcile/easy_reconcile.py +++ b/account_easy_reconcile/easy_reconcile.py @@ -365,8 +365,11 @@ class AccountEasyReconcile(orm.Model): """ def _get_date(reconcile): - return datetime.strptime(reconcile.last_history.date, - DEFAULT_SERVER_DATETIME_FORMAT) + if reconcile.last_history.date: + return datetime.strptime(reconcile.last_history.date, + DEFAULT_SERVER_DATETIME_FORMAT) + else: + return datetime.min ids = self.search(cr, uid, [], context=context) assert ids, "No easy reconcile available"