Files
odoo_source/odoo/addons/test_main_flows/__init__.py
T
Adrien Dieudonne 15e1b2a469 [FIX] test_main_flows: automatic install of account_accountant
'account_accountant' is only defined in enterprise.
Before this commit, many of us forgot to manually install it
before running main_flow_tour in enterprise.
Plus, it was difficult to know that a required module is missing
when a step failed. The error was not clear.

Now, the post hook will check if this module exist (it's the case in
enterprise) and will install it.
2018-09-10 14:48:47 +02:00

18 lines
752 B
Python

# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, SUPERUSER_ID
#
# Conditional installation of enterprise modules.
#
# This module is defined in community but some steps (defined with 'edition: "enterprise"')
# are only used to test enterprise. As it's not possible to direcly add enterprise
# modules dependencies, this post install hook will install account_accountant if exists.
#
def _auto_install_enterprise_dependencies(cr, registry):
env = api.Environment(cr, SUPERUSER_ID, {})
module_list = ['account_accountant']
module_ids = env['ir.module.module'].search([('name', 'in', module_list), ('state', '=', 'uninstalled')])
module_ids.sudo().button_install()