'Project Management' : ['project',],
'Knowledge Management' : ['document',],
'Warehouse Management' : ['stock',],
- 'Manufacturing' : ['mrp',],
- 'Accounting & Finance' : ['account,'],
- 'Purchase Management' : ['purchase,'],
+ 'Manufacturing' : ['mrp'],
+ 'Accounting & Finance' : ['account'],
+ 'Purchase Management' : ['purchase'],
'Human Resources' : ['hr',],
'Point of Sales' : ['pos',],
'Marketing' : ['marketing',],
}
-HIDDEN_CATEGORIES = ('Tools', 'System', 'Localization', 'Link', 'Uncategorized')
-
class base_setup_installer(osv.osv_memory):
_name = 'base.setup.installer'
fields = {}
category_proxy = self.pool.get('ir.module.category')
domain = [('parent_id', '=', False),
- ('name', 'not in', HIDDEN_CATEGORIES )]
+ ('name', '!=', 'Uncategorized'),
+ ('visible', '=', True)]
category_ids = category_proxy.search(cr, uid, domain, context=context)
for category in category_proxy.browse(cr, uid, category_ids, context=context):
category_name = 'category_%d' % (category.id,)
for module in module_proxy.browse(cr, uid, module_ids, context=context):
module_name = 'module_%d' % (module.id,)
module_is_installed = module.state == 'installed'
- title = "%s (%s)" % (module.shortdesc, module.complexity,)
fields[module_name] = {
'type' : 'boolean',
- 'string' : title,
+ 'string' : module.shortdesc,
'name' : module_name,
'help' : module.description,
}
module_ids = module_proxy.search(cr, uid, [], context=context)
for module in module_proxy.browse(cr, uid, module_ids, context=context):
result['module_%d' % (module.id,)] = module.state == 'installed'
- category_name = 'category_%d' % (module.category_id.id,)
- if not result.get('category_name'):
- result[category_name] = module.state == 'installed'
+
+ cat_proxy = self.pool.get('ir.module.category')
+ cat_ids = cat_proxy.search(cr, uid, [], context=context)
+ for cat in cat_proxy.browse(cr, uid, cat_ids, context=context):
+ m = DEFAULT_MODULES.get(cat.name,[])
+ r = module_proxy.search(cr, uid, [('state','=','installed'),('name','in',m)])
+ result['category_%d' % (cat.id,)] = len(r) == len(m)
return result
module_category_proxy = self.pool.get('ir.module.category')
domain = [('parent_id', '=', False),
- ('name', 'not in', HIDDEN_CATEGORIES)]
+ ('name', '!=', 'Uncategorized'),
+ ('visible', '=', True)]
module_category_ids = module_category_proxy.search(cr, uid, domain, context=context, order='sequence asc')
arch = ['<form string="%s">' % _('Automatic Base Setup')]
if not extended_view:
domain.append(('complexity', '!=', 'expert'))
- default_modules = DEFAULT_MODULES.get(module_category.name, False)
- if default_modules:
- domain.append(('name', 'not in', default_modules))
-
modules = module_proxy.browse(cr, uid, module_proxy.search(cr, uid, domain, context=context), context=context)
if not modules:
continue
- readonly = any(module.state == 'installed' for module in modules)
+ m = DEFAULT_MODULES.get(module_category.name, [])
+ r = module_proxy.search(cr, uid, [('state', '=', 'installed'),('name', 'in', m)], context=context)
+ readonly = bool(r)
attributes = {
'name' : 'category_%d' % (module_category.id,),
arch.append("""<field %s />""" % (" ".join(["%s='%s'" % (key, value,)
for key, value in attributes.iteritems()]),))
- # Compute the module to show
-
+ # Compute the modules to show
for module_category in module_category_proxy.browse(cr, uid, module_category_ids, context=context):
domain = [('category_id', '=', module_category.id)]
proxy.state_update(cr, uid, module_ids, 'to install', ['uninstalled'], context=context)
need_update = True
- category_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'base', 'module_category_link')
+ category_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'base', 'module_category_hidden_link')
while True and category_id:
cr.execute("select id, name from ir_module_module m where category_id = %s \
and (select count(d.id) from ir_module_module_dependency d \
ir_module_module_dependency d inner join ir_module_module m2 on d.name = m2.name \
where d.module_id=m.id and m2.state in %s ) and state = %s",
(category_id[1], ('installed', 'to install', 'to upgrade', ), 'uninstalled',))
- modules = [name for _, name in cr.fetchall()]
+ inner_modules = [name for _, name in cr.fetchall()]
- module_ids = proxy.search(cr, uid, [('name', 'in', modules)], context=context)
+ module_ids = proxy.search(cr, uid, [('name', 'in', inner_modules)], context=context)
if not module_ids:
break
+ modules.update(inner_modules)
+
proxy.state_update(cr, uid, module_ids, 'to install', ['uninstalled'], context=context)
need_update = True
+
+ domain = [('name', 'in', list(modules)),
+ ('state', '=', 'installed')]
+ for module in proxy.browse(cr, uid, proxy.search(cr, uid, domain, context=context), context):
+ cr.execute("update ir_actions_todo set state='open' \
+ from ir_model_data as data where data.res_id = ir_actions_todo.id \
+ and ir_actions_todo.type='special'\
+ and data.model = 'ir.actions.todo' and data.module=%s", (module.name, ))
+
if need_update:
cr.commit()
self.pool = pooler.restart_pool(cr.dbname, update_module=True)[1]
else:
return {'type' : 'ir.actions.act_window_close'}
- # TODO: To implement in this new wizard
- #def execute(self, cr, uid, ids, context=None):
- # module_pool = self.pool.get('ir.module.module')
- # modules_selected = []
- # datas = self.read(cr, uid, ids, context=context)[0]
- # for mod in datas.keys():
- # if mod in ('id', 'progress'):
- # continue
- # if datas[mod] == 1:
- # modules_selected.append(mod)
-
- # module_ids = module_pool.search(cr, uid, [('name', 'in', modules_selected)], context=context)
- # need_install = False
- # for module in module_pool.browse(cr, uid, module_ids, context=context):
- # if module.state == 'uninstalled':
- # module_pool.state_update(cr, uid, [module.id], 'to install', ['uninstalled'], context)
- # need_install = True
- # cr.commit()
- # elif module.state == 'installed':
- # cr.execute("update ir_actions_todo set state='open' \
- # from ir_model_data as data where data.res_id = ir_actions_todo.id \
- # and ir_actions_todo.type='special'\
- # and data.model = 'ir.actions.todo' and data.module=%s", (module.name, ))
- # if need_install:
- # self.pool = pooler.restart_pool(cr.dbname, update_module=True)[1]
- # return
-base_setup_installer()
-
-
-
-
#Migrate data from another application Conf wiz
class migrade_application_installer_modules(osv.osv_memory):
_inherit = 'res.config'
_columns = {
'customers': fields.selection([('create','Create'), ('import','Import')], 'Customers', size=32, required=True, help="Import or create customers"),
-
}
_defaults = {
'customers': 'create',