From 02f726272d4c01babeb66e9567a2e3c122161c0f Mon Sep 17 00:00:00 2001 From: MuK IT GmbH Date: Thu, 20 Dec 2018 01:18:13 +0000 Subject: [PATCH] publish muk_web_theme - 12.0 --- muk_web_theme/__manifest__.py | 2 +- muk_web_theme/models/res_config_settings.py | 38 ++++++--------------- 2 files changed, 12 insertions(+), 28 deletions(-) diff --git a/muk_web_theme/__manifest__.py b/muk_web_theme/__manifest__.py index e2e7a5a..29c363b 100644 --- a/muk_web_theme/__manifest__.py +++ b/muk_web_theme/__manifest__.py @@ -19,7 +19,7 @@ { "name": "MuK Backend Theme", "summary": "Odoo 12.0 community backend theme", - "version": "12.0.1.1.14", + "version": "12.0.1.1.15", "category": "Themes/Backend", "license": "AGPL-3", "author": "MuK IT", diff --git a/muk_web_theme/models/res_config_settings.py b/muk_web_theme/models/res_config_settings.py index 6f0100f..0a69315 100644 --- a/muk_web_theme/models/res_config_settings.py +++ b/muk_web_theme/models/res_config_settings.py @@ -26,14 +26,6 @@ from odoo import api, fields, models XML_ID = "muk_web_theme._assets_primary_variables" SCSS_URL = "/muk_web_theme/static/src/scss/colors.scss" -TEMPLATE = """ - $o-brand-odoo: {0}; - $o-brand-primary: {1}; - - $mk-brand-gradient-start: lighten($o-brand-odoo, 10%); - $mk-brand-gradient-end: lighten($o-brand-odoo, 20%); -""" - class ResConfigSettings(models.TransientModel): _inherit = 'res.config.settings' @@ -52,31 +44,23 @@ class ResConfigSettings(models.TransientModel): @api.multi def set_values(self): res = super(ResConfigSettings, self).set_values() - self._save_scss_values() + variables = [ + {'name': 'o-brand-odoo', 'value': self.theme_color_brand or "#243742"}, + {'name': 'o-brand-primary', 'value': self.theme_color_primary or "#5D8DA8"}, + ] + self.env['muk_utils.scss_editor'].replace_values( + SCSS_URL, XML_ID, variables + ) return res @api.model def get_values(self): res = super(ResConfigSettings, self).get_values() - res.update(self._get_scss_values()) - return res - - def _get_scss_values(self): - colors = self.env['muk_utils.scss_editor'].get_value( + colors = self.env['muk_utils.scss_editor'].get_values( SCSS_URL, XML_ID, ['o-brand-odoo', 'o-brand-primary'] ) - return { + res.update({ 'theme_color_brand': colors['o-brand-odoo'], 'theme_color_primary': colors['o-brand-primary'], - } - - def _build_custom_scss_template(self): - return TEMPLATE.format( - self.theme_color_brand or "#243742", - self.theme_color_primary or "#5D8DA8" - ) - - def _save_scss_values(self): - self.env['muk_utils.scss_editor'].replace_content( - SCSS_URL, XML_ID, self._build_custom_scss_template() - ) \ No newline at end of file + }) + return res \ No newline at end of file