[IMP] module: make internal methods private
Only methods that are meant to be accessed by the client-side directly (or via RPC) should be public. All others should be private by default.
This commit is contained in:
@@ -342,7 +342,7 @@ class Module(models.Model):
|
||||
raise UserError(msg % (module_name, e.args[0]))
|
||||
|
||||
@api.multi
|
||||
def state_update(self, newstate, states_to_update, level=100):
|
||||
def _state_update(self, newstate, states_to_update, level=100):
|
||||
if level < 1:
|
||||
raise UserError(_('Recursion error in modules dependencies !'))
|
||||
|
||||
@@ -361,7 +361,7 @@ class Module(models.Model):
|
||||
update_mods += dep.depend_id
|
||||
|
||||
# update dependency modules that require it, and determine demo for module
|
||||
update_demo = update_mods.state_update(newstate, states_to_update, level=level-1)
|
||||
update_demo = update_mods._state_update(newstate, states_to_update, level=level-1)
|
||||
module_demo = module.demo or update_demo or any(mod.demo for mod in ready_mods)
|
||||
demo = demo or module_demo
|
||||
|
||||
@@ -389,7 +389,7 @@ class Module(models.Model):
|
||||
modules = self
|
||||
while modules:
|
||||
# Mark the given modules and their dependencies to be installed.
|
||||
modules.state_update('to install', ['uninstalled'])
|
||||
modules._state_update('to install', ['uninstalled'])
|
||||
|
||||
# Determine which auto-installable modules must be installed.
|
||||
modules = self.search(auto_domain).filtered(must_install)
|
||||
@@ -807,9 +807,8 @@ class Module(models.Model):
|
||||
cat_id = modules.db.create_categories(self._cr, categs)
|
||||
self.write({'category_id': cat_id})
|
||||
|
||||
@assert_log_admin_access
|
||||
@api.multi
|
||||
def update_translations(self, filter_lang=None):
|
||||
def _update_translations(self, filter_lang=None):
|
||||
if not filter_lang:
|
||||
langs = self.env['res.lang'].search([('translatable', '=', True)])
|
||||
filter_lang = [lang.code for lang in langs]
|
||||
@@ -819,7 +818,7 @@ class Module(models.Model):
|
||||
self.env['ir.translation'].load_module_terms(mod_names, filter_lang)
|
||||
|
||||
@api.multi
|
||||
def check(self):
|
||||
def _check(self):
|
||||
for module in self:
|
||||
if not module.description:
|
||||
_logger.warning('module %s: description is empty !', module.name)
|
||||
|
||||
@@ -22,7 +22,7 @@ class BaseLanguageInstall(models.TransientModel):
|
||||
def lang_install(self):
|
||||
self.ensure_one()
|
||||
mods = self.env['ir.module.module'].search([('state', '=', 'installed')])
|
||||
mods.with_context(overwrite=self.overwrite).update_translations(self.lang)
|
||||
mods.with_context(overwrite=self.overwrite)._update_translations(self.lang)
|
||||
self.state = 'done'
|
||||
return {
|
||||
'name': _('Language Pack'),
|
||||
|
||||
@@ -148,7 +148,7 @@ def load_module_graph(cr, graph, status=None, perform_checks=True, skip_modules=
|
||||
module = env['ir.module.module'].browse(module_id)
|
||||
|
||||
if perform_checks:
|
||||
module.check()
|
||||
module._check()
|
||||
|
||||
if package.state=='to upgrade':
|
||||
# upgrading the module information
|
||||
@@ -164,7 +164,7 @@ def load_module_graph(cr, graph, status=None, perform_checks=True, skip_modules=
|
||||
|
||||
# Update translations for all installed languages
|
||||
overwrite = odoo.tools.config["overwrite_existing_translations"]
|
||||
module.with_context(overwrite=overwrite).update_translations()
|
||||
module.with_context(overwrite=overwrite)._update_translations()
|
||||
|
||||
registry._init_modules.add(package.name)
|
||||
|
||||
|
||||
+1
-1
@@ -55,7 +55,7 @@ def _initialize_db(id, db_name, demo, lang, user_password, login='admin', countr
|
||||
|
||||
if lang:
|
||||
modules = env['ir.module.module'].search([('state', '=', 'installed')])
|
||||
modules.update_translations(lang)
|
||||
modules._update_translations(lang)
|
||||
|
||||
if country_code:
|
||||
countries = env['res.country'].search([('code', 'ilike', country_code)])
|
||||
|
||||
Reference in New Issue
Block a user