|
@ -41,18 +41,28 @@ class ResConfigSettings(models.TransientModel): |
|
|
theme_color_primary = fields.Char( |
|
|
theme_color_primary = fields.Char( |
|
|
string="Theme Primary Color") |
|
|
string="Theme Primary Color") |
|
|
|
|
|
|
|
|
|
|
|
theme_color_appbar = fields.Char( |
|
|
|
|
|
string="Theme AppBar Color") |
|
|
|
|
|
|
|
|
@api.multi |
|
|
@api.multi |
|
|
def set_values(self): |
|
|
def set_values(self): |
|
|
res = super(ResConfigSettings, self).set_values() |
|
|
res = super(ResConfigSettings, self).set_values() |
|
|
|
|
|
variables = [ |
|
|
|
|
|
'o-brand-odoo', |
|
|
|
|
|
'o-brand-primary', |
|
|
|
|
|
'mk-appbar-background' |
|
|
|
|
|
] |
|
|
colors = self.env['muk_utils.scss_editor'].get_values( |
|
|
colors = self.env['muk_utils.scss_editor'].get_values( |
|
|
SCSS_URL, XML_ID, ['o-brand-odoo', 'o-brand-primary'] |
|
|
|
|
|
|
|
|
SCSS_URL, XML_ID, variables |
|
|
) |
|
|
) |
|
|
brand_changed = self.theme_color_brand != colors['o-brand-odoo'] |
|
|
brand_changed = self.theme_color_brand != colors['o-brand-odoo'] |
|
|
primary_changed = self.theme_color_primary != colors['o-brand-primary'] |
|
|
primary_changed = self.theme_color_primary != colors['o-brand-primary'] |
|
|
if(brand_changed or primary_changed): |
|
|
|
|
|
|
|
|
appbar_changed = self.theme_color_appbar != colors['mk-appbar-background'] |
|
|
|
|
|
if(brand_changed or primary_changed or appbar_changed): |
|
|
variables = [ |
|
|
variables = [ |
|
|
{'name': 'o-brand-odoo', 'value': self.theme_color_brand or "#243742"}, |
|
|
{'name': 'o-brand-odoo', 'value': self.theme_color_brand or "#243742"}, |
|
|
{'name': 'o-brand-primary', 'value': self.theme_color_primary or "#5D8DA8"}, |
|
|
{'name': 'o-brand-primary', 'value': self.theme_color_primary or "#5D8DA8"}, |
|
|
|
|
|
{'name': 'mk-appbar-background', 'value': self.theme_color_appbar or "#000000"}, |
|
|
] |
|
|
] |
|
|
self.env['muk_utils.scss_editor'].replace_values( |
|
|
self.env['muk_utils.scss_editor'].replace_values( |
|
|
SCSS_URL, XML_ID, variables |
|
|
SCSS_URL, XML_ID, variables |
|
@ -62,11 +72,17 @@ class ResConfigSettings(models.TransientModel): |
|
|
@api.model |
|
|
@api.model |
|
|
def get_values(self): |
|
|
def get_values(self): |
|
|
res = super(ResConfigSettings, self).get_values() |
|
|
res = super(ResConfigSettings, self).get_values() |
|
|
|
|
|
variables = [ |
|
|
|
|
|
'o-brand-odoo', |
|
|
|
|
|
'o-brand-primary', |
|
|
|
|
|
'mk-appbar-background' |
|
|
|
|
|
] |
|
|
colors = self.env['muk_utils.scss_editor'].get_values( |
|
|
colors = self.env['muk_utils.scss_editor'].get_values( |
|
|
SCSS_URL, XML_ID, ['o-brand-odoo', 'o-brand-primary'] |
|
|
|
|
|
|
|
|
SCSS_URL, XML_ID, variables |
|
|
) |
|
|
) |
|
|
res.update({ |
|
|
res.update({ |
|
|
'theme_color_brand': colors['o-brand-odoo'], |
|
|
'theme_color_brand': colors['o-brand-odoo'], |
|
|
'theme_color_primary': colors['o-brand-primary'], |
|
|
'theme_color_primary': colors['o-brand-primary'], |
|
|
|
|
|
'theme_color_appbar': colors['mk-appbar-background'], |
|
|
}) |
|
|
}) |
|
|
return res |
|
|
return res |