diff --git a/openerp/addons/base/res/res_config.py b/openerp/addons/base/res/res_config.py index f28b023eddd..e7f54c6966e 100644 --- a/openerp/addons/base/res/res_config.py +++ b/openerp/addons/base/res/res_config.py @@ -496,15 +496,6 @@ class res_config_settings(osv.osv_memory): return res - def fields_get(self, cr, uid, allfields=None, context=None, write_access=True): - # overridden to make fields of installed modules readonly - res = super(res_config_settings, self).fields_get(cr, uid, allfields, context, write_access) - classified = self._get_classified_fields(cr, uid, context) - for name, module in classified['module']: - if name in res and module.state in ('installed', 'to install', 'to upgrade'): - res[name]['readonly'] = True - return res - def execute(self, cr, uid, ids, context=None): ir_values = self.pool.get('ir.values') ir_model_data = self.pool.get('ir.model.data') @@ -531,13 +522,18 @@ class res_config_settings(osv.osv_memory): if method.startswith('set_'): getattr(self, method)(cr, uid, ids, context) - # module fields: install immediately the selected modules + # module fields: install/uninstall the selected modules to_install_ids = [] + to_uninstall_ids = [] for name, module in classified['module']: - if config[name] and module.state == 'uninstalled': - to_install_ids.append(module.id) - if to_install_ids: - ir_module.button_immediate_install(cr, uid, to_install_ids, context) + if config[name]: + if module.state == 'uninstalled': to_install_ids.append(module.id) + else: + if module.state in ('installed','upgrade'): to_uninstall_ids.append(module.id) + + if to_install_ids or to_uninstall_ids: + ir_module.button_uninstall(cr, uid, to_uninstall_ids, context=context) + ir_module.button_immediate_install(cr, uid, to_install_ids, context=context) # force client-side reload (update user menu and current view) return { diff --git a/openerp/addons/base/res/res_partner.py b/openerp/addons/base/res/res_partner.py index 14acbceb91c..1f4e11fca26 100644 --- a/openerp/addons/base/res/res_partner.py +++ b/openerp/addons/base/res/res_partner.py @@ -289,19 +289,16 @@ class res_partner(osv.osv): context = {} if isinstance(ids, (int, long)): ids = [ids] - if not ids: - return [] - if context.get('show_ref'): - rec_name = 'ref' - else: - rec_name = 'name' - reads = self.read(cr, uid, ids, [rec_name,'parent_id'], context=context) res = [] - for record in reads: - name = record.get('name', '/') - if record['parent_id']: - name = "%s (%s)"%(name, record['parent_id'][1]) - res.append((record['id'], name)) + for record in self.browse(cr, uid, ids, context=context): + name = record.name + if record.parent_id: + name = "%s (%s)" % (name, record.parent_id.name) + if context.get('show_address'): + name = name + "\n" + self._display_address(cr, uid, record, without_company=True, context=context) + name = name.replace('\n\n','\n') + name = name.replace('\n\n','\n') + res.append((record.id, name)) return res def name_search(self, cr, uid, name, args=None, operator='ilike', context=None, limit=100): @@ -399,7 +396,7 @@ class res_partner(osv.osv): ('name','=','main_partner')])[0], ).res_id - def _display_address(self, cr, uid, address, context=None): + def _display_address(self, cr, uid, address, without_company=False, context=None): ''' The purpose of this function is to build and return an address formatted accordingly to the @@ -425,7 +422,8 @@ class res_partner(osv.osv): address_field = ['title', 'street', 'street2', 'zip', 'city'] for field in address_field : args[field] = getattr(address, field) or '' - + if without_company: + args['company_name'] = '' return address_format % args