Browse Source

Apply suggestions from code review

Co-Authored-By: David Beal <david.beal@akretion.com>
12.0
Sylvain LE GAL 5 years ago
committed by OCA-git-bot
parent
commit
df9c6cb727
  1. 2
      module_analysis/README.rst
  2. 7
      module_analysis/models/ir_module_module.py

2
module_analysis/README.rst

@ -106,7 +106,7 @@ files), create a custom modules and overload the module model :
@api.model @api.model
def _get_analyse_settings(self): def _get_analyse_settings(self):
res = super(IrModuleModule, self)._get_analyse_settings()
res = super()._get_analyse_settings()
if not '.html' in res: if not '.html' in res:
res['.html'] = {} res['.html'] = {}
res['.html']['documentation'] 'xml_documentation_qty' res['.html']['documentation'] 'xml_documentation_qty'

7
module_analysis/models/ir_module_module.py

@ -3,12 +3,9 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
import os import os
# import json
import pygount import pygount
from pathlib import Path from pathlib import Path
import logging import logging
# import os
# import subprocess
from odoo import api, fields, models from odoo import api, fields, models
from odoo.tools.safe_eval import safe_eval from odoo.tools.safe_eval import safe_eval
@ -83,14 +80,14 @@ class IrModuleModule(models.Model):
# Overload Section # Overload Section
@api.model @api.model
def update_list(self): def update_list(self):
res = super(IrModuleModule, self).update_list()
res = super().update_list()
if self.env.context.get('analyse_installed_modules', False): if self.env.context.get('analyse_installed_modules', False):
self.search([('state', '=', 'installed')]).button_analyse_code() self.search([('state', '=', 'installed')]).button_analyse_code()
return res return res
@api.multi @api.multi
def write(self, vals): def write(self, vals):
res = super(IrModuleModule, self).write(vals)
res = super().write(vals)
if vals.get('state', False) == 'installed': if vals.get('state', False) == 'installed':
self.button_analyse_code() self.button_analyse_code()
elif vals.get('state', False) == 'uninstalled'\ elif vals.get('state', False) == 'uninstalled'\

Loading…
Cancel
Save