You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
1.1 KiB
34 lines
1.1 KiB
# -*- coding: utf-8 -*-
|
|
# Copyright 2017 LasLabs Inc.
|
|
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
|
|
|
|
from odoo import api, models
|
|
|
|
|
|
class ModuleUpgrade(models.TransientModel):
|
|
_inherit = 'base.module.upgrade'
|
|
|
|
@api.model
|
|
def get_module_list(self):
|
|
if not self.env.context.get('module_uninstall'):
|
|
Module = self.env["ir.module.module"]
|
|
installed_modules = Module.search([('state', '=', 'installed')])
|
|
upgradeable_modules = installed_modules.filtered(
|
|
lambda r: r.checksum_dir != r.checksum_installed,
|
|
)
|
|
upgradeable_modules.button_upgrade()
|
|
return super(ModuleUpgrade, self).get_module_list()
|
|
|
|
@api.multi
|
|
def upgrade_module_cancel(self):
|
|
return super(
|
|
ModuleUpgrade,
|
|
self.with_context(retain_checksum_installed=True),
|
|
).upgrade_module_cancel()
|
|
|
|
@api.multi
|
|
def upgrade_module(self):
|
|
# Compute updates by checksum when called in @api.model fashion
|
|
if not self:
|
|
self.get_module_list()
|
|
return super(ModuleUpgrade, self).upgrade_module()
|