[IMP] simplify res.config code by calling into new ir.actions.todo progress method to get current configuration progress

bzr revid: xmo@openerp.com-20110715145110-n1e8t1moqz4h82i3
This commit is contained in:
Xavier Morel 2011-07-15 16:51:10 +02:00
parent 5da4d042d1
commit 956abff97b
1 changed files with 3 additions and 4 deletions

View File

@ -19,7 +19,7 @@
#
##############################################################################
import logging
from operator import attrgetter
from operator import attrgetter, itemgetter
from osv import osv, fields
from tools.translate import _
@ -43,9 +43,8 @@ class res_config_configurable(osv.osv_memory):
'''Return a description the current progress of configuration:
a tuple of (non_open_todos:int, total_todos: int)
'''
todo_pool = self.pool.get('ir.actions.todo')
return (todo_pool.search_count(cr, uid, [('state','!=','open')], context),
todo_pool.search_count(cr, uid, [], context))
return itemgetter('done', 'total')(
self.pool.get('ir.actions.todo').progress(cr, uid, context=context))
def _progress(self, cr, uid, context=None):
closed, total = self.get_current_progress(cr, uid, context=context)