parameters: (cr)
docstring: Forces the `demo` flag on all modules, and installs demo data for all installed modules.
docstring_summary: Forces the `demo` flag on all modules, and installs demo data for all installed modules.
docstring_tokens: Forces the demo flag on all modules and installs demo data for all installed modules .
function: def force_demo(cr):
      """
      Forces the `demo` flag on all modules, and installs demo data for all installed modules.
      """
      graph = odoo.modules.graph.Graph()
      cr.execute('UPDATE ir_module_module SET demo=True')
      cr.execute(
          "SELECT name FROM ir_module_module WHERE state IN ('installed', 'to upgrade', 'to remove')"
      )
      module_list = [name for (name,) in cr.fetchall()]
      graph.add_modules(cr, module_list, ['demo'])
  
      for package in graph:
          load_demo(cr, package, {}, 'init')
  
      env = api.Environment(cr, SUPERUSER_ID, {})
      env['ir.module.module'].invalidate_cache(['demo'])
      env['res.groups']._update_user_groups_view()
function_tokens: def force_demo ( cr ) : graph = odoo . modules . graph . Graph ( ) cr . execute ( 'UPDATE ir_module_module SET demo=True' ) cr . execute ( "SELECT name FROM ir_module_module WHERE state IN ('installed', 'to upgrade', 'to remove')" ) module_list = [ name for ( name , ) in cr . fetchall ( ) ] graph . add_modules ( cr , module_list , [ 'demo' ] ) for package in graph : load_demo ( cr , package , { } , 'init' ) env = api . Environment ( cr , SUPERUSER_ID , { } ) env [ 'ir.module.module' ] . invalidate_cache ( [ 'demo' ] ) env [ 'res.groups' ] . _update_user_groups_view ( )