From 79f91ab025e8659c2788cf8262772d04af863321 Mon Sep 17 00:00:00 2001 From: Nicolas JEUDY Date: Fri, 31 Mar 2023 18:21:09 +0200 Subject: [PATCH] [UPD] upgrade to latest muk_web_theme 16.0 --- muk_web_theme/__manifest__.py | 2 +- muk_web_theme/models/__init__.py | 2 + muk_web_theme/models/ir_asset.py | 59 +++++++++++++++++++ muk_web_theme/models/ir_attachment.py | 59 +++++++++++++++++++ muk_web_theme/models/web_editor_assets.py | 10 ---- .../static/src/webclient/appsbar/appsbar.scss | 24 ++++---- 6 files changed, 133 insertions(+), 23 deletions(-) create mode 100644 muk_web_theme/models/ir_asset.py create mode 100644 muk_web_theme/models/ir_attachment.py diff --git a/muk_web_theme/__manifest__.py b/muk_web_theme/__manifest__.py index a4947f2..d32042b 100644 --- a/muk_web_theme/__manifest__.py +++ b/muk_web_theme/__manifest__.py @@ -43,7 +43,7 @@ { 'name': 'MuK Backend Theme', 'summary': 'Odoo Community Backend Theme', - 'version': '16.0.1.0.2', + 'version': '16.0.1.0.6', 'category': 'Themes/Backend', 'license': 'LGPL-3', 'author': 'MuK IT', diff --git a/muk_web_theme/models/__init__.py b/muk_web_theme/models/__init__.py index a624d8b..6822e87 100644 --- a/muk_web_theme/models/__init__.py +++ b/muk_web_theme/models/__init__.py @@ -44,4 +44,6 @@ from . import res_company from . import res_config_settings from . import res_users from . import web_editor_assets +from . import ir_attachment +from . import ir_asset from . import ir_http diff --git a/muk_web_theme/models/ir_asset.py b/muk_web_theme/models/ir_asset.py new file mode 100644 index 0000000..a3f3a92 --- /dev/null +++ b/muk_web_theme/models/ir_asset.py @@ -0,0 +1,59 @@ +################################################################################### +# +# Copyright (c) 2017-today MuK IT GmbH. +# +# This file is part of MuK Backend Theme +# (see https://mukit.at). +# +# MuK Proprietary License v1.0 +# +# This software and associated files (the "Software") may only be used +# (executed, modified, executed after modifications) if you have +# purchased a valid license from MuK IT GmbH. +# +# The above permissions are granted for a single database per purchased +# license. Furthermore, with a valid license it is permitted to use the +# software on other databases as long as the usage is limited to a testing +# or development environment. +# +# You may develop modules based on the Software or that use the Software +# as a library (typically by depending on it, importing it and using its +# resources), but without copying any source code or material from the +# Software. You may distribute those modules under the license of your +# choice, provided that this license is compatible with the terms of the +# MuK Proprietary License (For example: LGPL, MIT, or proprietary licenses +# similar to this one). +# +# It is forbidden to publish, distribute, sublicense, or sell copies of +# the Software or modified copies of the Software. +# +# The above copyright notice and this permission notice must be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +# DEALINGS IN THE SOFTWARE. +# +################################################################################### + +from odoo import models, fields, api + + +class IrAsset(models.Model): + + _inherit = 'ir.asset' + + # ---------------------------------------------------------- + # ORM + # ---------------------------------------------------------- + + @api.model_create_multi + def create(self, vals_list): + if self.env.context.get('theme_variables', False): + for vals in vals_list: + vals.pop('website_id', False) + return super().create(vals_list) diff --git a/muk_web_theme/models/ir_attachment.py b/muk_web_theme/models/ir_attachment.py new file mode 100644 index 0000000..a911252 --- /dev/null +++ b/muk_web_theme/models/ir_attachment.py @@ -0,0 +1,59 @@ +################################################################################### +# +# Copyright (c) 2017-today MuK IT GmbH. +# +# This file is part of MuK Backend Theme +# (see https://mukit.at). +# +# MuK Proprietary License v1.0 +# +# This software and associated files (the "Software") may only be used +# (executed, modified, executed after modifications) if you have +# purchased a valid license from MuK IT GmbH. +# +# The above permissions are granted for a single database per purchased +# license. Furthermore, with a valid license it is permitted to use the +# software on other databases as long as the usage is limited to a testing +# or development environment. +# +# You may develop modules based on the Software or that use the Software +# as a library (typically by depending on it, importing it and using its +# resources), but without copying any source code or material from the +# Software. You may distribute those modules under the license of your +# choice, provided that this license is compatible with the terms of the +# MuK Proprietary License (For example: LGPL, MIT, or proprietary licenses +# similar to this one). +# +# It is forbidden to publish, distribute, sublicense, or sell copies of +# the Software or modified copies of the Software. +# +# The above copyright notice and this permission notice must be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +# DEALINGS IN THE SOFTWARE. +# +################################################################################### + +from odoo import models, fields, api + + +class IrAttachment(models.Model): + + _inherit = 'ir.attachment' + + # ---------------------------------------------------------- + # ORM + # ---------------------------------------------------------- + + @api.model_create_multi + def create(self, vals_list): + if self.env.context.get('theme_variables', False): + for vals in vals_list: + vals.pop('website_id', False) + return super().create(vals_list) diff --git a/muk_web_theme/models/web_editor_assets.py b/muk_web_theme/models/web_editor_assets.py index 06795bc..bc0d648 100644 --- a/muk_web_theme/models/web_editor_assets.py +++ b/muk_web_theme/models/web_editor_assets.py @@ -73,16 +73,6 @@ class ScssEditor(models.AbstractModel): regex = r'{0}\:?\s(.*?);'.format(variable['name']) content = re.sub(regex, variable_content, content) return content - - @api.model - def _save_asset_hook(self): - res = super()._save_asset_hook() - if ( - res.get('website_id', False) and - self.env.context.get('theme_variables', False) - ): - res['website_id'] = False - return res # ---------------------------------------------------------- # Functions diff --git a/muk_web_theme/static/src/webclient/appsbar/appsbar.scss b/muk_web_theme/static/src/webclient/appsbar/appsbar.scss index 791ea84..e23081f 100644 --- a/muk_web_theme/static/src/webclient/appsbar/appsbar.scss +++ b/muk_web_theme/static/src/webclient/appsbar/appsbar.scss @@ -86,21 +86,12 @@ } } -.o_fullscreen { - .mk_apps_sidebar_panel { - display: none; - } - .o_action_manager { - padding-left: 0; - } -} - @include media-breakpoint-up(lg) { .mk_sidebar_type_large { .mk_apps_sidebar_panel { width: $mk-sidebar-large-width; } - .o_action_manager { + .o_navbar + .o_action_manager { padding-left: $mk-sidebar-large-width; } } @@ -114,7 +105,7 @@ margin-right: 0 !important; } } - .o_action_manager { + .o_navbar + .o_action_manager { padding-left: $mk-sidebar-small-width; } } @@ -136,7 +127,7 @@ margin-right: 0 !important; } } - .o_action_manager { + .o_navbar + .o_action_manager { padding-left: $mk-sidebar-small-width; } } @@ -155,3 +146,12 @@ padding-left: 0; } } + +.editor_has_snippets_hide_backend_navbar { + .mk_apps_sidebar_panel { + display: none !important; + } + .o_action_manager { + padding-left: 0 !important; + } +}