[FIX] Do not raise an error if the next todo isn't found to set the previous todo's status

The previous line hardly makes any sense, so clarification: finding the 'next' todo is based on todo states, so until we've set the state of the todo item we've just executed (aka the previous todo) it remains the 'next' todo as well.

So in order to set the previous todo's state, we look for the next todo (which it still is) and set its state, actually marking it as the 'previous' todo

bzr revid: xmo@openerp.com-20101108104412-bd7bf3k7c5p5jkpl
This commit is contained in:
Xavier Morel
2010-11-08 11:44:12 +01:00
parent bde7060598
commit 89af2f0c8e
+2 -1
View File
@@ -95,7 +95,8 @@ class res_config_configurable(osv.osv_memory):
# "previous" todo
previous_todo = self._next_action(cr, uid, context=context)
if not previous_todo:
raise LookupError(_("Couldn't find previous ir.actions.todo"))
self.__logger.warn(_("Couldn't find previous ir.actions.todo"))
return
if not state:
raise ValueError(_("Can't set an ir.actions.todo's state to an empty value."))
previous_todo.write({'state':state})