bzr revid: fp@tinyerp.com-20081122000935-p245m22qxykckmv3
This commit is contained in:
Fabien Pinckaers 2008-11-22 01:09:35 +01:00
parent 5350c07190
commit b67fcb51ed
3 changed files with 114 additions and 20 deletions

View File

@ -1,7 +1,7 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# $Id$
#
@ -588,26 +588,26 @@ act_window_close()
# - if start_type='auto', it will be start on auto starting from start date, and stop on stop date
# - if start_type="manual", it will start and stop on manually
class ir_actions_todo(osv.osv):
_name = 'ir.actions.todo'
_name = 'ir.actions.todo'
_columns={
'name':fields.char('Name',size=64,required=True, select=True),
'note':fields.text('Text'),
'start_date': fields.datetime('Start Date'),
'end_date': fields.datetime('End Date'),
'start_date': fields.datetime('Start Date'),
'end_date': fields.datetime('End Date'),
'action_id':fields.many2one('ir.actions.act_window', 'Action', select=True,required=True, ondelete='cascade'),
'sequence':fields.integer('Sequence'),
'active': fields.boolean('Active'),
'type':fields.selection([('configure', 'Configure'),('service', 'Service'),('other','Other')], string='Type', required=True),
'start_on':fields.selection([('at_once', 'At Once'),('auto', 'Auto'),('manual','Manual')], string='Start On'),
'groups_id': fields.many2many('res.groups', 'res_groups_act_todo_rel', 'act_todo_id', 'group_id', 'Groups'),
'users_id': fields.many2many('res.users', 'res_users_act_todo_rel', 'act_todo_id', 'user_id', 'Users'),
'active': fields.boolean('Active'),
'type':fields.selection([('configure', 'Configure'),('service', 'Service'),('other','Other')], string='Type', required=True),
'start_on':fields.selection([('at_once', 'At Once'),('auto', 'Auto'),('manual','Manual')], string='Start On'),
'groups_id': fields.many2many('res.groups', 'res_groups_act_todo_rel', 'act_todo_id', 'group_id', 'Groups'),
'users_id': fields.many2many('res.users', 'res_users_act_todo_rel', 'act_todo_id', 'user_id', 'Users'),
'state':fields.selection([('open', 'Not Started'),('done', 'Done'),('skip','Skipped'),('cancel','Cancel')], string='State', required=True)
}
_defaults={
'state': lambda *a: 'open',
'sequence': lambda *a: 10,
'active':lambda *a:True,
'type':lambda *a:'configure'
'active':lambda *a:True,
'type':lambda *a:'configure'
}
_order="sequence"
ir_actions_todo()

View File

