Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[web_website] fix reinstallation error by adding IF NOT EXISTS #1089

Open
wants to merge 17 commits into
base: 11.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.pyc
*.sh
14 changes: 10 additions & 4 deletions base_session_store_psql/sessionstore.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ def __init__(self, session_class=None):

def get_cursor(self, create_session_store_db=True):
db_name = config.get("session_store_db", "session_store")
db_encoding = config.get("db_encoding", "UTF8")
db_template = config.get("db_template", "template0")
try:
con = db_connect(db_name)
cr = con.cursor()
Expand All @@ -46,8 +48,8 @@ def get_cursor(self, create_session_store_db=True):
with closing(db_connect("postgres").cursor()) as cr:
cr.autocommit(True) # avoid transaction block
cr.execute(
"""CREATE DATABASE "%s" ENCODING 'unicode' TEMPLATE "%s" """
% (db_name, config["db_template"])
"""CREATE DATABASE "%s" ENCODING "%s" TEMPLATE "%s" """
% (db_name, db_encoding, db_template)
)
return self.get_cursor(create_session_store_db=False)

Expand All @@ -65,7 +67,8 @@ def get_cursor(self, create_session_store_db=True):

def is_valid_key(self, key):
with self.get_cursor() as cr:
cr.execute("SELECT id FROM sessionstore WHERE id = %s LIMIT 1;", (key,))
cr.execute(
"SELECT id FROM sessionstore WHERE id = %s LIMIT 1;", (key,))
return cr.rowcount == 1

def save(self, session):
Expand Down Expand Up @@ -96,7 +99,10 @@ def save(self, session):

def delete(self, session):
with self.get_cursor() as cr:
cr.execute("DELETE FROM sessionstore WHERE id = %s;", (session.sid,))
cr.autocommit(True) # avoid transaction block
if self.is_valid_key(session.sid):
cr.execute("DELETE FROM sessionstore WHERE id = %s;",
(session.sid,))

def get(self, sid):
with self.get_cursor() as cr:
Expand Down
4 changes: 2 additions & 2 deletions ir_config_parameter_multi_company/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"category": "Extra Tools",
# "live_test_url": "",
"images": [],
"version": "11.0.5.0.0",
"version": "11.0.5.0.1",
"application": False,
"author": "IT-Projects LLC, Ivan Yelizariev",
"author": "IT-Projects LLC, Ivan Yelizariev, Zell Co., Ltd.",
"support": "[email protected]",
"website": "https://it-projects.info/team/yelizariev",
"license": "Other OSI approved licence", # MIT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ def migrate(cr, version):
# will be renamed to value_tmp during updating the module

