43 lines
1.1 KiB
Python
43 lines
1.1 KiB
Python
# -*- coding: utf-8 -*-
|
|
|
|
# Created on 2018-10-12
|
|
# author: NextERP
|
|
# email: 300883@qq.com
|
|
# resource of NextERP
|
|
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
|
|
|
|
# Documentation: https://www.odoo.com/documentation/18.0
|
|
# description:
|
|
|
|
from odoo import api, SUPERUSER_ID, _
|
|
|
|
|
|
def pre_init_hook(env):
|
|
try:
|
|
# Updated Enterprise Edition Points
|
|
sql = "UPDATE ir_module_module SET website = '%s' WHERE license like '%s' and website <> ''" % ('https://www.odoo.com', 'OEEL%')
|
|
env.cr.execute(sql)
|
|
env.cr.commit()
|
|
except Exception as e:
|
|
pass
|
|
|
|
def post_init_hook(env):
|
|
# a = check_module_installed(cr, ['app_web_superbar','aaaaa'])
|
|
pass
|
|
# cr.execute("")
|
|
|
|
def uninstall_hook(env):
|
|
"""
|
|
Data initialization, execution during uninstallation
|
|
"""
|
|
pass
|
|
|
|
def check_module_installed(env, modules):
|
|
# modules input parameter is a list, such as ['base', 'sale']
|
|
installed = False
|
|
m = env['ir.module.module'].sudo().search([('name', 'in', modules), ('state', 'in', ['installed', 'to install', 'to upgrade'])])
|
|
if len(m) == len(modules):
|
|
installed = True
|
|
return installed
|
|
|