[IMP]: res_config: Improvement for the main application: like HR, we want them to be able to re-thick an installed application
but in HRs configuration, if hr_holidays is already installed, the boolean "holidays management" should be thick and readonly bzr revid: rpa@tinyerp.com-20110316120444-vqllngptthlfmeo5
This commit is contained in:
parent
189917c479
commit
4b3c2c7514
|
@ -355,6 +355,35 @@ class res_config_installer(osv.osv_memory):
|
|||
return (base | hooks_results | additionals) - set(
|
||||
map(attrgetter('name'), self._already_installed(cr, uid, context)))
|
||||
|
||||
def default_get(self, cr, uid, fields_list, context=None):
|
||||
''' If an addon is already installed, check it by default
|
||||
'''
|
||||
defaults = super(res_config_installer, self).default_get(
|
||||
cr, uid, fields_list, context=context)
|
||||
|
||||
return dict(defaults,
|
||||
**dict.fromkeys(
|
||||
map(attrgetter('name'),
|
||||
self._already_installed(cr, uid, context=context)),
|
||||
True))
|
||||
|
||||
def fields_get(self, cr, uid, fields=None, context=None, write_access=True):
|
||||
""" If an addon is already installed, set it to readonly as
|
||||
res.config.installer doesn't handle uninstallations of already
|
||||
installed addons
|
||||
"""
|
||||
fields = super(res_config_installer, self).fields_get(
|
||||
cr, uid, fields, context, write_access)
|
||||
|
||||
for module in self._already_installed(cr, uid, context=context):
|
||||
if module.name not in fields:
|
||||
continue
|
||||
fields[module.name].update(
|
||||
readonly=True,
|
||||
help= ustr(fields[module.name].get('help', '')) +
|
||||
_('\n\nThis addon is already installed on your system'))
|
||||
return fields
|
||||
|
||||
def execute(self, cr, uid, ids, context=None):
|
||||
modules = self.pool.get('ir.module.module')
|
||||
to_install = list(self.modules_to_install(
|
||||
|
|
Loading…
Reference in New Issue