# Create Column
cr.execute("ALTER TABLE ir_config_parameter ADD COLUMN value VARCHAR")
cr.execute("ALTER TABLE ir_config_parameter ADD COLUMN IF NOT EXISTS value VARCHAR")
2 changes: 1 addition & 1 deletion theme_kit/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"summary": """Brand your odoo instance in few clicks""",
"category": "Debranding",
"images": ["images/brandkit.png"],
"version": "11.0.2.0.0",
"version": "11.0.2.0.1",
"application": False,
"author": "IT-Projects LLC, Ivan Yelizariev",
"website": "https://odoo-debranding.com",
Expand Down
3 changes: 3 additions & 0 deletions theme_kit/data/theme_data.xml
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,15 @@
<field name="content_loader_active">True</field>
<field name="content_loader_text">#FFFFFF</field>
<field name="content_loader_text_active">True</field>
<field name="content_statusbar_font_color">#FFFFFF</field>
<field name="content_statusbar_font_color_active">True</field>
</record>
<record model="theme_kit.theme" id="you_tube_theme">
<field name="name">You Tube</field>
<field name="top_panel_id" ref="you_tube_top_panel" />
<field name="left_panel_id" ref="you_tube_left_panel" />
<field name="content_id" ref="you_tube_content" />
<field name="custom_css">.o_web_client { .o_input, .btn {border-radius: 0;} .o_list_view thead {color: #222222;} }</field>
</record>
<!--Template Coca-Cola-->
<record model="theme_kit.top_panel" id="cola_top_panel">
Expand Down
124 changes: 114 additions & 10 deletions theme_kit/models/theme.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,12 @@ def _compute_less(self):
.datepicker .table-condensed > thead {{
background-color: {theme.top_panel_bg};
}}

.datepicker .table-condensed > thead th:hover {{
background-color: darken({theme.top_panel_bg}, 15%) !important;
}}
.o_form_view .o_form_statusbar {{
background-color: transparent;
}}
"""
)

Expand Down Expand Up @@ -198,7 +200,7 @@ def _compute_less(self):
.o_main_navbar .o_menu_brand {{
color: {theme.top_panel_font}!important;
}}
.open .dropdown-menu > li a span {{
.open .dropdown-menu > li:not(.active) a span {{
color: {theme.top_panel_font}!important;
}}
.open .dropdown-menu > li.dropdown-header {{
Expand Down Expand Up @@ -229,6 +231,9 @@ def _compute_less(self):
.datepicker .table-condensed > thead {{
color: {theme.top_panel_font}!important;
}}
.navbar-inverse .navbar-toggle {{
background-color: {theme.top_panel_font};
}}
"""
)
if self.top_panel_active_item_font_active:
Expand All @@ -242,8 +247,32 @@ def _compute_less(self):
code = (
code
+ """.navbar-nav .active a{{
background-color: {theme.top_panel_active_item_bg}!important;
}}"""
background-color: {theme.top_panel_active_item_bg}!important;
}}
.o_dashboards .o_website_dashboard .o_dashboard_common .o_inner_box.o_primary {{
background-color: {theme.top_panel_active_item_bg}!important;
}}
.o_dashboards .o_website_dashboard .o_dashboard_common .o_inner_box.o_apps {{
background-color: {theme.top_panel_active_item_bg}!important;
}}
.o_chat_window .o_chat_header {{
background-color: {theme.top_panel_active_item_bg}!important;
}}
.o_mail_navbar_item .o_mail_navbar_dropdown .o_mail_navbar_dropdown_top .o_filter_button:hover,
.o_mail_navbar_item .o_mail_navbar_dropdown .o_mail_navbar_dropdown_top .o_filter_button.active {{
color: {theme.top_panel_active_item_bg}!important;
}}
.o_mail_navbar_item .o_mail_navbar_dropdown .o_mail_navbar_dropdown_top .o_filter_button,
.o_mail_navbar_item .o_mail_navbar_dropdown .o_mail_navbar_dropdown_top .o_new_message {{
color: {theme.top_panel_active_item_bg}!important;
}}
a {{
color: {theme.top_panel_active_item_bg};
}}
a:hover, a:focus {{
color: lighten({theme.top_panel_active_item_bg}, 10%);
}}
"""
)
if self.top_panel_hover_item_font_active:
code = (
Expand Down Expand Up @@ -307,6 +336,9 @@ def _compute_less(self):
.open .dropdown-menu > li a:focus {{
background-color: {theme.top_panel_hover_item_bg}!important;
}}
.o_dashboards:hover .o_website_dashboard:hover .o_dashboard_common:hover .o_inner_box.o_primary:hover {{
background-color: {theme.top_panel_hover_item_bg}!important;
}}
"""
)
code = code.format(theme=r)
Expand Down Expand Up @@ -478,6 +510,7 @@ def _compute_less(self):
}}
.o_mail_chat .o_mail_chat_sidebar .o_mail_chat_channel_item.o_active {{
background-color: {theme.left_panel_active_item_bg}!important;
box-shadow: inset 3px 0 0 darken({theme.left_panel_active_item_bg}, 10%);
}}
"""
)
Expand Down Expand Up @@ -697,7 +730,9 @@ def _compute_less(self):
.o_calendar_container .o_calendar_sidebar_container .ui-datepicker table .ui-state-active {{
background-color: darken({theme.content_form}, 25%);
}}

.o_calendar_container .o_calendar_sidebar_container .ui-datepicker table .ui-state-active:hover {{
background-color: darken({theme.content_form},15%) !important;
}}
.o_calendar_container .o_calendar_sidebar_container .ui-datepicker table td a:hover {{
background-color: darken({theme.content_form}, 25%);
}}
Expand Down Expand Up @@ -739,9 +774,6 @@ def _compute_less(self):
.o_calendar_container .o_calendar_sidebar_container .ui-datepicker table .ui-state-default {{
color: {theme.content_form_text};
}}
.o_calendar_container .o_calendar_sidebar_container .ui-datepicker table .ui-state-active {{
color: lighten({theme.content_form_text}, 30%)!important;
}}
.o_calendar_container .o_calendar_sidebar_container .ui-datepicker table thead {{
color: {theme.content_form_text};
}}
Expand All @@ -756,13 +788,14 @@ def _compute_less(self):
if self.content_form_link_active:
code = (
code
+ """ .o_main_content a {{
+ """ .o_main_content a:not(.btn-primary),
.o_form_view .o_form_uri:first-line {{
color: {theme.content_form_link};
}}
.o_control_panel .breadcrumb > li > a {{
color: {theme.content_form_link};
}}
.o_control_panel .dropdown-toggle {{
.o_control_panel .dropdown-toggle:not(.btn) {{
color: {theme.content_form_link};
}}
.o_control_panel .o_cp_right, .o_control_panel .o_pager_previous, .o_control_panel .o_pager_next {{
Expand Down Expand Up @@ -791,12 +824,83 @@ def _compute_less(self):
.o_main .e_tag {{
border: 1px solid {theme.content_button} !important;
}}
.o_form_view .oe_link, .o_field_widget.o_field_many2one .o_external_button {{
color: {theme.content_button} !important;
}}
.o_searchview_facet_label {{
background-color: {theme.content_button} !important;
}}
.o_searchview .o_searchview_facet .o_facet_remove {{
color: {theme.content_button} !important;
}}
.o_searchview .o_searchview_autocomplete li.o-selection-focus {{
color: {theme.content_button} !important;
}}
.o_searchview .o_searchview_autocomplete li.o-selection-focus {{
background-color: {theme.content_button};
}}
.ui-autocomplete .ui-menu-item.ui-state-focus,
.tooltip .tooltip-inner .oe_tooltip_string {{
background-color: {theme.content_button};
}}
.ui-autocomplete .ui-menu-item.o_m2o_dropdown_option > a,
.o_form_view .oe_button_box .oe_stat_button .o_button_icon,
.o_form_view .oe_button_box .oe_stat_button .o_stat_info .o_stat_value,
.o_form_view .oe_button_box .oe_stat_button > span .o_stat_value,
.o_web_settings_dashboard .o_web_settings_dashboard_col .o_web_settings_dashboard_planner .o_web_settings_dashboard_progress_title,
.btn-link {{
color: {theme.content_button};
}}
.datepicker .table-condensed > tbody > tr > td.active, .datepicker .table-condensed > tbody > tr > td .active,
.o_calendar_container .o_calendar_sidebar_container .ui-datepicker table .ui-state-active {{
background-color: {theme.content_button};
color: white;
}}
.o_calendar_container .o_calendar_sidebar_container .ui-datepicker table .ui-state-default:hover {{
background-color: lighten({theme.content_button}, 15%);
border-color: lighten({theme.content_button}, 15%);
}}
.o_calendar_container .o_calendar_sidebar_container .ui-datepicker table .o_selected_range.o_color {{
background-color: lighten({theme.content_button}, 15%);
animation: backgroundfade 3s forwards;
}}
.o_calendar_container .o_calendar_sidebar_container .ui-datepicker table {{
.ui-state-default.ui-state-hover.o_selected_range.o_color {{
color: black;
}}
}}
.bootstrap-datetimepicker-widget table td.today:before,
.datepicker .table-condensed > tbody > tr > td.today:before {{
border-bottom-color: {theme.content_button};
}}
.btn-link:hover, .btn-link:focus,
.o_form_view .o_form_uri:hover:first-line {{
color: lighten({theme.content_button}, 10%);
}}
.o_tooltip {{
background-color: {theme.content_button};
border: 2px solid {theme.content_button} !important;
}}
.o_tooltip.active.right::before, .o_tooltip.right::before {{
border-right-color: {theme.content_button};
}}
.o_tooltip.active.left::before, .o_tooltip.left::before {{
border-left-color: {theme.content_button};
}}
.o_tooltip.active.bottom::before, .o_tooltip.bottom::before {{
border-bottom-color: {theme.content_button};
}}
.o_tooltip.active.top::before, .o_tooltip.top::before {{
border-top-color: {theme.content_button};
}}
.o_tooltip::after {{
border-color: {theme.content_button};
background: radial-gradient(lighten({theme.content_button}, 5%), {theme.content_button});
}}
.o_field_widget.o_field_image .o_form_image_controls {{
background-color: {theme.content_button};
}}

"""
)
if self.content_text_active:
Expand Down
4 changes: 2 additions & 2 deletions web_website/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ def post_init_hook(cr, registry):
env = api.Environment(cr, SUPERUSER_ID, {})

# emulate updating existing field to website-dependent one
env.cr.execute("ALTER TABLE test_website_dependent ADD COLUMN foo VARCHAR")
env.cr.execute("ALTER TABLE test_website_dependent ADD COLUMN user_id INTEGER")
env.cr.execute("ALTER TABLE test_website_dependent ADD COLUMN IF NOT EXISTS foo VARCHAR")
env.cr.execute("ALTER TABLE test_website_dependent ADD COLUMN IF NOT EXISTS user_id INTEGER")
4 changes: 2 additions & 2 deletions web_website/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
"category": "Hidden",
# "live_test_url": "",
"images": [],
"version": "11.0.3.0.5",
"version": "11.0.3.0.6",
"application": False,
"author": "IT-Projects LLC, Ivan Yelizariev",
"author": "IT-Projects LLC, Ivan Yelizariev, Zell Co., Ltd.",
"support": "[email protected]",
"website": "https://it-projects.info/team/yelizariev",
"license": "Other OSI approved licence", # MIT
Expand Down