Skip to content

Commit

Permalink
⚡ delete colors when deactivate items
Browse files Browse the repository at this point in the history
Signed-off-by: Enigma228322 <[email protected]>
  • Loading branch information
Enigma228322 committed Nov 2, 2020
1 parent 87bf22e commit bfd2f00
Show file tree
Hide file tree
Showing 2 changed files with 395 additions and 672 deletions.
145 changes: 111 additions & 34 deletions theme_kit/models/theme.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,28 @@ def _compute_backend_theme_installed(self):
else False
)

@api.multi
def write(self, vals):
res = super(ThemeTopPanel, self).write(vals)
if not vals.get("top_panel_bg_active", "Not found"):
self.top_panel_bg = ""
if not vals.get("top_panel_border_active", "Not found"):
self.top_panel_border = ""
if not vals.get("top_panel_font_active", "Not found"):
self.top_panel_font = ""
if not vals.get("top_panel_active_item_font_active", "Not found"):
self.top_panel_active_item_font = ""
if not vals.get("top_panel_active_item_bg_active", "Not found"):
self.top_panel_active_item_bg = ""
if not vals.get("top_panel_hover_item_font_active", "Not found"):
self.top_panel_hover_item_font = ""
if not vals.get("top_panel_hover_item_bg_active", "Not found"):
self.top_panel_hover_item_bg = ""
if not vals.get("left_panel_main_menu_active", "Not found"):
self.left_panel_main_menu = ""
if not vals.get("left_panel_sub_menu_active", "Not found"):
self.top_panel_hover_item_bg = ""

@api.multi
def _compute_less(self):
for r in self:
Expand Down Expand Up @@ -192,40 +214,41 @@ def _compute_less(self):
)

if self.top_panel_border_active:
code = (
code
+ """.o_main_navbar{{
border-color: {theme.top_panel_border};
}}
#oe_main_menu_navbar{{
border-color: {theme.top_panel_border};
}}
.o_control_panel {{
border-bottom-color: {theme.top_panel_border}!important;
}}
.o_form_statusbar .o_arrow_button{{
border-color: lighten({theme.top_panel_border}, 40%)!important;
}}
.o_form_statusbar .o_arrow_button:before{{
border-left-color: lighten({theme.top_panel_border}, 40%)!important;
}}
.o_list_view thead {{
color: {theme.top_panel_border};
}}
.o_list_view thead > tr > th {{
border-color: {theme.top_panel_border};
}}
"""
)
# Compatibility theme_kit and material backend theme modules
code = (
code
+ """.main-nav {{
border: 1px solid {theme.top_panel_border} !important;
border-left: 0 !important;
border-right: 0 !important;
}}
"""
if not self.backend_theme_installed:
code = (
code
+ """.o_main_navbar{{
border-color: {theme.top_panel_border};
}}
#oe_main_menu_navbar{{
border-color: {theme.top_panel_border};
}}
.o_control_panel {{
border-bottom-color: {theme.top_panel_border}!important;
}}
.o_form_statusbar .o_arrow_button{{
border-color: lighten({theme.top_panel_border}, 40%)!important;
}}
.o_form_statusbar .o_arrow_button:before{{
border-left-color: lighten({theme.top_panel_border}, 40%)!important;
}}
.o_list_view thead {{
color: {theme.top_panel_border};
}}
.o_list_view thead > tr > th {{
border-color: {theme.top_panel_border};
}}
"""
)
else:
# Compatibility theme_kit and material backend theme modules
import wdb;wdb.set_trace()
code = (
code
+ """header {{
border-bottom: 1px solid {theme.top_panel_border} !important;
}}
"""
)
if self.top_panel_font_active and not self.backend_theme_installed:
code = (
Expand Down Expand Up @@ -457,6 +480,26 @@ def _compute_backend_theme_installed(self):
default=False, help="Font color for Top Panel"
)

@api.multi
def write(self, vals):
res = super(ThemeLeftPanel, self).write(vals)
if not vals.get("left_panel_bg_active", "Not found"):
self.left_panel_bg = ""
if not vals.get("left_panel_sub_menu_active", "Not found"):
self.left_panel_sub_menu = ""
if not vals.get("left_panel_main_menu_active", "Not found"):
self.left_panel_main_menu = ""
if not vals.get("left_panel_active_item_font_active", "Not found"):
self.left_panel_active_item_font = ""
if not vals.get("left_panel_active_item_bg_active", "Not found"):
self.left_panel_active_item_bg = ""
if not vals.get("left_panel_hover_item_font_active", "Not found"):
self.left_panel_hover_item_font = ""
if not vals.get("left_panel_hover_item_bg_active", "Not found"):
self.left_panel_hover_item_bg = ""
if not vals.get("left_panel_right_border_active", "Not found"):
self.left_panel_right_border = ""

@api.multi
def _compute_less(self):
self.backend_theme_installed = (
Expand Down Expand Up @@ -723,6 +766,40 @@ def _compute_backend_theme_installed(self):
else False
)

@api.multi
def write(self, vals):
res = super(ThemeContent, self).write(vals)
if not vals.get("content_bg_active", "Not found"):
self.content_bg = ""
if not vals.get("content_button_active", "Not found"):
self.content_button = ""
if not vals.get("content_form_active", "Not found"):
self.content_form = ""
if not vals.get("content_form_text_active", "Not found"):
self.content_form_text = ""
if not vals.get("content_form_title_active", "Not found"):
self.content_form_title = ""
if not vals.get("content_text_active", "Not found"):
self.content_text = ""
if not vals.get("content_form_link_active", "Not found"):
self.content_form_link = ""
if not vals.get("content_loader_active", "Not found"):
self.content_loader = ""
if not vals.get("content_loader_text_active", "Not found"):
self.content_loader_text = ""
if not vals.get("content_statusbar_bg_active", "Not found"):
self.content_statusbar_bg = ""
if not vals.get("content_statusbar_element_active", "Not found"):
self.content_statusbar_element = ""
if not vals.get("content_statusbar_font_color_active", "Not found"):
self.content_statusbar_font_color = ""
if not vals.get("content_main_menu_font_color_active", "Not found"):
self.content_main_menu_font_color = ""
if not vals.get("content_footer_color_active", "Not found"):
self.content_footer_color = ""
if not vals.get("content_required_field_back_color_active", "Not found"):
self.content_required_field_back_color = ""

@api.multi
def _compute_less(self):
self.backend_theme_installed = (
Expand Down
Loading

0 comments on commit bfd2f00

Please sign in to comment.