Browse Source

publish muk_web_theme - 12.0

pull/115/head
MuK IT GmbH 6 years ago
parent
commit
943041863d
  1. 2
      muk_web_theme/__manifest__.py
  2. 11
      muk_web_theme/doc/changelog.rst
  3. 2
      muk_web_theme/models/__init__.py
  4. 21
      muk_web_theme/models/res_company.py
  5. 51
      muk_web_theme/models/res_config_settings.py
  6. 26
      muk_web_theme/models/res_users.py
  7. 4
      muk_web_theme/static/src/scss/apps.scss
  8. 6
      muk_web_theme/static/src/scss/appsbar.scss
  9. 3
      muk_web_theme/static/src/scss/colors.scss
  10. 54
      muk_web_theme/views/res_config_settings_view.xml

2
muk_web_theme/__manifest__.py

@ -19,7 +19,7 @@
{
"name": "MuK Backend Theme",
"summary": "Odoo Community Backend Theme",
"version": "12.0.1.2.15",
"version": "12.0.1.4.0",
"category": "Themes/Backend",
"license": "AGPL-3",
"author": "MuK IT",

11
muk_web_theme/doc/changelog.rst

@ -1,3 +1,14 @@
`1.3.0`
-------
- Default Preferences
`1.2.0`
-------
- Added Menu Color Options
`1.2.0`
-------

2
muk_web_theme/models/__init__.py

@ -17,6 +17,6 @@
#
###################################################################################
from . import res_users
from . import res_company
from . import res_users
from . import res_config_settings

21
muk_web_theme/models/res_company.py

@ -23,6 +23,27 @@ class ResCompany(models.Model):
_inherit = 'res.company'
#----------------------------------------------------------
# Database
#----------------------------------------------------------
background_image = fields.Binary(
string="Apps Menu Background Image",
attachment=True)
default_sidebar_preference = fields.Selection(
selection=[
('invisible', 'Invisible'),
('small', 'Small'),
('large', 'Large')
],
string="Sidebar Type",
default='small')
default_chatter_preference = fields.Selection(
selection=[
('normal', 'Normal'),
('sided', 'Sided'),
],
string="Chatter Position",
default='sided')

51
muk_web_theme/models/res_config_settings.py

@ -30,39 +30,68 @@ class ResConfigSettings(models.TransientModel):
_inherit = 'res.config.settings'
#----------------------------------------------------------
# Database
#----------------------------------------------------------
theme_background_image = fields.Binary(
related="company_id.background_image",
readonly=False,
required=True)
theme_default_sidebar_preference = fields.Selection(
related="company_id.default_sidebar_preference",
readonly=False)
theme_default_chatter_preference = fields.Selection(
related="company_id.default_chatter_preference",
readonly=False)
theme_color_brand = fields.Char(
string="Theme Brand Color")
theme_color_primary = fields.Char(
string="Theme Primary Color")
theme_color_appbar = fields.Char(
theme_color_menu = fields.Char(
string="Theme Menu Color")
theme_color_appbar_color = fields.Char(
string="Theme AppBar Color")
theme_color_appbar_background = fields.Char(
string="Theme AppBar Background")
#----------------------------------------------------------
# Functions
#----------------------------------------------------------
@api.multi
def set_values(self):
res = super(ResConfigSettings, self).set_values()
variables = [
'o-brand-odoo',
'o-brand-primary',
'mk-appbar-background'
'mk-apps-color',
'mk-appbar-color',
'mk-appbar-background',
]
colors = self.env['muk_utils.scss_editor'].get_values(
SCSS_URL, XML_ID, variables
)
brand_changed = self.theme_color_brand != colors['o-brand-odoo']
primary_changed = self.theme_color_primary != colors['o-brand-primary']
appbar_changed = self.theme_color_appbar != colors['mk-appbar-background']
if(brand_changed or primary_changed or appbar_changed):
colors_changed = []
colors_changed.append(self.theme_color_brand != colors['o-brand-odoo'])
colors_changed.append(self.theme_color_primary != colors['o-brand-primary'])
colors_changed.append(self.theme_color_menu != colors['mk-apps-color'])
colors_changed.append(self.theme_color_appbar_color != colors['mk-appbar-color'])
colors_changed.append(self.theme_color_appbar_background != colors['mk-appbar-background'])
if(any(colors_changed)):
variables = [
{'name': 'o-brand-odoo', 'value': self.theme_color_brand or "#243742"},
{'name': 'o-brand-primary', 'value': self.theme_color_primary or "#5D8DA8"},
{'name': 'mk-appbar-background', 'value': self.theme_color_appbar or "#000000"},
{'name': 'mk-apps-color', 'value': self.theme_color_menu or "#f8f9fa"},
{'name': 'mk-appbar-color', 'value': self.theme_color_appbar_color or "#dee2e6"},
{'name': 'mk-appbar-background', 'value': self.theme_color_appbar_background or "#000000"},
]
self.env['muk_utils.scss_editor'].replace_values(
SCSS_URL, XML_ID, variables
@ -75,7 +104,9 @@ class ResConfigSettings(models.TransientModel):
variables = [
'o-brand-odoo',
'o-brand-primary',
'mk-appbar-background'
'mk-apps-color',
'mk-appbar-color',
'mk-appbar-background',
]
colors = self.env['muk_utils.scss_editor'].get_values(
SCSS_URL, XML_ID, variables
@ -83,6 +114,8 @@ class ResConfigSettings(models.TransientModel):
res.update({
'theme_color_brand': colors['o-brand-odoo'],
'theme_color_primary': colors['o-brand-primary'],
'theme_color_appbar': colors['mk-appbar-background'],
'theme_color_menu': colors['mk-apps-color'],
'theme_color_appbar_color': colors['mk-appbar-color'],
'theme_color_appbar_background': colors['mk-appbar-background'],
})
return res

26
muk_web_theme/models/res_users.py

@ -17,30 +17,46 @@
#
###################################################################################
from odoo import models, fields
from odoo import models, fields, api
class ResUsers(models.Model):
_inherit = 'res.users'
#----------------------------------------------------------
# Defaults
#----------------------------------------------------------
@api.model
def _default_sidebar_type(self):
return self.env.user.company_id.default_sidebar_preference or 'small'
@api.model
def _default_chatter_position(self):
return self.env.user.company_id.default_chatter_preference or 'sided'
#----------------------------------------------------------
# Database
#----------------------------------------------------------
sidebar_type = fields.Selection(
selection=[
('invisible', 'Invisible'),
('small', 'Small'),
('large', 'Large')
],
required=True,
string="Sidebar Type",
default='small',
required=True)
default=lambda self: self._default_sidebar_type())
chatter_position = fields.Selection(
selection=[
('normal', 'Normal'),
('sided', 'Sided'),
],
required=True,
string="Chatter Position",
default='sided',
required=True)
default=lambda self: self._default_chatter_position())
def __init__(self, pool, cr):
init_res = super(ResUsers, self).__init__(pool, cr)

4
muk_web_theme/static/src/scss/apps.scss

@ -67,7 +67,7 @@
width: 100%;
}
.o-app-name {
color: $gray-100;
color: $mk-apps-color;
}
.form-row {
width: 100%;
@ -99,7 +99,7 @@
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
color: $gray-100;
color: $mk-apps-color;
&:hover, &:active, &.active {
background-color: rgba(255, 255, 255, 0.05);
}

6
muk_web_theme/static/src/scss/appsbar.scss

@ -41,12 +41,12 @@
display: block;
cursor: pointer;
font-size: 13px;
font-weight: 300;
overflow: hidden;
padding: 8px 11px;
position: relative;
text-decoration: none;
font-weight: 300;
color: gray('300');
overflow: hidden;
color: $mk-appbar-color;
text-overflow: ellipsis;
.mk_apps_sidebar_icon {
width: 22px;

3
muk_web_theme/static/src/scss/colors.scss

@ -24,6 +24,9 @@
$o-brand-odoo: #243742;
$o-brand-primary: #5D8DA8;
$mk-apps-color: #f8f9fa;
$mk-appbar-color: #dee2e6;
$mk-appbar-background: #000000;
$mk-brand-gradient-start: lighten($o-brand-odoo, 10%);

54
muk_web_theme/views/res_config_settings_view.xml

@ -27,6 +27,44 @@
<div id="business_documents" position="after">
<h2 id="web_theme_title">Backend Theme</h2>
<div class="row mt16 o_settings_container" name="web_theme">
<div class="col-12 col-lg-6 o_setting_box">
<div class="o_setting_left_pane">
</div>
<div class="o_setting_right_pane">
<span class="o_form_label">Default Preferences</span>
<div class="text-muted">
Set the default theme preferences
</div>
<div class="content-group">
<div class="mt16 row">
<label for="theme_default_sidebar_preference" string="Sidebar" class="col-3 o_light_label"/>
<field name="theme_default_sidebar_preference" class="col-5"/>
<div class="w-100"></div>
<label for="theme_default_chatter_preference" string="Chatter" class="col-3 o_light_label"/>
<field name="theme_default_chatter_preference" class="col-5"/>
</div>
</div>
</div>
</div>
<div class="col-12 col-lg-6 o_setting_box">
<div class="o_setting_left_pane">
</div>
<div class="o_setting_right_pane">
<span class="o_form_label">Theme Colors</span>
<div class="text-muted">
Set the main theme colors
</div>
<div class="content-group">
<div class="mt16 row">
<label for="theme_color_brand" string="Brand" class="col-3 o_light_label"/>
<field name="theme_color_brand" widget="color" class="oe_inline"/>
<div class="w-100"></div>
<label for="theme_color_primary" string="Primary" class="col-3 o_light_label"/>
<field name="theme_color_primary" widget="color" class="oe_inline"/>
</div>
</div>
</div>
</div>
<div class="col-12 col-lg-6 o_setting_box">
<div class="o_setting_left_pane">
</div>
@ -47,20 +85,20 @@
<div class="o_setting_left_pane">
</div>
<div class="o_setting_right_pane">
<span class="o_form_label">Theme Colors</span>
<span class="o_form_label">Menu Colors</span>
<div class="text-muted">
Set the main theme colors
Set the main menu colors
</div>
<div class="content-group">
<div class="mt16 row">
<label for="theme_color_brand" string="Brand" class="col-lg-3 o_light_label"/>
<field name="theme_color_brand" widget="color" class="oe_inline"/>
<label for="theme_color_menu" string="Menu" class="col-3 o_light_label"/>
<field name="theme_color_menu" widget="color" class="oe_inline"/>
<div class="w-100"></div>
<label for="theme_color_primary" string="Primary" class="col-lg-3 o_light_label"/>
<field name="theme_color_primary" widget="color" class="oe_inline"/>
<label for="theme_color_appbar_color" string="AppBar" class="col-3 o_light_label"/>
<field name="theme_color_appbar_color" widget="color" class="oe_inline"/>
<div class="w-100"></div>
<label for="theme_color_appbar" string="AppBar" class="col-lg-3 o_light_label"/>
<field name="theme_color_appbar" widget="color" class="oe_inline"/>
<label for="theme_color_appbar_background" string="AppBar" class="col-3 o_light_label"/>
<field name="theme_color_appbar_background" widget="color" class="oe_inline"/>
</div>
</div>
</div>

Loading…
Cancel
Save