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", "name": "MuK Backend Theme",
"summary": "Odoo Community Backend Theme", "summary": "Odoo Community Backend Theme",
"version": "12.0.1.2.15",
"version": "12.0.1.4.0",
"category": "Themes/Backend", "category": "Themes/Backend",
"license": "AGPL-3", "license": "AGPL-3",
"author": "MuK IT", "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` `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_company
from . import res_users
from . import res_config_settings from . import res_config_settings

21
muk_web_theme/models/res_company.py

@ -23,6 +23,27 @@ class ResCompany(models.Model):
_inherit = 'res.company' _inherit = 'res.company'
#----------------------------------------------------------
# Database
#----------------------------------------------------------
background_image = fields.Binary( background_image = fields.Binary(
string="Apps Menu Background Image", string="Apps Menu Background Image",
attachment=True) 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' _inherit = 'res.config.settings'
#----------------------------------------------------------
# Database
#----------------------------------------------------------
theme_background_image = fields.Binary( theme_background_image = fields.Binary(
related="company_id.background_image", related="company_id.background_image",
readonly=False, readonly=False,
required=True) 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( theme_color_brand = fields.Char(
string="Theme Brand Color") string="Theme Brand Color")
theme_color_primary = fields.Char( theme_color_primary = fields.Char(
string="Theme Primary Color") 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") string="Theme AppBar Color")
theme_color_appbar_background = fields.Char(
string="Theme AppBar Background")
#----------------------------------------------------------
# Functions
#----------------------------------------------------------
@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 = [ variables = [
'o-brand-odoo', 'o-brand-odoo',
'o-brand-primary', 'o-brand-primary',
'mk-appbar-background'
'mk-apps-color',
'mk-appbar-color',
'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, variables 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 = [ 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"},
{'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( self.env['muk_utils.scss_editor'].replace_values(
SCSS_URL, XML_ID, variables SCSS_URL, XML_ID, variables
@ -75,7 +104,9 @@ class ResConfigSettings(models.TransientModel):
variables = [ variables = [
'o-brand-odoo', 'o-brand-odoo',
'o-brand-primary', 'o-brand-primary',
'mk-appbar-background'
'mk-apps-color',
'mk-appbar-color',
'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, variables SCSS_URL, XML_ID, variables
@ -83,6 +114,8 @@ class ResConfigSettings(models.TransientModel):
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'],
'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 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): class ResUsers(models.Model):
_inherit = 'res.users' _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( sidebar_type = fields.Selection(
selection=[ selection=[
('invisible', 'Invisible'), ('invisible', 'Invisible'),
('small', 'Small'), ('small', 'Small'),
('large', 'Large') ('large', 'Large')
], ],
required=True,
string="Sidebar Type", string="Sidebar Type",
default='small',
required=True)
default=lambda self: self._default_sidebar_type())
chatter_position = fields.Selection( chatter_position = fields.Selection(
selection=[ selection=[
('normal', 'Normal'), ('normal', 'Normal'),
('sided', 'Sided'), ('sided', 'Sided'),
], ],
required=True,
string="Chatter Position", string="Chatter Position",
default='sided',
required=True)
default=lambda self: self._default_chatter_position())
def __init__(self, pool, cr): def __init__(self, pool, cr):
init_res = super(ResUsers, self).__init__(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%; width: 100%;
} }
.o-app-name { .o-app-name {
color: $gray-100;
color: $mk-apps-color;
} }
.form-row { .form-row {
width: 100%; width: 100%;
@ -99,7 +99,7 @@
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
color: $gray-100;
color: $mk-apps-color;
&:hover, &:active, &.active { &:hover, &:active, &.active {
background-color: rgba(255, 255, 255, 0.05); background-color: rgba(255, 255, 255, 0.05);
} }

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

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

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

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

54
muk_web_theme/views/res_config_settings_view.xml

@ -31,14 +31,17 @@
<div class="o_setting_left_pane"> <div class="o_setting_left_pane">
</div> </div>
<div class="o_setting_right_pane"> <div class="o_setting_right_pane">
<span class="o_form_label">Background Image</span>
<span class="fa fa-lg fa-building-o" title="Values set here are company-specific." aria-label="Values set here are company-specific." groups="base.group_multi_company" role="img"/>
<span class="o_form_label">Default Preferences</span>
<div class="text-muted"> <div class="text-muted">
Set the background image for the apps menu
Set the default theme preferences
</div> </div>
<div class="content-group"> <div class="content-group">
<div class="mt16 row"> <div class="mt16 row">
<field name="theme_background_image" widget="image" class="ml-4" required="1"/>
<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> </div>
@ -53,14 +56,49 @@
</div> </div>
<div class="content-group"> <div class="content-group">
<div class="mt16 row"> <div class="mt16 row">
<label for="theme_color_brand" string="Brand" class="col-lg-3 o_light_label"/>
<label for="theme_color_brand" string="Brand" class="col-3 o_light_label"/>
<field name="theme_color_brand" widget="color" class="oe_inline"/> <field name="theme_color_brand" widget="color" class="oe_inline"/>
<div class="w-100"></div> <div class="w-100"></div>
<label for="theme_color_primary" string="Primary" class="col-lg-3 o_light_label"/>
<label for="theme_color_primary" string="Primary" class="col-3 o_light_label"/>
<field name="theme_color_primary" widget="color" class="oe_inline"/> <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>
<div class="o_setting_right_pane">
<span class="o_form_label">Background Image</span>
<span class="fa fa-lg fa-building-o" title="Values set here are company-specific." aria-label="Values set here are company-specific." groups="base.group_multi_company" role="img"/>
<div class="text-muted">
Set the background image for the apps menu
</div>
<div class="content-group">
<div class="mt16 row">
<field name="theme_background_image" widget="image" class="ml-4" required="1"/>
</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">Menu Colors</span>
<div class="text-muted">
Set the main menu colors
</div>
<div class="content-group">
<div class="mt16 row">
<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_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> <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> </div>
</div> </div>

Loading…
Cancel
Save