Skip to content
Permalink
Browse files

make `_theme_upgrade_upstream` implicitly install the theme

  • Loading branch information...
rco-odoo committed Oct 9, 2019
1 parent 3e0ba47 commit 3d00d65f74a8c5128937297a43b20df4ec6a4458
Showing with 10 additions and 11 deletions.
  1. +10 −11 addons/website_theme_install/models/ir_module_module.py
@@ -305,13 +305,15 @@ def _theme_get_stream_website_ids(self):
return websites

def _theme_upgrade_upstream(self):
""" Upgrade the upstream dependencies of a theme. """
self._button_immediate_function(type(self)._theme_prepare_upgrade_upstream)
""" Upgrade the upstream dependencies of a theme, and install it if necessary. """
def upgrade(theme):
themes = theme + theme._theme_get_upstream()
themes_to_upgrade = themes.filtered(lambda m: m.state == 'installed')
themes_to_upgrade.button_upgrade()
# this has no effect if theme is already installed
theme.button_install()

def _theme_prepare_upgrade_upstream(self):
themes = self + self._theme_get_upstream()
themes_to_upgrade = themes.filtered(lambda m: m.state == 'installed')
themes_to_upgrade.button_upgrade()
self._button_immediate_function(upgrade)

@api.model
def _theme_remove(self, website):
@@ -349,11 +351,8 @@ def button_choose_theme(self):
# website.theme_id must be set before upgrade/install to trigger the load in ``write``
website.theme_id = self

def install_or_upgrade(theme):
theme._theme_prepare_upgrade_upstream()
theme.button_install()

self._button_immediate_function(install_or_upgrade)
# this will install 'self' if it is not installed yet
self._theme_upgrade_upstream()

return website.button_go_website()

0 comments on commit 3d00d65

Please sign in to comment.
You can’t perform that action at this time.