[IMP] Remove automatic analyse at installation and update
Analyse can take some time and a cron task can do it every day if needed, no need to recompute it in real timepull/2608/head
parent
8adb4c0f94
commit
e4e22e080e
|
@ -1,2 +1 @@
|
|||
from . import models
|
||||
from .post_init_hook import analyse_installed_modules
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
"data": [
|
||||
"security/ir.model.access.csv",
|
||||
"views/menu.xml",
|
||||
"views/view_base_module_update.xml",
|
||||
"views/view_ir_module_author.xml",
|
||||
"views/view_ir_module_type.xml",
|
||||
"views/view_ir_module_type_rule.xml",
|
||||
|
@ -28,6 +27,5 @@
|
|||
"external_dependencies": {
|
||||
"python": ["pygount"],
|
||||
},
|
||||
"post_init_hook": "analyse_installed_modules",
|
||||
"installable": True,
|
||||
}
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
from . import base_module_update
|
||||
from . import ir_module_author
|
||||
from . import ir_module_module
|
||||
from . import ir_module_type
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
# Copyright (C) 2019-Today: GRAP (<http://www.grap.coop/>)
|
||||
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
class BaseModuleUpdate(models.TransientModel):
|
||||
_inherit = "base.module.update"
|
||||
|
||||
analyse_installed_modules = fields.Boolean(default=True)
|
||||
|
||||
def update_module(self):
|
||||
return super(
|
||||
BaseModuleUpdate,
|
||||
self.with_context(analyse_installed_modules=self.analyse_installed_modules),
|
||||
).update_module()
|
|
@ -74,14 +74,6 @@ class IrModuleModule(models.Model):
|
|||
def _get_module_encoding(self, file_ext):
|
||||
return "utf-8"
|
||||
|
||||
# Overload Section
|
||||
@api.model
|
||||
def update_list(self):
|
||||
res = super().update_list()
|
||||
if self.env.context.get("analyse_installed_modules", False):
|
||||
self.search([("state", "=", "installed")])._analyse_code()
|
||||
return res
|
||||
|
||||
def write(self, vals):
|
||||
res = super().write(vals)
|
||||
if vals.get("state", False) == "uninstalled" and "module_analysis" not in [
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
# Copyright (C) 2019-Today: GRAP (<http://www.grap.coop/>)
|
||||
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from odoo import SUPERUSER_ID, api
|
||||
|
||||
|
||||
def analyse_installed_modules(cr, registry):
|
||||
with api.Environment.manage():
|
||||
env = api.Environment(cr, SUPERUSER_ID, {})
|
||||
installed_modules = env["ir.module.module"].search(
|
||||
["|", ("state", "=", "installed"), ("name", "=", "module_analysis")]
|
||||
)
|
||||
installed_modules.button_analyse_code()
|
|
@ -1,17 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<!--
|
||||
Copyright (C) 2019-Today: GRAP (<http://www.grap.coop/>)
|
||||
@author: Sylvain LE GAL (https://twitter.com/legalsylvain)
|
||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
-->
|
||||
<odoo>
|
||||
<record id="view_base_module_update_form" model="ir.ui.view">
|
||||
<field name="model">base.module.update</field>
|
||||
<field name="inherit_id" ref="base.view_base_module_update" />
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr='//group[@states="init"]' position="inside">
|
||||
<field name="analyse_installed_modules" />
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
Loading…
Reference in New Issue