@ -146,5 +146,99 @@ class wizard_info_get(wizard.interface):
wizard_info_get('module.upgrade')
class wizard_info_get_simple(wizard.interface):
def _get_install(self, cr, uid, data, context):
pool=pooler.get_pool(cr.dbname)
mod_obj = pool.get('ir.module.module')
ids = mod_obj.search(cr, uid, [
('state', 'in', ['to upgrade', 'to remove', 'to install'])])
res = mod_obj.read(cr, uid, ids, ['name','state'], context)
url = mod_obj.download(cr, uid, ids, download=False, context=context)
return {'module_info': '\n'.join(map(lambda x: x['name']+' : '+x['state'], res)),
'module_download': '\n'.join(url)}
def _check_upgrade_module(self,cr,uid,data,context):
db, pool = pooler.get_db_and_pool(cr.dbname)
cr = db.cursor()
mod_obj = pool.get('ir.module.module')
ids = mod_obj.search(cr, uid, [
('state', 'in', ['to upgrade', 'to remove', 'to install'])])
if ids and len(ids):
return 'next'
else:
return 'end'
def _upgrade_module(self, cr, uid, data, context):
db, pool = pooler.get_db_and_pool(cr.dbname)
cr = db.cursor()
mod_obj = pool.get('ir.module.module')
ids = mod_obj.search(cr, uid, [('state', 'in', ['to upgrade', 'to remove', 'to install'])])
unmet_packages = []
mod_dep_obj = pool.get('ir.module.module.dependency')
for mod in mod_obj.browse(cr, uid, ids):
depends_mod_ids = mod_dep_obj.search(cr, uid, [('module_id', '=', mod.id)])
for dep_mod in mod_dep_obj.browse(cr, uid, depends_mod_ids):
if dep_mod.state in ('unknown','uninstalled'):
unmet_packages.append(dep_mod.name)
if len(unmet_packages):
raise wizard.except_wizard('Unmet dependency !', 'Following modules are uninstalled or unknown. \n\n'+'\n'.join(unmet_packages))
mod_obj.download(cr, uid, ids, context=context)
cr.commit()
db, pool = pooler.restart_pool(cr.dbname, update_module=True)
return {}
def _config(self, cr, uid, data, context=None):
return {
'view_type': 'form',
"view_mode": 'form',
'res_model': 'ir.actions.configuration.wizard',
'type': 'ir.actions.act_window',
'target':'new',
}
states = {
'init': {
'actions': [],
'result' : {'type': 'choice', 'next_state': _check_upgrade_module }
},
'next': {
'actions': [_get_install],
'result': {'type':'form', 'arch':view_form, 'fields': view_field,
'state':[
('end', 'Cancel', 'gtk-cancel'),
('start', 'Start Upgrade', 'gtk-ok', True)
]
}
},
'start': {
'actions': [_upgrade_module],
'result': {'type':'form', 'arch':view_form_end, 'fields': {},
'state':[
('end', 'Close', 'gtk-close', True),
('config', 'Start configuration', 'gtk-ok', True)
]
}
},
'end': {
'actions': [],
'result': {'type':'form', 'arch':view_form_end, 'fields': {},
'state':[
('end', 'Close', 'gtk-close', True),
('config', 'Start configuration', 'gtk-ok', True)
]
}
},
'config':{
'result': {
'type': 'action',
'action': _config,
'state': 'end',
},
}
}
wizard_info_get_simple('module.upgrade.simple')
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -646,30 +646,30 @@ def get_languages():
'ca_ES': u'Catalan / Català',
'cs_CZ': u'Czech / Čeština',
'de_DE': u'German / Deutsch',
'en_CA': u'English (Canada)',
'en_CA': u'English (CA)',
'en_EN': u'English (default)',
'en_GB': u'English (United Kingdom)',
'en_US': u'English (Unites States)',
'es_AR': u'Spanish (Argentina) / Español (República Argentina)',
'en_GB': u'English (UK)',
'en_US': u'English (US)',
'es_AR': u'Spanish (AR) / Español (AR)',
'es_ES': u'Spanish / Español',
'et_ET': u'Estonian / Eesti keel',
'fr_BE': u'French (Belgium) / Français (Belgique)',
'fr_CH': u'French (Switzerland) / Français (Suisse)',
'fr_BE': u'French (BE) / Français (BE)',
'fr_CH': u'French (CH) / Français (CH)',
'fr_FR': u'French / Français',
'hr_HR': u'Croatian / hrvatski jezik',
'hu_HU': u'Hungarian / Magyar',
'it_IT': u'Italian / Italiano',
'lt_LT': u'Lithuanian / Lietuvių kalba',
'nl_NL': u'Dutch / Nederlands',
'pt_BR': u'Portugese (Federative Republic of Brazil) / português (República Federativa do Brasil)',
'pt_BR': u'Portugese (BR) / português (BR)',
'pt_PT': u'Portugese / português',
'ro_RO': u'Romanian / limba română',
'ru_RU': u'Russian / русский язык',
'sl_SL': u'Slovenian / slovenščina',
'sv_SE': u'Swedish / svenska',
'uk_UK': u'Ukrainian / украї́нська мо́ва',
'zh_CN': u'Chinese (Simplified) / 简体中文' ,
'zh_TW': u'Chinese (Traditional) / 正體字',
'zh_CN': u'Chinese (CN) / 简体中文' ,
'zh_TW': u'Chinese (TW) / 正體字',
}
return languages