From fb0b22ecd404e5ce09cc0133940eb47b5b84836e Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Tue, 6 Dec 2011 17:13:11 +0100 Subject: [PATCH] [IMP] remove add more features wizard -> will be replaced by kanban on modules and homepage bzr revid: fp@tinyerp.com-20111206161311-99dpd7t69c108q6u --- addons/base_setup/base_setup.py | 284 ------------------------- addons/base_setup/base_setup_views.xml | 30 --- 2 files changed, 314 deletions(-) diff --git a/addons/base_setup/base_setup.py b/addons/base_setup/base_setup.py index ecb9b5bf3c4..c10dee7b14b 100644 --- a/addons/base_setup/base_setup.py +++ b/addons/base_setup/base_setup.py @@ -28,290 +28,6 @@ from osv import fields, osv from tools.translate import _ from lxml import etree -#Application and feature chooser, this could be done by introspecting ir.modules -DEFAULT_MODULES = { - 'Customer Relationship Management' : ['crm',], - 'Sales Management' : ['sale',], - 'Project Management' : ['project',], - 'Knowledge Management' : ['document',], - 'Warehouse Management' : ['stock',], - 'Manufacturing' : ['mrp'], - 'Accounting & Finance' : ['account'], - 'Purchase Management' : ['purchase'], - 'Human Resources' : ['hr',], - 'Point of Sale' : ['point_of_sale',], - 'Marketing' : ['marketing',], -} - -class base_setup_installer(osv.osv_memory): - _name = 'base.setup.installer' - _inherit = 'res.config.installer' - - _columns = { - 'selection' : fields.text('Selection'), - } - - def fields_get(self, cr, uid, fields=None, context=None): - if context is None: - context = {} - if fields is None: - fields = {} - - fields = {} - category_proxy = self.pool.get('ir.module.category') - domain = [('parent_id', '=', False), - ('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,) - fields[category_name] = { - 'type' : 'boolean', - 'string' : category.name, - 'name' : category_name, - 'help' : category.description, - } - - module_proxy = self.pool.get('ir.module.module') - module_ids = module_proxy.search(cr, uid, [], context=context) - for module in module_proxy.browse(cr, uid, module_ids, context=context): - module_name = 'module_%d' % (module.id,) - module_is_installed = module.state == 'installed' - - fields[module_name] = { - 'type' : 'boolean', - 'string' : module.shortdesc, - 'name' : module_name, - 'help' : module.description, - } - - return fields - - def default_get(self, cr, uid, fields=None, context=None): - if context is None: - context = {} - if fields is None: - fields = {} - - result = {} - - if 'dont_compute_virtual_attributes' not in context: - module_proxy = self.pool.get('ir.module.module') - 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' - - 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,)] = bool(r) and (len(r) == len(m)) - - return result - - def fields_view_get(self, cr, uid, view_id=None, view_type='from', context=None, toolbar=False, submenu=False): - def in_extended_view_group(cr, uid, context=None): - try: - model, group_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'base', 'group_extended') - except ValueError: - return False - return group_id in self.pool.get('res.users').read(cr, uid, uid, ['groups_id'], context=context)['groups_id'] - - result = super(base_setup_installer, self).fields_view_get(cr, uid, view_id, view_type, context, toolbar, submenu) - - module_category_proxy = self.pool.get('ir.module.category') - domain = [('parent_id', '=', False), - ('name', '!=', 'Uncategorized'), - ('visible', '=', True)] - module_category_ids = module_category_proxy.search(cr, uid, domain, context=context, order='sequence asc') - - arch = ['
' % _('Automatic Base Setup')] - arch.append('' % _('Install Applications')) - module_proxy = self.pool.get('ir.module.module') - - extended_view = in_extended_view_group(cr, uid, context=context) - - for module_category in module_category_proxy.browse(cr, uid, module_category_ids, context=context): - domain = [('category_id', '=', module_category.id)] - if not extended_view: - domain.append(('complexity', '!=', 'expert')) - - modules = module_proxy.browse(cr, uid, module_proxy.search(cr, uid, domain, context=context), context=context) - if not modules: - continue - - 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,), - 'on_change' : 'on_change_%s_%d(category_%d)' % ('category', module_category.id, module_category.id,), - } - if readonly: - attributes['modifiers'] = simplejson.dumps({'readonly' : True}) - - arch.append("""""" % (" ".join(["%s='%s'" % (key, value,) - for key, value in attributes.iteritems()]),)) - - # 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)] - - 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 - - modifiers = { - 'invisible' : [('category_%d' % (module_category.id), '=', False)], - } - module_modifiers = dict(modifiers) - - arch.append("""""" % ( - cgi.escape(module_category.name), - simplejson.dumps(modifiers)) - ) - - for module in modules: - #module_modifiers['readonly'] = module.state == 'installed' - - arch.append("""""" % ( - module.id, - simplejson.dumps(module_modifiers)) - ) - - arch.append( - '' - '' - '