Browse Source

July 05: [FIX] Bug Fixed 'backend_theme_infinito'

15.0
Cybrosys Technologies 4 weeks ago
parent
commit
d7b48debb6
  1. 2
      backend_theme_infinito/__manifest__.py
  2. 9
      backend_theme_infinito/controllers/base_pwa.py
  3. 18
      backend_theme_infinito/controllers/main.py
  4. 6
      backend_theme_infinito/doc/RELEASE_NOTES.md
  5. 1
      backend_theme_infinito/models/ir_http.py
  6. 1
      backend_theme_infinito/models/res_config_settings.py

2
backend_theme_infinito/__manifest__.py

@ -27,7 +27,7 @@
Main Highlight Of The Theme Is You Can Dynamically Change The Colors, Main Highlight Of The Theme Is You Can Dynamically Change The Colors,
Views, Buttons, Different Types Sidebar...Etc""", Views, Buttons, Different Types Sidebar...Etc""",
"category": "Themes/Backend", "category": "Themes/Backend",
"version": "15.0.1.0.1", "version": "15.0.1.0.2",
'author': 'Cybrosys Techno Solutions', 'author': 'Cybrosys Techno Solutions',
'company': 'Cybrosys Techno Solutions', 'company': 'Cybrosys Techno Solutions',
'maintainer': 'Cybrosys Techno Solutions', 'maintainer': 'Cybrosys Techno Solutions',

9
backend_theme_infinito/controllers/base_pwa.py

@ -22,21 +22,18 @@
import json import json
from odoo import http from odoo import http
from odoo.http import request from odoo.http import request
from odoo.modules.module import get_module_resource
class BasePwa(http.Controller): class BasePwa(http.Controller):
def pwa_data(self): def pwa_data(self):
# pwa_enable = request.env[ src = get_module_resource('backend_theme_infinito', 'static', 'src', 'img', 'menu.png')
# "ir.config_parameter"].sudo().get_param(
# "base_pwa.pwa_enable")
# if pwa_enable:
return { return {
'short_name': 'Odoo', 'short_name': 'Odoo',
'name': 'Odoo-infinito', 'name': 'Odoo-infinito',
'description': 'PWA provided by backend theme infinito', 'description': 'PWA provided by backend theme infinito',
'icons': [ 'icons': [
{ {
'src': '/backend_theme_infinito/static/src/img/menu.png', 'src': f'{src}',
'type': 'image/png', 'type': 'image/png',
'sizes': '144x144', 'sizes': '144x144',
'purpose': 'any maskable' 'purpose': 'any maskable'

18
backend_theme_infinito/controllers/main.py

@ -25,7 +25,6 @@ import re
from odoo import http from odoo import http
from odoo.http import request from odoo.http import request
from odoo.modules.module import get_module_resource 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): def save_styles(self, changed_styles, object_class, hover=False):
"""Create Dynamic Styles css file""" """Create Dynamic Styles css file"""
changed_styles = json.loads(changed_styles) changed_styles = json.loads(changed_styles)
working_dir = os.path.dirname(os.path.realpath(__file__)) file_path = get_module_resource('backend_theme_infinito', 'static', 'src', 'css', 'dynamic_styles.css')
working_dir = working_dir.replace('/controllers', '')
file_path = working_dir + '/static/src/css/dynamic_styles.css'
style_file = open(file_path, 'a') style_file = open(file_path, 'a')
if os.stat(file_path).st_size == 0: if os.stat(file_path).st_size == 0:
style_file.write('/* This file is generated automatically by ' 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") @http.route(['/theme_studio/get_current_style'], type="json")
def get_current_style(self, selector): def get_current_style(self, selector):
working_dir = os.path.dirname(os.path.realpath(__file__)) file_path = get_module_resource('backend_theme_infinito', 'static', 'src', 'css', 'dynamic_styles.css')
file_path = working_dir.replace('controllers',
'static/src/css/dynamic_styles.css')
style_file = open(file_path, 'r') style_file = open(file_path, 'r')
css = style_file.read() css = style_file.read()
css = re.sub(r'/\*[\s\S]*?\*/', "", css) css = re.sub(r'/\*[\s\S]*?\*/', "", css)
@ -132,9 +127,7 @@ class ThemeStudio(http.Controller):
@http.route(['/theme_studio/reset_to_default'], type="json") @http.route(['/theme_studio/reset_to_default'], type="json")
def reset_to_default(self): def reset_to_default(self):
working_dir = os.path.dirname(os.path.realpath(__file__)) file_path = get_module_resource('backend_theme_infinito', 'static', 'src', 'css', 'dynamic_styles.css')
file_path = working_dir.replace('controllers',
'static/src/css/dynamic_styles.css')
style_file = open(file_path, 'w') style_file = open(file_path, 'w')
style_file.write('') style_file.write('')
return True return True
@ -225,10 +218,7 @@ class ThemeStudio(http.Controller):
@http.route(['/theme_studio/get_presets'], type="json") @http.route(['/theme_studio/get_presets'], type="json")
def get_presets(self): def get_presets(self):
working_dir = os.path.dirname(os.path.realpath(__file__)) file_path = get_module_resource('backend_theme_infinito', 'static', 'src', 'json', 'presets.json')
working_dir = working_dir.replace('/controllers', '')
file_path = working_dir + '/static/src/json/presets.json'
file = open(file_path, 'r') file = open(file_path, 'r')
presets = json.load(file) presets = json.load(file)
return presets return presets

6
backend_theme_infinito/doc/RELEASE_NOTES.md

@ -9,3 +9,9 @@ Initial Commit
#### Version 15.0.1.0.1 #### Version 15.0.1.0.1
#### UPDT #### UPDT
Updated the functionality to fetch the module resource. 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.

1
backend_theme_infinito/models/ir_http.py

@ -95,5 +95,4 @@ class IrHttp(models.AbstractModel):
list_bookmark.append(bkm) list_bookmark.append(bkm)
res['infinitoBookmarks'] = menu_bookmark.action_id.ids res['infinitoBookmarks'] = menu_bookmark.action_id.ids
res['infinitoMenuBookmarks'] = list_bookmark res['infinitoMenuBookmarks'] = list_bookmark
return res return res

1
backend_theme_infinito/models/res_config_settings.py

@ -105,5 +105,4 @@ class ResConfigSettings(models.TransientModel):
self.loader_class) self.loader_class)
set_param('backend_theme_infinito.is_chameleon', set_param('backend_theme_infinito.is_chameleon',
self.is_chameleon) self.is_chameleon)
super(ResConfigSettings, self).set_values() super(ResConfigSettings, self).set_values()

Loading…
Cancel
Save