From 6f8bd52f47b4a8334125f2ab6280f023c2bcaa4a Mon Sep 17 00:00:00 2001 From: Risvana Cybro Date: Wed, 26 Nov 2025 18:51:38 +0530 Subject: [PATCH] Nov 26: [FIX] Bug Fixed 'backend_theme_infinito' --- backend_theme_infinito/__manifest__.py | 2 +- .../controllers/base_pwa.py | 4 +- backend_theme_infinito/controllers/main.py | 80 +++++--- backend_theme_infinito/doc/RELEASE_NOTES.md | 17 +- backend_theme_infinito/icon_hooks.py | 1 + .../static/src/css/dynamic_styles.css | 2 - .../static/src/css/style.css | 7 +- .../static/src/js/recentApps.js | 6 +- .../static/src/js/theme_editor_sidebar.js | 180 ++++++++---------- .../static/src/js/variables.js | 2 +- .../static/src/json/presets.json | 8 +- .../static/src/scss/sidebar.scss | 1 - .../static/src/scss/theme_styles.scss | 2 - .../static/src/scss/theme_variables.scss | 1 + .../static/src/xml/studio_elements.xml | 32 ++-- .../static/src/xml/theme_editor.xml | 12 -- 16 files changed, 161 insertions(+), 196 deletions(-) diff --git a/backend_theme_infinito/__manifest__.py b/backend_theme_infinito/__manifest__.py index fa5f7177e..7549fb223 100755 --- 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": "17.0.1.0.3", + "version": "17.0.1.0.1", '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 5bbad0d84..da05c483e 100755 --- a/backend_theme_infinito/controllers/base_pwa.py +++ b/backend_theme_infinito/controllers/base_pwa.py @@ -23,7 +23,6 @@ import json from odoo import http from odoo.http import request -from odoo.modules.module import get_module_resource class BasePwa(http.Controller): """ @@ -37,14 +36,13 @@ class BasePwa(http.Controller): Returns: dict: Dictionary containing PWA manifest data. """ - 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': f'{src}', + 'src': '/backend_theme_infinito/static/src/img/menu.png', '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 db615447a..714b32b04 100755 --- a/backend_theme_infinito/controllers/main.py +++ b/backend_theme_infinito/controllers/main.py @@ -26,8 +26,6 @@ import re from odoo import http from odoo.http import request -from odoo.modules.module import get_module_resource - def minify_css(path): """ @@ -139,8 +137,11 @@ class ThemeStudio(http.Controller): changed_styles_str = kwargs.get('changed_styles', '{}') object_class = kwargs.get('object_class', '') changed_styles = json.loads(changed_styles_str) - file_path = get_module_resource('backend_theme_infinito', 'static', 'src', 'css', 'dynamic_styles.css') + 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' style_file = open(file_path, 'a') + if os.stat(file_path).st_size == 0: style_file.write('/* This file is generated automatically by ' 'Theme Infinito */\n') @@ -190,7 +191,9 @@ class ThemeStudio(http.Controller): ``` """ selector = kwargs.get('selector', '') - file_path = get_module_resource('backend_theme_infinito', 'static', 'src', 'css', 'dynamic_styles.css') + working_dir = os.path.dirname(os.path.realpath(__file__)) + file_path = working_dir.replace('controllers', + 'static/src/css/dynamic_styles.css') style_file = open(file_path, 'r') css = style_file.read() css = re.sub(r'/\*[\s\S]*?\*/', "", css) @@ -236,7 +239,9 @@ class ThemeStudio(http.Controller): reset_to_default() ``` """ - file_path = get_module_resource('backend_theme_infinito', 'static', 'src', 'css', 'dynamic_styles.css') + working_dir = os.path.dirname(os.path.realpath(__file__)) + file_path = working_dir.replace('controllers', + 'static/src/css/dynamic_styles.css') style_file = open(file_path, 'w') style_file.write('') return True @@ -433,35 +438,51 @@ class ThemeStudio(http.Controller): 'user_id': request.env.user.id }) - @http.route(['/theme_studio/get_recent_apps'], type="json") + @http.route(['/theme_studio/get_recent_apps'], type="json", auth="user") def get_recent_apps(self): """ - Retrieve the list of recent applications for the current user. + Retrieve the list of recent applications for the current user. - Returns: - list: A list of dictionaries containing the recent applications' - information, - or an empty list if no recent apps are found. + Returns: + list: A list of dictionaries containing the recent applications' + information, + or an empty list if no recent apps are found. - This function retrieves the list of recent applications for the current - user from the database. It returns a list of dictionaries containing the - information of each recent application, such as its ID, name, and other - relevant details. + This function retrieves the list of recent applications for the current + user from the database. It returns a list of dictionaries containing the + information of each recent application, such as its ID, name, and other + relevant details. - Example: - To retrieve the list of recent applications for the current user: + Example: + To retrieve the list of recent applications for the current user: - ```python - from my_theme_module import get_recent_apps + ```python + from my_theme_module import get_recent_apps - recent_apps = get_recent_apps() - print(recent_apps) - ``` - """ - recent_app = request.env['recent.apps'].sudo() - return recent_app.search_read([ - ('user_id', '=', request.env.user.id) - ]) + recent_apps = get_recent_apps() + print(recent_apps) + ``` + """ + recent_apps_model = request.env['recent.apps'].sudo() + menu_model = request.env['ir.ui.menu'].sudo() + + results = [] + recent_records = recent_apps_model.search( + [('user_id', '=', request.env.user.id)], + order="id desc") + for rec in recent_records: + menu = menu_model.browse(rec.app_id) + if not menu.exists(): + continue + icon_data = menu.web_icon_data # base64 + icon_type = "svg" if (menu.web_icon and menu.web_icon.endswith("svg")) else "png" + results.append({ + "app_id": menu.id, + "name": menu.name, + "icon": icon_data, + "type": icon_type, + }) + return results @http.route(['/theme_studio/add_menu_bookmarks'], type="json") def add_menu_bookmarks(self, args): @@ -571,7 +592,10 @@ class ThemeStudio(http.Controller): print(presets) ``` """ - file_path = get_module_resource("backend_theme_infinito", "static", "src", "json", "presets.json") + 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 = 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 c67e0dc26..83cb9f991 100755 --- a/backend_theme_infinito/doc/RELEASE_NOTES.md +++ b/backend_theme_infinito/doc/RELEASE_NOTES.md @@ -5,18 +5,7 @@ #### ADD Initial Commit for Infinito Backend Theme -#### 04.12.2024 +#### 25.11.2025 #### Version 17.0.1.0.1 -##### BUGFIX -- Fixed the style issue in the sidebar menu buttons. - -#### 23.06.2025 -#### Version 17.0.1.0.2 -##### BUGFIX -- Updated the functionality to fetch the module resource. - -#### 05.07.2025 -#### Version 17.0.1.0.3 -##### BUGFIX -- Updated the functionality to fetch the module resource. -- \ No newline at end of file +#### UPDT +Resolved the issue of recent apps \ No newline at end of file diff --git a/backend_theme_infinito/icon_hooks.py b/backend_theme_infinito/icon_hooks.py index ea95344e2..b48da6aec 100755 --- a/backend_theme_infinito/icon_hooks.py +++ b/backend_theme_infinito/icon_hooks.py @@ -22,6 +22,7 @@ ############################################################################# import base64 +from odoo import api, SUPERUSER_ID from odoo.modules import get_module_resource diff --git a/backend_theme_infinito/static/src/css/dynamic_styles.css b/backend_theme_infinito/static/src/css/dynamic_styles.css index 958903ff5..e69de29bb 100644 --- a/backend_theme_infinito/static/src/css/dynamic_styles.css +++ b/backend_theme_infinito/static/src/css/dynamic_styles.css @@ -1,2 +0,0 @@ -/* This Styles are generated automatically by Theme Studio */ - . {background-color: rgb(250, 0, 0) !important;} \ No newline at end of file diff --git a/backend_theme_infinito/static/src/css/style.css b/backend_theme_infinito/static/src/css/style.css index 6b08e92d1..27cc43732 100755 --- a/backend_theme_infinito/static/src/css/style.css +++ b/backend_theme_infinito/static/src/css/style.css @@ -1528,7 +1528,7 @@ label:hover div.popover.fade.in { #theme_editor_sidebar { margin-left: 1587px !important; - height: inherit; + height: 934px; } .oe_kanban_action_button { @@ -1642,6 +1642,9 @@ label:hover div.popover.fade.in { .infinito-form-select > option { background-color: var(--sub-color-i-3); } +select > option { + background: inherit; +} .o_filter_menu > .fa-filter { color: var(--button-bg) !important; @@ -1676,7 +1679,7 @@ label:hover div.popover.fade.in { } .o_form_button_create { - background-color: #5279be; + background-color: var(--button-bg) !important; transition: background-color 0.3s ease } diff --git a/backend_theme_infinito/static/src/js/recentApps.js b/backend_theme_infinito/static/src/js/recentApps.js index e0e0dab88..1ee73ca09 100755 --- a/backend_theme_infinito/static/src/js/recentApps.js +++ b/backend_theme_infinito/static/src/js/recentApps.js @@ -33,7 +33,7 @@ export default class InfinitoRecentApps extends owl.Component { // XML template for InfinitoRecentApps component InfinitoRecentApps.template = xml`
- +
`; \ No newline at end of file diff --git a/backend_theme_infinito/static/src/js/theme_editor_sidebar.js b/backend_theme_infinito/static/src/js/theme_editor_sidebar.js index 30bd36ab9..817caf995 100755 --- a/backend_theme_infinito/static/src/js/theme_editor_sidebar.js +++ b/backend_theme_infinito/static/src/js/theme_editor_sidebar.js @@ -13,6 +13,8 @@ import {useService, useBus} from "@web/core/utils/hooks"; import {InfinitoDialog} from "./style_add" import {jsonrpc} from "@web/core/network/rpc_service"; import {Dialog} from "@web/core/dialog/dialog"; +import { variables, colors, to_color } from './variables'; + const {useRef, onWillStart, xml, onMounted} = owl; @@ -45,7 +47,7 @@ export class ThemeEditorSidebar extends Component { id="presets" t-on-change="_onPresetChange"> - + @@ -131,6 +133,7 @@ export class ThemeEditorSidebar extends Component { DesignDictionary: {}, preset_type: null, presets: null, + style:'', }) this.renderPresets(); // Set display name based on props @@ -191,7 +194,7 @@ export class ThemeEditorSidebar extends Component {
${displayName}
-
- `; - var customizeButton = document.querySelector('.button_cutomise'); - customizeButton.appendChild(newDiv); - } - var rangeDiv = document.createElement("div"); - rangeDiv.classList.add("optss", "infinito-remove"); - if (tool.type == 'range') { - // Range type tool - rangeDiv.innerHTML = `
-
- ${tool.displayName} -
-
- ${tool.unit} -
-
-
-
- - -
-
` - var customizeButton = document.querySelector('.button_cutomise'); - customizeButton.appendChild(rangeDiv); - var rangeInput = document.getElementById('slider'); - rangeInput.addEventListener('click', function () { - // Handle click event if needed - }); - } - var SelectDiv = document.createElement("div"); - SelectDiv.classList.add("optss", "infinito-remove"); - if (tool.type == 'select') { - // Select type tool - SelectDiv.innerHTML = `
-
- ${tool.displayName} -
-
- -
-
`; - var customizeButton = document.querySelector('.button_cutomise'); - customizeButton.appendChild(SelectDiv); - } - var InputDiv = document.createElement("div"); - InputDiv.classList.add("optss", "infinito-remove"); - if (tool.type == 'input') { - // Input type tool - InputDiv.innerHTML = `
-
- ${tool.displayName} -
-
- ` - // Append the new tool to the DOM - var customizeButton = document.querySelector('.button_cutomise'); - customizeButton.appendChild(InputDiv); - } + if (!tool) return null; + let value = this.getDefaultValue(tool.name); + if (val) value = val; + if (tool.type == 'range') value = value.replace(/[^0-9,.]+/g, ""); + + tool.default = value; + let newDiv = document.createElement("div"); + + if (tool.type == 'color') { + newDiv.innerHTML = `
+
${tool.displayName}
+
+ +
+
`; + } else if (tool.type == 'range') { + newDiv.innerHTML = `
+
${tool.displayName}
+
${tool.unit}
+
+
+
+ + +
+
`; + } else if (tool.type == 'select') { + newDiv.innerHTML = `
+
${tool.displayName}
+
+ +
+
`; + } else if (tool.type == 'input') { + newDiv.innerHTML = `
+
${tool.displayName}
+
+ `; } + return newDiv; } /** @@ -487,13 +458,18 @@ export class ThemeEditorSidebar extends Component { */ renderExistingTool(data) { // Iterate over each rule in the data + const infinito = document.querySelector(".infinito-remove"); + infinito.innerHTML = ''; // Clear existing content for (var rule of data) { // Find the corresponding tool based on the rule name var current = NewTools.property.filter(tool => tool.name == rule[0].replace(' ', '')); // Push the tool name to the current_tools array this.current_tools.push(rule[0].replace(' ', '')); // Render the new tool based on the found tool configuration - this.renderNewTool(current[0]); + if(current.length !=0){ + var styleDiv = this.renderNewTool(current[0]); + infinito.appendChild(styleDiv); + } } } diff --git a/backend_theme_infinito/static/src/js/variables.js b/backend_theme_infinito/static/src/js/variables.js index feaa23e7f..14749065e 100755 --- a/backend_theme_infinito/static/src/js/variables.js +++ b/backend_theme_infinito/static/src/js/variables.js @@ -1,9 +1,9 @@ /** @odoo-module **/ -import { useState } from "@odoo/owl"; /** * Object containing CSS variable names and their corresponding ranges for generating color variations. * @type {Object.} */ + console.log("1234567327453245735") const variables = { "--bg_white": [1, 1], "--bg_black": [5, 1], diff --git a/backend_theme_infinito/static/src/json/presets.json b/backend_theme_infinito/static/src/json/presets.json index 392eee7ec..fccc1ef9d 100755 --- a/backend_theme_infinito/static/src/json/presets.json +++ b/backend_theme_infinito/static/src/json/presets.json @@ -17,7 +17,7 @@ { "name": "Rounded", "style": { - "background-color": "var(--primary_accent)", + "background-color": "var(--button-bg)", "border-radius": "30px", "color": "var(--bg_white)" } @@ -40,7 +40,7 @@ "border-width": "1px", "border-style": " solid", "border-color": " var(--primary_accent)", - "color": "var(--primary_accent)", + "color": "var(--bg_white)", "border-radius": "0" } }, @@ -52,7 +52,7 @@ "border-style": " solid", "border-color": " var(--primary_accent)", "border-radius": "30px", - "color": "var(--primary_accent)" + "color": "var(--bg_white)" } }, { @@ -66,7 +66,7 @@ "border-top-right-radius": "20px", "border-bottom-right-radius": "0px", "border-bottom-left-radius": "20px", - "color": "var(--primary_accent)" + "color": "var(--bg_white)" } } ] diff --git a/backend_theme_infinito/static/src/scss/sidebar.scss b/backend_theme_infinito/static/src/scss/sidebar.scss index 4300592b4..0dc7495a2 100755 --- a/backend_theme_infinito/static/src/scss/sidebar.scss +++ b/backend_theme_infinito/static/src/scss/sidebar.scss @@ -6,7 +6,6 @@ a#closeSidebar, a#openSidebar { #sidebar_panel { height: 100%; position: fixed; - background-color: var(--tr-button-bg); box-shadow: 0px 4px 11px 0px #888; display: none; width: 200px; diff --git a/backend_theme_infinito/static/src/scss/theme_styles.scss b/backend_theme_infinito/static/src/scss/theme_styles.scss index 6cb9ede93..fd305fc24 100755 --- a/backend_theme_infinito/static/src/scss/theme_styles.scss +++ b/backend_theme_infinito/static/src/scss/theme_styles.scss @@ -158,7 +158,6 @@ background-color: white !important; border-left-width: 12px; } .o_wrap_field > .o_cell >.o_field_widget > .o_field_tags > .rounded-pill{ - background-color: var(--tr-button-bg) !important; font-weight: 500 !important; color: var(--button-bg) !important; width: 63px !important; @@ -973,7 +972,6 @@ color: #fff; background-color: var(--button-bg); } .o-dropdown.dropup > .o-dropdown--menu, .o-dropdown.dropdown > .o-dropdown--menu, .o-dropdown.dropleft > .o-dropdown--menu, .o-dropdown.dropright > .o-dropdown--menu { - left: auto !important; } o_list_renderer .o_list_table > thead > tr > :last-child, .o_list_renderer .o_list_table > tbody > tr > :last-child, .o_list_renderer .o_list_table > tfoot > tr > :last-child { padding-right: var(--ListRenderer-table-padding-h); diff --git a/backend_theme_infinito/static/src/scss/theme_variables.scss b/backend_theme_infinito/static/src/scss/theme_variables.scss index 990f2f42a..c1e77521a 100755 --- a/backend_theme_infinito/static/src/scss/theme_variables.scss +++ b/backend_theme_infinito/static/src/scss/theme_variables.scss @@ -42,6 +42,7 @@ $dark_secondary_btn_hover_border: var(--dark_secondary_btn_hover_border) !defaul --border-color: #dad6d6; --button-bg-dark: #3b588a; --button-bg-darker: #2b4269; + --primary_accent: #5279be; } $bg_white: var(--bg_white) !default; diff --git a/backend_theme_infinito/static/src/xml/studio_elements.xml b/backend_theme_infinito/static/src/xml/studio_elements.xml index 6917ec106..c0e178533 100755 --- a/backend_theme_infinito/static/src/xml/studio_elements.xml +++ b/backend_theme_infinito/static/src/xml/studio_elements.xml @@ -1,9 +1,5 @@ -
@@ -24,25 +20,18 @@
-
- +
-
@@ -59,17 +48,18 @@
- -
+
+ +
- - +
diff --git a/backend_theme_infinito/static/src/xml/theme_editor.xml b/backend_theme_infinito/static/src/xml/theme_editor.xml index 7a6e65d31..243450566 100755 --- a/backend_theme_infinito/static/src/xml/theme_editor.xml +++ b/backend_theme_infinito/static/src/xml/theme_editor.xml @@ -1,9 +1,5 @@ -
@@ -30,10 +26,6 @@
-
@@ -123,10 +115,6 @@
-