mirror of
https://github.com/guohuadeng/app-odoo.git
synced 2025-02-23 04:11:36 +02:00
yan release 2020.02.25
This commit is contained in:
@@ -3,5 +3,5 @@
|
||||
from . import res_config_settings
|
||||
from . import ir_ui_view
|
||||
from . import base_language_install
|
||||
from . import models
|
||||
from . import ir_module_module
|
||||
# from . import ir_ui_menu
|
||||
|
||||
34
app_odoo_customize/models/ir_module_module.py
Normal file
34
app_odoo_customize/models/ir_module_module.py
Normal file
@@ -0,0 +1,34 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from odoo import api, fields, models, modules, tools, _
|
||||
|
||||
import operator
|
||||
|
||||
class IrModule(models.Model):
|
||||
_inherit = 'ir.module.module'
|
||||
|
||||
# attention: Incorrect field names !!
|
||||
# installed_version refers the latest version (the one on disk)
|
||||
# latest_version refers the installed version (the one in database)
|
||||
# published_version refers the version available on the repository
|
||||
# installed_version = fields.Char('Latest Version', compute='_get_latest_version')
|
||||
# latest_version = fields.Char('Installed Version', readonly=True)
|
||||
|
||||
local_updatable = fields.Boolean('Local updatable', compute='_get_latest_version', default=False, store=True)
|
||||
|
||||
def module_multi_uninstall(self):
|
||||
""" Perform the various steps required to uninstall a module completely
|
||||
including the deletion of all database structures created by the module:
|
||||
tables, columns, constraints, etc.
|
||||
"""
|
||||
modules = self.browse(self.env.context.get('active_ids'))
|
||||
[module.button_immediate_uninstall() for module in modules if module not in ['base', 'web']]
|
||||
|
||||
|
||||
@api.depends('name')
|
||||
def _get_latest_version(self):
|
||||
super(IrModule, self)._get_latest_version()
|
||||
for rec in self:
|
||||
rec.local_updatable = False
|
||||
if rec.installed_version and rec.latest_version and operator.gt(rec.installed_version, rec.latest_version):
|
||||
rec.local_updatable = True
|
||||
@@ -1,16 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from odoo import models, fields, api
|
||||
|
||||
|
||||
class Module(models.Model):
|
||||
_inherit = 'ir.module.module'
|
||||
|
||||
def module_multi_uninstall(self):
|
||||
""" Perform the various steps required to uninstall a module completely
|
||||
including the deletion of all database structures created by the module:
|
||||
tables, columns, constraints, etc.
|
||||
"""
|
||||
modules = self.browse(self.env.context.get('active_ids'))
|
||||
[module.button_immediate_uninstall() for module in modules if module not in ['base', 'web']]
|
||||
|
||||
Reference in New Issue
Block a user