[ADD] integrate progress bars into configuration dialogs

bzr revid: xmo@tinyerp.com-20091204121452-3eibzrgingec5xd9
This commit is contained in:
Xavier Morel 2009-12-04 13:14:52 +01:00
parent 0e4962391e
commit de37555dd9
2 changed files with 30 additions and 5 deletions

View File

@ -227,8 +227,11 @@
<field colspan="4" nolabel="1" name="roles_id"/>
</page>
</notebook>
<label string="" colspan="2"/>
<group col="2" colspan="2">
<field name="progress" widget="progressbar"
nolabel="1" colspan='1'/>
<label string='' colspan='1'/>
<group col="4" colspan="2">
<button icon='gtk-cancel' special="cancel" name="action_next" type='object' string='Skip'/>
<button name='action_new' icon='gtk-ok' type='object' string='Add User'/>
</group>
@ -257,8 +260,11 @@
<label string="Choose the simplified interface if you are testing OpenERP for the first time. Less used options or fields are automatically hidden. You will be able to change this, later, through the Administration menu." colspan="4" align="0.0"/>
<newline/>
<separator string="" colspan="4"/>
<label string="" colspan="2"/>
<group colspan="2" col="1">
<field name="progress" widget="progressbar" nolabel="1"
colspan="1" />
<label string='' colspan='1'/>
<group colspan="2" col="2">
<button icon="gtk-ok" name="action_set" string="Set" type="object"/>
</group>
</form>

View File

@ -19,13 +19,32 @@
#
##############################################################################
from osv import osv
from osv import osv, fields
import netsvc
class res_config_configurable(osv.osv_memory):
_name = 'res.config'
logger = netsvc.Logger()
def _progress(self, cr, uid, context=None):
total = self.pool.get('ir.actions.todo')\
.search_count(cr, uid, [], context)
open = self.pool.get('ir.actions.todo')\
.search_count(cr, uid,[('type','=','configure'),
('active','=',True),
('state','<>','open')],
context)
if total:
return round(open*100./total)
return 100.
_columns = dict(
progress=fields.float('Configuration Progress', readonly=True),
)
_defaults = dict(
progress=_progress
)
def _next_action(self, cr, uid):
todos = self.pool.get('ir.actions.todo')
self.logger.notifyChannel('actions', netsvc.LOG_INFO,