Skip to content
Snippets Groups Projects
Commit a020afe5 authored by Xavier Morel's avatar Xavier Morel
Browse files

[IMP] Add documented method to fetch current progress of res.config in the (done, total) format

bzr revid: xmo@openerp.com-20100809105527-86syptn3bdheqeji
parent 253983a1
Branches
Tags
No related merge requests found
......@@ -42,11 +42,17 @@ class res_config_configurable(osv.osv_memory):
_name = 'res.config'
logger = netsvc.Logger()
def get_current_progress(self, cr, uid, context=None):
'''Return a description the current progress of configuration:
a tuple of (non_open_todos:int, total_todos: int)
'''
return (self.pool.get('ir.actions.todo')\
.search_count(cr, uid, [('state','<>','open')], context),
self.pool.get('ir.actions.todo')\
.search_count(cr, uid, [], context))
def _progress(self, cr, uid, context=None):
total = self.pool.get('ir.actions.todo')\
.search_count(cr, uid, [], context)
closed = self.pool.get('ir.actions.todo')\
.search_count(cr, uid, [('state','<>','open')], context)
closed, total = self.get_current_progress(cr, uid, context=context)
if total:
return round(closed*100./total)
return 100.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment