From d7b48debb66abac3032ec7966c359eca6f7bb3c2 Mon Sep 17 00:00:00 2001 From: Cybrosys Technologies Date: Sat, 5 Jul 2025 16:39:58 +0530 Subject: [PATCH] July 05: [FIX] Bug Fixed 'backend_theme_infinito' --- backend_theme_infinito/__manifest__.py | 2 +- backend_theme_infinito/controllers/base_pwa.py | 9 +++------ backend_theme_infinito/controllers/main.py | 18 ++++-------------- backend_theme_infinito/doc/RELEASE_NOTES.md | 6 ++++++ backend_theme_infinito/models/ir_http.py | 1 - .../models/res_config_settings.py | 1 - 6 files changed, 14 insertions(+), 23 deletions(-) diff --git a/backend_theme_infinito/__manifest__.py b/backend_theme_infinito/__manifest__.py index b5e69755f..deafa6732 100644 --- a/backend_theme_infinito/__manifest__.py +++ b/backend_theme_infinito/__manifest__.py @@ -27,7 +27,7 @@ Main Highlight Of The Theme Is You Can Dynamically Change The Colors, Views, Buttons, Different Types Sidebar...Etc""", "category": "Themes/Backend", - "version": "15.0.1.0.1", + "version": "15.0.1.0.2", 'author': 'Cybrosys Techno Solutions', 'company': 'Cybrosys Techno Solutions', 'maintainer': 'Cybrosys Techno Solutions', diff --git a/backend_theme_infinito/controllers/base_pwa.py b/backend_theme_infinito/controllers/base_pwa.py index eb58b5966..73d831dc2 100644 --- a/backend_theme_infinito/controllers/base_pwa.py +++ b/backend_theme_infinito/controllers/base_pwa.py @@ -22,21 +22,18 @@ import json from odoo import http from odoo.http import request - +from odoo.modules.module import get_module_resource class BasePwa(http.Controller): def pwa_data(self): - # pwa_enable = request.env[ - # "ir.config_parameter"].sudo().get_param( - # "base_pwa.pwa_enable") - # if pwa_enable: + src = get_module_resource('backend_theme_infinito', 'static', 'src', 'img', 'menu.png') return { 'short_name': 'Odoo', 'name': 'Odoo-infinito', 'description': 'PWA provided by backend theme infinito', 'icons': [ { - 'src': '/backend_theme_infinito/static/src/img/menu.png', + 'src': f'{src}', 'type': 'image/png', 'sizes': '144x144', 'purpose': 'any maskable' diff --git a/backend_theme_infinito/controllers/main.py b/backend_theme_infinito/controllers/main.py index d6334d760..557f88159 100644 --- a/backend_theme_infinito/controllers/main.py +++ b/backend_theme_infinito/controllers/main.py @@ -25,7 +25,6 @@ import re from odoo import http from odoo.http import request - from odoo.modules.module import get_module_resource @@ -84,9 +83,7 @@ class ThemeStudio(http.Controller): def save_styles(self, changed_styles, object_class, hover=False): """Create Dynamic Styles css file""" changed_styles = json.loads(changed_styles) - working_dir = os.path.dirname(os.path.realpath(__file__)) - working_dir = working_dir.replace('/controllers', '') - file_path = working_dir + '/static/src/css/dynamic_styles.css' + file_path = get_module_resource('backend_theme_infinito', 'static', 'src', 'css', 'dynamic_styles.css') style_file = open(file_path, 'a') if os.stat(file_path).st_size == 0: style_file.write('/* This file is generated automatically by ' @@ -104,9 +101,7 @@ class ThemeStudio(http.Controller): @http.route(['/theme_studio/get_current_style'], type="json") def get_current_style(self, selector): - working_dir = os.path.dirname(os.path.realpath(__file__)) - file_path = working_dir.replace('controllers', - 'static/src/css/dynamic_styles.css') + file_path = get_module_resource('backend_theme_infinito', 'static', 'src', 'css', 'dynamic_styles.css') style_file = open(file_path, 'r') css = style_file.read() css = re.sub(r'/\*[\s\S]*?\*/', "", css) @@ -132,9 +127,7 @@ class ThemeStudio(http.Controller): @http.route(['/theme_studio/reset_to_default'], type="json") def reset_to_default(self): - working_dir = os.path.dirname(os.path.realpath(__file__)) - file_path = working_dir.replace('controllers', - 'static/src/css/dynamic_styles.css') + file_path = get_module_resource('backend_theme_infinito', 'static', 'src', 'css', 'dynamic_styles.css') style_file = open(file_path, 'w') style_file.write('') return True @@ -225,10 +218,7 @@ class ThemeStudio(http.Controller): @http.route(['/theme_studio/get_presets'], type="json") def get_presets(self): - working_dir = os.path.dirname(os.path.realpath(__file__)) - working_dir = working_dir.replace('/controllers', '') - file_path = working_dir + '/static/src/json/presets.json' + file_path = get_module_resource('backend_theme_infinito', 'static', 'src', 'json', 'presets.json') file = open(file_path, 'r') presets = json.load(file) - return presets diff --git a/backend_theme_infinito/doc/RELEASE_NOTES.md b/backend_theme_infinito/doc/RELEASE_NOTES.md index e8d6e39c0..83574b2a0 100644 --- a/backend_theme_infinito/doc/RELEASE_NOTES.md +++ b/backend_theme_infinito/doc/RELEASE_NOTES.md @@ -9,3 +9,9 @@ Initial Commit #### Version 15.0.1.0.1 #### UPDT Updated the functionality to fetch the module resource. + + +#### 05.07.2025 +#### Version 15.0.1.0.2 +#### UPDT +Updated the functionality to fetch the module resource. \ No newline at end of file diff --git a/backend_theme_infinito/models/ir_http.py b/backend_theme_infinito/models/ir_http.py index 3cd55ce5f..3393018fa 100644 --- a/backend_theme_infinito/models/ir_http.py +++ b/backend_theme_infinito/models/ir_http.py @@ -95,5 +95,4 @@ class IrHttp(models.AbstractModel): list_bookmark.append(bkm) res['infinitoBookmarks'] = menu_bookmark.action_id.ids res['infinitoMenuBookmarks'] = list_bookmark - return res diff --git a/backend_theme_infinito/models/res_config_settings.py b/backend_theme_infinito/models/res_config_settings.py index 1b19fe47c..ad2fb7eb8 100644 --- a/backend_theme_infinito/models/res_config_settings.py +++ b/backend_theme_infinito/models/res_config_settings.py @@ -105,5 +105,4 @@ class ResConfigSettings(models.TransientModel): self.loader_class) set_param('backend_theme_infinito.is_chameleon', self.is_chameleon) - super(ResConfigSettings, self).set_values()