gooderp18绿色标准版
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

633 lines
27KB

  1. # -*- coding: utf-8 -*-
  2. # Part of Odoo. See LICENSE file for full copyright and licensing details.
  3. """ Modules (also called addons) management.
  4. """
  5. import itertools
  6. import logging
  7. import sys
  8. import threading
  9. import time
  10. import traceback
  11. import odoo
  12. import odoo.modules.db
  13. import odoo.modules.graph
  14. import odoo.modules.migration
  15. import odoo.modules.registry
  16. from .. import SUPERUSER_ID, api, tools
  17. from .module import adapt_version, initialize_sys_path, load_openerp_module
  18. _logger = logging.getLogger(__name__)
  19. def load_data(env, idref, mode, kind, package):
  20. """
  21. kind: data, demo, test, init_xml, update_xml, demo_xml.
  22. noupdate is False, unless it is demo data or it is csv data in
  23. init mode.
  24. :returns: Whether a file was loaded
  25. :rtype: bool
  26. """
  27. def _get_files_of_kind(kind):
  28. if kind == 'demo':
  29. keys = ['demo_xml', 'demo']
  30. elif kind == 'data':
  31. keys = ['init_xml', 'update_xml', 'data']
  32. if isinstance(kind, str):
  33. keys = [kind]
  34. files = []
  35. for k in keys:
  36. for f in package.data[k]:
  37. if f in files:
  38. _logger.warning("File %s is imported twice in module %s %s", f, package.name, kind)
  39. files.append(f)
  40. if k.endswith('_xml') and not (k == 'init_xml' and not f.endswith('.xml')):
  41. # init_xml, update_xml and demo_xml are deprecated except
  42. # for the case of init_xml with csv and sql files as
  43. # we can't specify noupdate for those file.
  44. correct_key = 'demo' if k.count('demo') else 'data'
  45. _logger.warning(
  46. "module %s: key '%s' is deprecated in favor of '%s' for file '%s'.",
  47. package.name, k, correct_key, f
  48. )
  49. return files
  50. filename = None
  51. try:
  52. if kind in ('demo', 'test'):
  53. threading.current_thread().testing = True
  54. for filename in _get_files_of_kind(kind):
  55. _logger.info("loading %s/%s", package.name, filename)
  56. noupdate = False
  57. if kind in ('demo', 'demo_xml') or (filename.endswith('.csv') and kind in ('init', 'init_xml')):
  58. noupdate = True
  59. tools.convert_file(env, package.name, filename, idref, mode, noupdate, kind)
  60. finally:
  61. if kind in ('demo', 'test'):
  62. threading.current_thread().testing = False
  63. return bool(filename)
  64. def load_demo(env, package, idref, mode):
  65. """
  66. Loads demo data for the specified package.
  67. """
  68. if not package.should_have_demo():
  69. return False
  70. try:
  71. if package.data.get('demo') or package.data.get('demo_xml'):
  72. _logger.info("Module %s: loading demo", package.name)
  73. with env.cr.savepoint(flush=False):
  74. load_data(env(su=True), idref, mode, kind='demo', package=package)
  75. return True
  76. except Exception: # noqa: BLE001
  77. # If we could not install demo data for this module
  78. _logger.warning(
  79. "Module %s demo data failed to install, installed without demo data",
  80. package.name, exc_info=True)
  81. todo = env.ref('base.demo_failure_todo', raise_if_not_found=False)
  82. Failure = env.get('ir.demo_failure')
  83. if todo and Failure is not None:
  84. todo.state = 'open'
  85. Failure.create({'module_id': package.id, 'error': traceback.format_exc()})
  86. return False
  87. def force_demo(env):
  88. """
  89. Forces the `demo` flag on all modules, and installs demo data for all installed modules.
  90. """
  91. graph = odoo.modules.graph.Graph()
  92. env.cr.execute('UPDATE ir_module_module SET demo=True')
  93. env.cr.execute(
  94. "SELECT name FROM ir_module_module WHERE state IN ('installed', 'to upgrade', 'to remove')"
  95. )
  96. module_list = [name for (name,) in env.cr.fetchall()]
  97. graph.add_modules(env.cr, module_list, ['demo'])
  98. for package in graph:
  99. load_demo(env, package, {}, 'init')
  100. env['ir.module.module'].invalidate_model(['demo'])
  101. env['res.groups']._update_user_groups_view()
  102. def load_module_graph(env, graph, status=None, perform_checks=True,
  103. skip_modules=None, report=None, models_to_check=None):
  104. """Migrates+Updates or Installs all module nodes from ``graph``
  105. :param env:
  106. :param graph: graph of module nodes to load
  107. :param status: deprecated parameter, unused, left to avoid changing signature in 8.0
  108. :param perform_checks: whether module descriptors should be checked for validity (prints warnings
  109. for same cases)
  110. :param skip_modules: optional list of module names (packages) which have previously been loaded and can be skipped
  111. :param report:
  112. :param set models_to_check:
  113. :return: list of modules that were installed or updated
  114. """
  115. if models_to_check is None:
  116. models_to_check = set()
  117. processed_modules = []
  118. loaded_modules = []
  119. registry = env.registry
  120. migrations = odoo.modules.migration.MigrationManager(env.cr, graph)
  121. module_count = len(graph)
  122. _logger.info('loading %d modules...', module_count)
  123. # register, instantiate and initialize models for each modules
  124. t0 = time.time()
  125. loading_extra_query_count = odoo.sql_db.sql_counter
  126. loading_cursor_query_count = env.cr.sql_log_count
  127. models_updated = set()
  128. for index, package in enumerate(graph, 1):
  129. module_name = package.name
  130. module_id = package.id
  131. if skip_modules and module_name in skip_modules:
  132. continue
  133. module_t0 = time.time()
  134. module_cursor_query_count = env.cr.sql_log_count
  135. module_extra_query_count = odoo.sql_db.sql_counter
  136. needs_update = (
  137. hasattr(package, "init")
  138. or hasattr(package, "update")
  139. or package.state in ("to install", "to upgrade")
  140. )
  141. module_log_level = logging.DEBUG
  142. if needs_update:
  143. module_log_level = logging.INFO
  144. _logger.log(module_log_level, 'Loading module %s (%d/%d)', module_name, index, module_count)
  145. new_install = package.state == 'to install'
  146. if needs_update:
  147. if not new_install:
  148. if package.name != 'base':
  149. registry.setup_models(env.cr)
  150. migrations.migrate_module(package, 'pre')
  151. if package.name != 'base':
  152. env.flush_all()
  153. load_openerp_module(package.name)
  154. if new_install:
  155. py_module = sys.modules['odoo.addons.%s' % (module_name,)]
  156. pre_init = package.info.get('pre_init_hook')
  157. if pre_init:
  158. registry.setup_models(env.cr)
  159. getattr(py_module, pre_init)(env)
  160. model_names = registry.load(env.cr, package)
  161. mode = 'update'
  162. if hasattr(package, 'init') or package.state == 'to install':
  163. mode = 'init'
  164. loaded_modules.append(package.name)
  165. if needs_update:
  166. models_updated |= set(model_names)
  167. models_to_check -= set(model_names)
  168. registry.setup_models(env.cr)
  169. registry.init_models(env.cr, model_names, {'module': package.name}, new_install)
  170. elif package.state != 'to remove':
  171. # The current module has simply been loaded. The models extended by this module
  172. # and for which we updated the schema, must have their schema checked again.
  173. # This is because the extension may have changed the model,
  174. # e.g. adding required=True to an existing field, but the schema has not been
  175. # updated by this module because it's not marked as 'to upgrade/to install'.
  176. models_to_check |= set(model_names) & models_updated
  177. idref = {}
  178. if needs_update:
  179. # Can't put this line out of the loop: ir.module.module will be
  180. # registered by init_models() above.
  181. module = env['ir.module.module'].browse(module_id)
  182. if perform_checks:
  183. module._check()
  184. if package.state == 'to upgrade':
  185. # upgrading the module information
  186. module.write(module.get_values_from_terp(package.data))
  187. load_data(env, idref, mode, kind='data', package=package)
  188. demo_loaded = package.dbdemo = load_demo(env, package, idref, mode)
  189. env.cr.execute('update ir_module_module set demo=%s where id=%s', (demo_loaded, module_id))
  190. module.invalidate_model(['demo'])
  191. migrations.migrate_module(package, 'post')
  192. # Update translations for all installed languages
  193. overwrite = odoo.tools.config["overwrite_existing_translations"]
  194. module._update_translations(overwrite=overwrite)
  195. if package.name is not None:
  196. registry._init_modules.add(package.name)
  197. if needs_update:
  198. if new_install:
  199. post_init = package.info.get('post_init_hook')
  200. if post_init:
  201. getattr(py_module, post_init)(env)
  202. if mode == 'update':
  203. # validate the views that have not been checked yet
  204. env['ir.ui.view']._validate_module_views(module_name)
  205. # need to commit any modification the module's installation or
  206. # update made to the schema or data so the tests can run
  207. # (separately in their own transaction)
  208. env.cr.commit()
  209. concrete_models = [model for model in model_names if not registry[model]._abstract]
  210. if concrete_models:
  211. env.cr.execute("""
  212. SELECT model FROM ir_model
  213. WHERE id NOT IN (SELECT DISTINCT model_id FROM ir_model_access) AND model IN %s
  214. """, [tuple(concrete_models)])
  215. models = [model for [model] in env.cr.fetchall()]
  216. if models:
  217. lines = [
  218. f"The models {models} have no access rules in module {module_name}, consider adding some, like:",
  219. "id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink"
  220. ]
  221. for model in models:
  222. xmlid = model.replace('.', '_')
  223. lines.append(f"{module_name}.access_{xmlid},access_{xmlid},{module_name}.model_{xmlid},base.group_user,1,0,0,0")
  224. _logger.warning('\n'.join(lines))
  225. updating = tools.config.options['init'] or tools.config.options['update']
  226. test_time = test_queries = 0
  227. test_results = None
  228. if tools.config.options['test_enable'] and (needs_update or not updating):
  229. from odoo.tests import loader # noqa: PLC0415
  230. suite = loader.make_suite([module_name], 'at_install')
  231. if suite.countTestCases():
  232. if not needs_update:
  233. registry.setup_models(env.cr)
  234. # Python tests
  235. tests_t0, tests_q0 = time.time(), odoo.sql_db.sql_counter
  236. test_results = loader.run_suite(suite)
  237. report.update(test_results)
  238. test_time = time.time() - tests_t0
  239. test_queries = odoo.sql_db.sql_counter - tests_q0
  240. # tests may have reset the environment
  241. module = env['ir.module.module'].browse(module_id)
  242. if needs_update:
  243. processed_modules.append(package.name)
  244. ver = adapt_version(package.data['version'])
  245. # Set new modules and dependencies
  246. module.write({'state': 'installed', 'latest_version': ver})
  247. package.load_state = package.state
  248. package.load_version = package.installed_version
  249. package.state = 'installed'
  250. for kind in ('init', 'demo', 'update'):
  251. if hasattr(package, kind):
  252. delattr(package, kind)
  253. module.env.flush_all()
  254. extra_queries = odoo.sql_db.sql_counter - module_extra_query_count - test_queries
  255. extras = []
  256. if test_queries:
  257. extras.append(f'+{test_queries} test')
  258. if extra_queries:
  259. extras.append(f'+{extra_queries} other')
  260. _logger.log(
  261. module_log_level, "Module %s loaded in %.2fs%s, %s queries%s",
  262. module_name, time.time() - module_t0,
  263. f' (incl. {test_time:.2f}s test)' if test_time else '',
  264. env.cr.sql_log_count - module_cursor_query_count,
  265. f' ({", ".join(extras)})' if extras else ''
  266. )
  267. if test_results and not test_results.wasSuccessful():
  268. _logger.error(
  269. "Module %s: %d failures, %d errors of %d tests",
  270. module_name, test_results.failures_count, test_results.errors_count,
  271. test_results.testsRun
  272. )
  273. _logger.runbot("%s modules loaded in %.2fs, %s queries (+%s extra)",
  274. len(graph),
  275. time.time() - t0,
  276. env.cr.sql_log_count - loading_cursor_query_count,
  277. odoo.sql_db.sql_counter - loading_extra_query_count) # extra queries: testes, notify, any other closed cursor
  278. return loaded_modules, processed_modules
  279. def _check_module_names(cr, module_names):
  280. mod_names = set(module_names)
  281. if 'base' in mod_names:
  282. # ignore dummy 'all' module
  283. if 'all' in mod_names:
  284. mod_names.remove('all')
  285. if mod_names:
  286. cr.execute("SELECT count(id) AS count FROM ir_module_module WHERE name in %s", (tuple(mod_names),))
  287. if cr.dictfetchone()['count'] != len(mod_names):
  288. # find out what module name(s) are incorrect:
  289. cr.execute("SELECT name FROM ir_module_module")
  290. incorrect_names = mod_names.difference([x['name'] for x in cr.dictfetchall()])
  291. _logger.warning('invalid module names, ignored: %s', ", ".join(incorrect_names))
  292. def load_marked_modules(env, graph, states, force, progressdict, report,
  293. loaded_modules, perform_checks, models_to_check=None):
  294. """Loads modules marked with ``states``, adding them to ``graph`` and
  295. ``loaded_modules`` and returns a list of installed/upgraded modules."""
  296. if models_to_check is None:
  297. models_to_check = set()
  298. processed_modules = []
  299. while True:
  300. env.cr.execute("SELECT name from ir_module_module WHERE state IN %s", (tuple(states),))
  301. module_list = [name for (name,) in env.cr.fetchall() if name not in graph]
  302. if not module_list:
  303. break
  304. graph.add_modules(env.cr, module_list, force)
  305. _logger.debug('Updating graph with %d more modules', len(module_list))
  306. loaded, processed = load_module_graph(
  307. env, graph, progressdict, report=report, skip_modules=loaded_modules,
  308. perform_checks=perform_checks, models_to_check=models_to_check
  309. )
  310. processed_modules.extend(processed)
  311. loaded_modules.extend(loaded)
  312. if not processed:
  313. break
  314. return processed_modules
  315. def load_modules(registry, force_demo=False, status=None, update_module=False):
  316. """ Load the modules for a registry object that has just been created. This
  317. function is part of Registry.new() and should not be used anywhere else.
  318. """
  319. initialize_sys_path()
  320. force = []
  321. if force_demo:
  322. force.append('demo')
  323. models_to_check = set()
  324. with registry.cursor() as cr:
  325. # prevent endless wait for locks on schema changes (during online
  326. # installs) if a concurrent transaction has accessed the table;
  327. # connection settings are automatically reset when the connection is
  328. # borrowed from the pool
  329. cr.execute("SET SESSION lock_timeout = '15s'")
  330. if not odoo.modules.db.is_initialized(cr):
  331. if not update_module:
  332. _logger.error("Database %s not initialized, you can force it with `-i base`", cr.dbname)
  333. return
  334. _logger.info("init db")
  335. odoo.modules.db.initialize(cr)
  336. update_module = True # process auto-installed modules
  337. tools.config["init"]["all"] = 1
  338. if not tools.config['without_demo']:
  339. tools.config["demo"]['all'] = 1
  340. if 'base' in tools.config['update'] or 'all' in tools.config['update']:
  341. cr.execute("update ir_module_module set state=%s where name=%s and state=%s", ('to upgrade', 'base', 'installed'))
  342. # STEP 1: LOAD BASE (must be done before module dependencies can be computed for later steps)
  343. graph = odoo.modules.graph.Graph()
  344. graph.add_module(cr, 'base', force)
  345. if not graph:
  346. _logger.critical('module base cannot be loaded! (hint: verify addons-path)')
  347. raise ImportError('Module `base` cannot be loaded! (hint: verify addons-path)')
  348. if update_module and odoo.tools.sql.table_exists(cr, 'ir_model_fields'):
  349. # determine the fields which are currently translated in the database
  350. cr.execute("SELECT model || '.' || name FROM ir_model_fields WHERE translate IS TRUE")
  351. registry._database_translated_fields = {row[0] for row in cr.fetchall()}
  352. # processed_modules: for cleanup step after install
  353. # loaded_modules: to avoid double loading
  354. report = registry._assertion_report
  355. env = api.Environment(cr, SUPERUSER_ID, {})
  356. loaded_modules, processed_modules = load_module_graph(
  357. env, graph, status, perform_checks=update_module,
  358. report=report, models_to_check=models_to_check)
  359. load_lang = tools.config.pop('load_language')
  360. if load_lang or update_module:
  361. # some base models are used below, so make sure they are set up
  362. registry.setup_models(cr)
  363. if load_lang:
  364. for lang in load_lang.split(','):
  365. tools.translate.load_language(cr, lang)
  366. # STEP 2: Mark other modules to be loaded/updated
  367. if update_module:
  368. Module = env['ir.module.module']
  369. _logger.info('updating modules list')
  370. Module.update_list()
  371. _check_module_names(cr, itertools.chain(tools.config['init'], tools.config['update']))
  372. module_names = [k for k, v in tools.config['init'].items() if v]
  373. if module_names:
  374. modules = Module.search([('state', '=', 'uninstalled'), ('name', 'in', module_names)])
  375. if modules:
  376. modules.button_install()
  377. module_names = [k for k, v in tools.config['update'].items() if v]
  378. if module_names:
  379. modules = Module.search([('state', 'in', ('installed', 'to upgrade')), ('name', 'in', module_names)])
  380. if modules:
  381. modules.button_upgrade()
  382. env.flush_all()
  383. cr.execute("update ir_module_module set state=%s where name=%s", ('installed', 'base'))
  384. Module.invalidate_model(['state'])
  385. # STEP 3: Load marked modules (skipping base which was done in STEP 1)
  386. # IMPORTANT: this is done in two parts, first loading all installed or
  387. # partially installed modules (i.e. installed/to upgrade), to
  388. # offer a consistent system to the second part: installing
  389. # newly selected modules.
  390. # We include the modules 'to remove' in the first step, because
  391. # they are part of the "currently installed" modules. They will
  392. # be dropped in STEP 6 later, before restarting the loading
  393. # process.
  394. # IMPORTANT 2: We have to loop here until all relevant modules have been
  395. # processed, because in some rare cases the dependencies have
  396. # changed, and modules that depend on an uninstalled module
  397. # will not be processed on the first pass.
  398. # It's especially useful for migrations.
  399. previously_processed = -1
  400. while previously_processed < len(processed_modules):
  401. previously_processed = len(processed_modules)
  402. processed_modules += load_marked_modules(env, graph,
  403. ['installed', 'to upgrade', 'to remove'],
  404. force, status, report, loaded_modules, update_module, models_to_check)
  405. if update_module:
  406. processed_modules += load_marked_modules(env, graph,
  407. ['to install'], force, status, report,
  408. loaded_modules, update_module, models_to_check)
  409. if update_module:
  410. # set up the registry without the patch for translated fields
  411. database_translated_fields = registry._database_translated_fields
  412. registry._database_translated_fields = ()
  413. registry.setup_models(cr)
  414. # determine which translated fields should no longer be translated,
  415. # and make their model fix the database schema
  416. models_to_untranslate = set()
  417. for full_name in database_translated_fields:
  418. model_name, field_name = full_name.rsplit('.', 1)
  419. if model_name in registry:
  420. field = registry[model_name]._fields.get(field_name)
  421. if field and not field.translate:
  422. _logger.debug("Making field %s non-translated", field)
  423. models_to_untranslate.add(model_name)
  424. registry.init_models(cr, list(models_to_untranslate), {'models_to_check': True})
  425. registry.loaded = True
  426. registry.setup_models(cr)
  427. # check that all installed modules have been loaded by the registry
  428. Module = env['ir.module.module']
  429. modules = Module.search_fetch(Module._get_modules_to_load_domain(), ['name'], order='name')
  430. missing = [name for name in modules.mapped('name') if name not in graph]
  431. if missing:
  432. _logger.error("Some modules are not loaded, some dependencies or manifest may be missing: %s", missing)
  433. # STEP 3.5: execute migration end-scripts
  434. migrations = odoo.modules.migration.MigrationManager(cr, graph)
  435. for package in graph:
  436. migrations.migrate_module(package, 'end')
  437. # check that new module dependencies have been properly installed after a migration/upgrade
  438. cr.execute("SELECT name from ir_module_module WHERE state IN ('to install', 'to upgrade')")
  439. module_list = [name for (name,) in cr.fetchall()]
  440. if module_list:
  441. _logger.error("Some modules have inconsistent states, some dependencies may be missing: %s", sorted(module_list))
  442. # STEP 3.6: apply remaining constraints in case of an upgrade
  443. registry.finalize_constraints()
  444. # STEP 4: Finish and cleanup installations
  445. if processed_modules:
  446. cr.execute("SELECT model from ir_model")
  447. for (model,) in cr.fetchall():
  448. if model in registry:
  449. env[model]._check_removed_columns(log=True)
  450. elif _logger.isEnabledFor(logging.INFO): # more an info that a warning...
  451. _logger.runbot("Model %s is declared but cannot be loaded! (Perhaps a module was partially removed or renamed)", model)
  452. # Cleanup orphan records
  453. env['ir.model.data']._process_end(processed_modules)
  454. env.flush_all()
  455. for kind in ('init', 'demo', 'update'):
  456. tools.config[kind] = {}
  457. # STEP 5: Uninstall modules to remove
  458. if update_module:
  459. # Remove records referenced from ir_model_data for modules to be
  460. # removed (and removed the references from ir_model_data).
  461. cr.execute("SELECT name, id FROM ir_module_module WHERE state=%s", ('to remove',))
  462. modules_to_remove = dict(cr.fetchall())
  463. if modules_to_remove:
  464. pkgs = reversed([p for p in graph if p.name in modules_to_remove])
  465. for pkg in pkgs:
  466. uninstall_hook = pkg.info.get('uninstall_hook')
  467. if uninstall_hook:
  468. py_module = sys.modules['odoo.addons.%s' % (pkg.name,)]
  469. getattr(py_module, uninstall_hook)(env)
  470. env.flush_all()
  471. Module = env['ir.module.module']
  472. Module.browse(modules_to_remove.values()).module_uninstall()
  473. # Recursive reload, should only happen once, because there should be no
  474. # modules to remove next time
  475. cr.commit()
  476. _logger.info('Reloading registry once more after uninstalling modules')
  477. registry = odoo.modules.registry.Registry.new(
  478. cr.dbname, force_demo, status, update_module
  479. )
  480. cr.reset()
  481. registry.check_tables_exist(cr)
  482. cr.commit()
  483. return registry
  484. # STEP 5.5: Verify extended fields on every model
  485. # This will fix the schema of all models in a situation such as:
  486. # - module A is loaded and defines model M;
  487. # - module B is installed/upgraded and extends model M;
  488. # - module C is loaded and extends model M;
  489. # - module B and C depend on A but not on each other;
  490. # The changes introduced by module C are not taken into account by the upgrade of B.
  491. if models_to_check:
  492. registry.init_models(cr, list(models_to_check), {'models_to_check': True})
  493. # STEP 6: verify custom views on every model
  494. if update_module:
  495. env['res.groups']._update_user_groups_view()
  496. View = env['ir.ui.view']
  497. for model in registry:
  498. try:
  499. View._validate_custom_views(model)
  500. except Exception as e:
  501. _logger.warning('invalid custom view(s) for model %s: %s', model, e)
  502. if not registry._assertion_report or registry._assertion_report.wasSuccessful():
  503. _logger.info('Modules loaded.')
  504. else:
  505. _logger.error('At least one test failed when loading the modules.')
  506. # STEP 8: save installed/updated modules for post-install tests and _register_hook
  507. registry.updated_modules += processed_modules
  508. # STEP 9: call _register_hook on every model
  509. # This is done *exactly once* when the registry is being loaded. See the
  510. # management of those hooks in `Registry.setup_models`: all the calls to
  511. # setup_models() done here do not mess up with hooks, as registry.ready
  512. # is False.
  513. for model in env.values():
  514. model._register_hook()
  515. env.flush_all()
  516. def reset_modules_state(db_name):
  517. """
  518. Resets modules flagged as "to x" to their original state
  519. """
  520. # Warning, this function was introduced in response to commit 763d714
  521. # which locks cron jobs for dbs which have modules marked as 'to %'.
  522. # The goal of this function is to be called ONLY when module
  523. # installation/upgrade/uninstallation fails, which is the only known case
  524. # for which modules can stay marked as 'to %' for an indefinite amount
  525. # of time
  526. db = odoo.sql_db.db_connect(db_name)
  527. with db.cursor() as cr:
  528. cr.execute("SELECT 1 FROM information_schema.tables WHERE table_name='ir_module_module'")
  529. if not cr.fetchall():
  530. _logger.info('skipping reset_modules_state, ir_module_module table does not exists')
  531. return
  532. cr.execute(
  533. "UPDATE ir_module_module SET state='installed' WHERE state IN ('to remove', 'to upgrade')"
  534. )
  535. cr.execute(
  536. "UPDATE ir_module_module SET state='uninstalled' WHERE state='to install'"
  537. )
  538. _logger.warning("Transient module states were reset")
上海开阖软件有限公司 沪ICP备12045867号-1