Skip to content

Commit

Permalink
Merge pull request #1093 from trojikman/11.0-web_website-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
itpp-bot authored Feb 11, 2021
2 parents d40745a + 1ff2d91 commit e14ec13
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 13 deletions.
9 changes: 7 additions & 2 deletions web_website/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright 2021 Zell Co., Ltd.
# License MIT (https://opensource.org/licenses/MIT).
from . import models

Expand All @@ -8,5 +9,9 @@ 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"
)
2 changes: 1 addition & 1 deletion web_website/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"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",
"support": "[email protected]",
Expand Down
5 changes: 5 additions & 0 deletions web_website/doc/changelog.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
`3.0.5`
-------

- **Fix:** reinstallation error by adding IF NOT EXISTS

`3.0.5`
-------
- **Fix:** _get_website_id could return SUPERUSER_ID's website instead of current user
Expand Down
12 changes: 6 additions & 6 deletions web_website/static/src/js/switch_website_menu.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright 2018 Ivan Yelizariev <https://it-projects.info/team/yelizariev>
// License MIT (https://opensource.org/licenses/MIT).
odoo.define("web_website.SwitchWebsiteMenu", function(require) {
odoo.define("web_website.SwitchWebsiteMenu", function (require) {
"use strict";

var session = require("web.session");
Expand All @@ -11,19 +11,19 @@ odoo.define("web_website.SwitchWebsiteMenu", function(require) {

var SwitchWebsiteMenu = Widget.extend({
template: "SwitchWebsiteMenu",
willStart: function() {
willStart: function () {
if (!session.user_websites) {
return $.Deferred().reject();
}
return this._super();
},
start: function() {
start: function () {
var self = this;
this.$el.on(
"click",
".dropdown-menu li a[data-menu]",
_.debounce(
function(ev) {
function (ev) {
ev.preventDefault();
// Write method ignores undefinded
var website_id =
Expand All @@ -32,7 +32,7 @@ odoo.define("web_website.SwitchWebsiteMenu", function(require) {
model: "res.users",
method: "write",
args: [[session.uid], {backend_website_id: website_id}],
}).then(function() {
}).then(function () {
location.reload();
});
},
Expand All @@ -53,7 +53,7 @@ odoo.define("web_website.SwitchWebsiteMenu", function(require) {

var websites = session.user_websites.allowed_websites;
websites.unshift(false);
_.each(websites, function(website) {
_.each(websites, function (website) {
var a = "";
if (
(!website && !current_website) ||
Expand Down
2 changes: 1 addition & 1 deletion web_website/static/src/js/tour.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright 2018 Ivan Yelizariev <https://it-projects.info/team/yelizariev>
// License MIT (https://opensource.org/licenses/MIT).
odoo.define("web_website.tour", function(require) {
odoo.define("web_website.tour", function (require) {
"use strict";

var tour = require("web_tour.tour");
Expand Down
6 changes: 3 additions & 3 deletions web_website/views/res_config_settings_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
</div>
<div class="o_setting_right_pane">
<label string="Multi-website" for="group_multi_website" />
<div
class="text-muted"
> Show Website Switcher in backend </div>
<div class="text-muted">
Show Website Switcher in backend
</div>
</div>
</div>
</div>
Expand Down

0 comments on commit e14ec13

Please sign in to comment.