From 3b86c9141ec0f30fe69217e543f46b13ba365845 Mon Sep 17 00:00:00 2001 From: Cybrosys Technologies Date: Wed, 2 Jul 2025 10:41:30 +0530 Subject: [PATCH] July 02: [FIX] Bug Fixed 'backend_theme_infinito_plus' --- backend_theme_infinito_plus/__manifest__.py | 2 +- .../controllers/main.py | 19 ++----- .../doc/RELEASE_NOTES.md | 5 ++ .../models/add_google_fonts.py | 8 +-- .../static/src/css/chatter.css | 4 +- .../static/src/css/font.css | 55 ------------------- .../static/src/scss/animation.scss | 49 ----------------- 7 files changed, 18 insertions(+), 124 deletions(-) diff --git a/backend_theme_infinito_plus/__manifest__.py b/backend_theme_infinito_plus/__manifest__.py index e0c71bafd..4da5de5e4 100644 --- a/backend_theme_infinito_plus/__manifest__.py +++ b/backend_theme_infinito_plus/__manifest__.py @@ -27,7 +27,7 @@ With Odoo.Main Highlight Of The Theme Is You Can Dynamically Change The Fonts,Animations, Languages,Chatbox Layouts...Etc""", 'category': "Themes/Backend", - 'version': "16.0.1.0.0", + 'version': "16.0.1.0.1", 'author': 'Cybrosys Techno Solutions', 'company': 'Cybrosys Techno Solutions', 'maintainer': 'Cybrosys Techno Solutions', diff --git a/backend_theme_infinito_plus/controllers/main.py b/backend_theme_infinito_plus/controllers/main.py index f46776613..65d18d025 100644 --- a/backend_theme_infinito_plus/controllers/main.py +++ b/backend_theme_infinito_plus/controllers/main.py @@ -24,6 +24,7 @@ import os from odoo.addons.backend_theme_infinito.controllers.main import ThemeStudio from odoo.addons.backend_theme_infinito.controllers.main import minify_css +from odoo.modules.module import get_module_resource from odoo import http from odoo.http import request @@ -36,9 +37,7 @@ class ThemeStudioPlus(ThemeStudio): def save_styles_plus(self, new_style): """Create Dynamic Styles css file for chat box layout""" changed_styles = json.loads(new_style) - working_dir = os.path.dirname(os.path.realpath(__file__)) - working_dir = working_dir.replace('/controllers', '') - file_path = working_dir + '/static/src/css/chatter.css' + file_path = get_module_resource('backend_theme_infinito_plus', 'static', 'src', 'css', 'chatter.css') style_file = open(file_path, 'a') style_file.truncate(0) if os.stat(file_path).st_size == 0: @@ -57,9 +56,7 @@ class ThemeStudioPlus(ThemeStudio): """create the Dynamic css file for animation""" animated = json.loads(style) saved_style = animated[0] - working_dir = os.path.dirname(os.path.realpath(__file__)) - file_path = working_dir.replace('/controllers', - '/static/src/scss/animation.scss') + file_path = get_module_resource('backend_theme_infinito_plus', 'static', 'src', 'scss', 'animation.scss') read_file = open(file_path, 'r') css = read_file.read() write_file = open(file_path, 'w') @@ -101,13 +98,9 @@ class ThemeStudioPlus(ThemeStudio): @http.route(['/theme_studio_plus/reset_to_default_style'], type="json") def reset_to_default_style(self): """rest to default styles""" - working_dir = os.path.dirname(os.path.realpath(__file__)) - style_file_path = working_dir.replace('controllers', - 'static/src/css/font.css') - animation_file_path = working_dir.replace('controllers', - 'static/src/scss/animation.scss') - chat_file_path = working_dir.replace('controllers', - 'static/src/css/chatter.css') + style_file_path = get_module_resource('backend_theme_infinito_plus', 'static', 'src', 'css', 'font.css') + animation_file_path = get_module_resource('backend_theme_infinito_plus', 'static', 'src', 'scss', 'animation.scss') + chat_file_path = get_module_resource('backend_theme_infinito_plus', 'static', 'src', 'css', 'chatter.css') style_file = open(style_file_path, 'w') style_file.write('') animation_file = open(animation_file_path, 'w') diff --git a/backend_theme_infinito_plus/doc/RELEASE_NOTES.md b/backend_theme_infinito_plus/doc/RELEASE_NOTES.md index 577e9e7ee..3de5014a1 100644 --- a/backend_theme_infinito_plus/doc/RELEASE_NOTES.md +++ b/backend_theme_infinito_plus/doc/RELEASE_NOTES.md @@ -4,3 +4,8 @@ #### Version 16.0.1.0.0 #### ADD - Initial Commit for Infinito Plus Backend Theme + +#### 30.06.2025 +#### Version 16.0.1.0.1 +#### UPDT +- Changed how files are accessed in controller's and model's, used a generalised method to fetch the files. \ No newline at end of file diff --git a/backend_theme_infinito_plus/models/add_google_fonts.py b/backend_theme_infinito_plus/models/add_google_fonts.py index f64ffbf60..75f57ce8e 100644 --- a/backend_theme_infinito_plus/models/add_google_fonts.py +++ b/backend_theme_infinito_plus/models/add_google_fonts.py @@ -23,6 +23,8 @@ import os import requests +from odoo.modules.module import get_module_resource + from odoo import api, fields, models, _ from odoo.exceptions import ValidationError @@ -65,8 +67,7 @@ class GoogleFont(models.Model): def set_css(self): """open the file write the style in to the css file""" - working_dir = os.path.dirname(os.path.realpath(__file__)) - working_dir = working_dir.replace('/models', '/static/src/css/font.css') + working_dir = get_module_resource('backend_theme_infinito_plus', 'static', 'src', 'css', 'font.css') # open the file in write mode with open(working_dir, 'w') as file: style = f""" @@ -84,7 +85,6 @@ class GoogleFont(models.Model): @staticmethod def remove_fonts(): """remove the style when changing the font""" - working_dir = os.path.dirname(os.path.realpath(__file__)) - working_dir = working_dir.replace('/models', '/static/src/css/font.css') + working_dir = get_module_resource('backend_theme_infinito_plus', 'static', 'src', 'css', 'font.css') with open(working_dir, 'w') as file: file.write('') diff --git a/backend_theme_infinito_plus/static/src/css/chatter.css b/backend_theme_infinito_plus/static/src/css/chatter.css index 6a5da15ad..1363ccbb8 100644 --- a/backend_theme_infinito_plus/static/src/css/chatter.css +++ b/backend_theme_infinito_plus/static/src/css/chatter.css @@ -1,2 +1,2 @@ -/* This Styles are generated automatically by Theme Studio */ - .o_ChatWindow {top:10px !important;left:10px !important;right:auto !important;} \ No newline at end of file +/* This file is generated automatically by Theme Infinito Plus */ +.o_ChatWindow { diff --git a/backend_theme_infinito_plus/static/src/css/font.css b/backend_theme_infinito_plus/static/src/css/font.css index 81d9a5567..e69de29bb 100644 --- a/backend_theme_infinito_plus/static/src/css/font.css +++ b/backend_theme_infinito_plus/static/src/css/font.css @@ -1,55 +0,0 @@ -/* This Styles are generated automatically by Theme Studio */ - /* cyrillic-ext */ -@font-face { - font-family: 'Rubik Iso'; - font-style: normal; - font-weight: 400; - font-display: swap; - src: url(https://fonts.gstatic.com/s/rubikiso/v2/x3dickHUfr-S4VAI4sAxdvoDjy8.woff2) format('woff2'); - unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; -} -/* cyrillic */ -@font-face { - font-family: 'Rubik Iso'; - font-style: normal; - font-weight: 400; - font-display: swap; - src: url(https://fonts.gstatic.com/s/rubikiso/v2/x3dickHUfr-S4VAI4sAxf_oDjy8.woff2) format('woff2'); - unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; -} -/* hebrew */ -@font-face { - font-family: 'Rubik Iso'; - font-style: normal; - font-weight: 400; - font-display: swap; - src: url(https://fonts.gstatic.com/s/rubikiso/v2/x3dickHUfr-S4VAI4sAxefoDjy8.woff2) format('woff2'); - unicode-range: U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F; -} -/* latin-ext */ -@font-face { - font-family: 'Rubik Iso'; - font-style: normal; - font-weight: 400; - font-display: swap; - src: url(https://fonts.gstatic.com/s/rubikiso/v2/x3dickHUfr-S4VAI4sAxdfoDjy8.woff2) format('woff2'); - unicode-range: U+0100-02AF, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF; -} -/* latin */ -@font-face { - font-family: 'Rubik Iso'; - font-style: normal; - font-weight: 400; - font-display: swap; - src: url(https://fonts.gstatic.com/s/rubikiso/v2/x3dickHUfr-S4VAI4sAxe_oD.woff2) format('woff2'); - unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; -} - - * { - font-family: 'Rubik Iso' !important; - } - .fa { - font: normal normal normal 14px/1 FontAwesome !important;} - .oi { - font-family: 'odoo_ui_icons' !important;} - \ No newline at end of file diff --git a/backend_theme_infinito_plus/static/src/scss/animation.scss b/backend_theme_infinito_plus/static/src/scss/animation.scss index 0fe7ff975..e69de29bb 100644 --- a/backend_theme_infinito_plus/static/src/scss/animation.scss +++ b/backend_theme_infinito_plus/static/src/scss/animation.scss @@ -1,49 +0,0 @@ -.o_kanban_view { - .oe_kanban_card, .o_kanban_record { - @for $tr from 1 through 80 { - &:nth-child(#{$tr}) { - animation:infinito_kanban_shake #{$tr * .1}s ease-in !important; - } - } - } -} - -@keyframes infinito_kanban_slide_in { - 0% { transform: translateX(-100%); } - 100% { transform: translateX(0); } -} -@keyframes infinito_kanban_scale { - 0%, 100% { transform: translateY(0); } - 50% { transform: translateY(-10px); } -} -@keyframes infinito_kanban_shake { - 0% { - transform: rotate(-5deg); - opacity: 0; - } - - 20% { - transform: rotate(5deg); - } - - 40% { - transform: rotate(-3deg); - } - - 60% { - transform: rotate(3deg); - } - - 80% { - transform: rotate(-1deg); - } - - 90% { - transform: rotate(1deg); - } - - 100% { - transform: rotate(0deg); - opacity: 1; - } -}