[FIX] website_theme_install, *: multi-website customization dialog
* theme_bootswatch, theme_default Before this commit, the customization dialog for themes was not multi-website. That means if a theme was installed on a website, the customization dialog was enabled for all the websites. Note: this commit uses the '_post_copy' system of theme installations for the first time and it had to be adapted a little bit.
This commit is contained in:
@@ -1,2 +1,3 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
from . import models
|
||||
|
||||
@@ -9,8 +9,4 @@
|
||||
<field name="action_id" ref="action_website"/>
|
||||
<field name="state">open</field>
|
||||
</record>
|
||||
|
||||
<record id="website_theme_install.customize_modal" model="ir.ui.view">
|
||||
<field name="active" eval="False"/>
|
||||
</record>
|
||||
</odoo>
|
||||
</odoo>
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
from . import theme_bootswatch
|
||||
@@ -0,0 +1,7 @@
|
||||
from odoo import models
|
||||
|
||||
class ThemeBootswatch(models.AbstractModel):
|
||||
_inherit = 'theme.utils'
|
||||
|
||||
def _theme_bootswatch_post_copy(self, mod):
|
||||
self.env.ref('website_theme_install.customize_modal').write({'active': False});
|
||||
@@ -1,2 +1,3 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
from . import models
|
||||
|
||||
@@ -9,8 +9,4 @@
|
||||
<field name="action_id" ref="action_website"/>
|
||||
<field name="state">open</field>
|
||||
</record>
|
||||
|
||||
<record id="website_theme_install.customize_modal" model="ir.ui.view">
|
||||
<field name="active" eval="False"/>
|
||||
</record>
|
||||
</odoo>
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
from . import theme_default
|
||||
@@ -0,0 +1,7 @@
|
||||
from odoo import models
|
||||
|
||||
class ThemeDefault(models.AbstractModel):
|
||||
_inherit = 'theme.utils'
|
||||
|
||||
def _theme_default_post_copy(self, mod):
|
||||
self.env.ref('website_theme_install.customize_modal').write({'active': False});
|
||||
@@ -63,11 +63,12 @@ class Theme(models.AbstractModel):
|
||||
_auto = False
|
||||
|
||||
def _post_copy(self, mod):
|
||||
website = self.env['website'].get_current_website()
|
||||
theme_post_copy = '_%s_post_copy' % mod.name
|
||||
if hasattr(self, theme_post_copy):
|
||||
_logger.info('Executing method %s' % theme_post_copy)
|
||||
method = getattr(self, theme_post_copy)
|
||||
return method()
|
||||
method = getattr(self.with_context(website_id=website.id), theme_post_copy)
|
||||
return method(mod)
|
||||
|
||||
|
||||
class IrUiView(models.Model):
|
||||
|
||||
Reference in New Issue
Block a user