+
diff --git a/addons/mail/controllers/main.py b/addons/mail/controllers/main.py
index e617935120a..39b7c53ddf5 100644
--- a/addons/mail/controllers/main.py
+++ b/addons/mail/controllers/main.py
@@ -85,18 +85,13 @@ class MailController(http.Controller):
# - Guess the supposed necessary company to access the record via the method
# _get_mail_redirect_suggested_company
# - If no company, then redirect to the messaging
- # - If the multi company per tag group is activated, merge the suggested company
- # withe the companies on the cookie
- # - else, use this company as enabled company
+ # - Merge the suggested company with the companies on the cookie
# - Make a new access test if it succeeds, redirect to the record. Otherwise,
# redirect to the messaging.
suggested_company = record_sudo._get_mail_redirect_suggested_company()
if not suggested_company:
raise AccessError()
- if user.has_group('base.group_toggle_company'):
- cids += [suggested_company.id]
- else:
- cids = [suggested_company.id]
+ cids += [suggested_company.id]
record_sudo.sudo(uid).with_context(allowed_company_ids=cids).check_access_rule('read')
except AccessError:
return cls._redirect_to_messaging()
diff --git a/addons/stock/data/stock_demo.xml b/addons/stock/data/stock_demo.xml
index f95d8e0936e..43154eef9f8 100644
--- a/addons/stock/data/stock_demo.xml
+++ b/addons/stock/data/stock_demo.xml
@@ -164,6 +164,10 @@
+
+
+
+
My Company (San Francisco)
diff --git a/addons/web/models/ir_http.py b/addons/web/models/ir_http.py
index 7ae119c02d3..d4280e7f25a 100644
--- a/addons/web/models/ir_http.py
+++ b/addons/web/models/ir_http.py
@@ -56,7 +56,6 @@ class Http(models.AbstractModel):
"web.base.url": self.env['ir.config_parameter'].sudo().get_param('web.base.url', default=''),
"show_effect": True,
"display_switch_company_menu": user.has_group('base.group_multi_company') and len(user.company_ids) > 1,
- "toggle_company": user.has_group('base.group_toggle_company'),
"cache_hashes": {
"load_menus": hashlib.sha1(menu_json_utf8).hexdigest(),
"qweb": qweb_checksum,
diff --git a/addons/web/static/src/js/widgets/switch_company_menu.js b/addons/web/static/src/js/widgets/switch_company_menu.js
index 4b52b879447..62e2a27f3d0 100644
--- a/addons/web/static/src/js/widgets/switch_company_menu.js
+++ b/addons/web/static/src/js/widgets/switch_company_menu.js
@@ -31,7 +31,6 @@ var SwitchCompanyMenu = Widget.extend({
this._onSwitchCompanyClick = _.debounce(this._onSwitchCompanyClick, 1500, true);
this.allowed_company_ids = String(session.user_context.allowed_company_ids).split(',');
this.user_companies = session.user_companies.allowed_companies;
- this.toggle_company = session.toggle_company;
var hash = $.bbq.getState()
if (!hash.cids || hash.cids === undefined) {
@@ -52,16 +51,21 @@ var SwitchCompanyMenu = Widget.extend({
* @param {MouseEvent} ev
*/
_onSwitchCompanyClick: function (ev) {
- ev.preventDefault();
- var companyID = $(ev.currentTarget).parent().data('company-id');
+ ev.stopPropagation();
+ var dropdownItem = $(ev.currentTarget).parent()
+ var dropdownMenu = dropdownItem.parent()
+ var companyID = dropdownItem.data('company-id');
var hash = $.bbq.getState()
var allowed_company_ids = _.map(hash.cids.split(','), function(company_id) {return parseInt(company_id);});
- if ($($(ev.currentTarget).parent()).find('.fa-square-o').length) {
+ if (dropdownItem.find('.fa-square-o').length) {
// 1 enabled company: Stay in single company mode
if (this.allowed_company_ids.length === 1) {
- allowed_company_ids = [companyID]
+ dropdownMenu.find('.fa-check-square').removeClass('fa-check-square').addClass('fa-square-o');
+ dropdownItem.find('.fa-square-o').removeClass('fa-square-o').addClass('fa-check-square');
+ allowed_company_ids = [companyID]
} else { // Multi company mode
allowed_company_ids.push(companyID);
+ dropdownItem.find('.fa-square-o').removeClass('fa-square-o').addClass('fa-check-square');
}
}
session.setCompanies(companyID, allowed_company_ids);
@@ -76,14 +80,19 @@ var SwitchCompanyMenu = Widget.extend({
* @param {MouseEvent} ev
*/
_onToggleCompanyClick: function (ev) {
- var companyID = $(ev.currentTarget).parent().data('company-id');
+ ev.stopPropagation();
+ var dropdownItem = $(ev.currentTarget).parent()
+ var dropdownMenu = dropdownItem.parent()
+ var companyID = dropdownItem.data('company-id');
var hash = $.bbq.getState()
var allowed_company_ids = _.map(hash.cids.split(','), function(company_id) {return parseInt(company_id);});
var current_company_id = allowed_company_ids[0];
- if ($(ev.currentTarget).find('.fa-square-o').length) {
+ if (dropdownItem.find('.fa-square-o').length) {
allowed_company_ids.push(companyID);
+ dropdownItem.find('.fa-square-o').removeClass('fa-square-o').addClass('fa-check-square');
} else {
allowed_company_ids.splice(allowed_company_ids.indexOf(companyID), 1);
+ dropdownItem.find('.fa-check-square').addClass('fa-square-o').removeClass('fa-check-square');
}
session.setCompanies(current_company_id, allowed_company_ids);
},
diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml
index 77e8ab075b1..e46c256b851 100644
--- a/addons/web/static/src/xml/base.xml
+++ b/addons/web/static/src/xml/base.xml
@@ -1570,6 +1570,16 @@
+
+
+
+
+
+
+
+
+
+
@@ -1582,18 +1592,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/odoo/addons/base/__manifest__.py b/odoo/addons/base/__manifest__.py
index f32d529a487..d47214a5ce9 100644
--- a/odoo/addons/base/__manifest__.py
+++ b/odoo/addons/base/__manifest__.py
@@ -80,7 +80,6 @@ The kernel of Odoo, needed for all installation.
'data/res_bank_demo.xml',
'data/res_partner_demo.xml',
'data/res_partner_image_demo.xml',
- 'data/res_groups_demo.xml',
],
'test': [],
'installable': True,
diff --git a/odoo/addons/base/data/ir_module_category_data.xml b/odoo/addons/base/data/ir_module_category_data.xml
index 7b06f7437d6..d99fed12077 100644
--- a/odoo/addons/base/data/ir_module_category_data.xml
+++ b/odoo/addons/base/data/ir_module_category_data.xml
@@ -110,9 +110,5 @@
-
-
-
-
diff --git a/odoo/addons/base/data/res_groups_demo.xml b/odoo/addons/base/data/res_groups_demo.xml
deleted file mode 100644
index 66d728ff776..00000000000
--- a/odoo/addons/base/data/res_groups_demo.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
diff --git a/odoo/addons/base/models/res_company.py b/odoo/addons/base/models/res_company.py
index 65d434d61db..d9f35d76276 100644
--- a/odoo/addons/base/models/res_company.py
+++ b/odoo/addons/base/models/res_company.py
@@ -43,20 +43,23 @@ class Company(models.Model):
with tools.file_open(img_path, 'rb') as f:
if original:
return base64.b64encode(f.read())
- # Modify the source image to change the color of the 'O'.
+ # Modify the source image to add a colored bar on the bottom
# This could seem overkill to modify the pixels 1 by 1, but
# Pillow doesn't provide an easy way to do it, and this
# is acceptable for a 16x16 image.
color = (randrange(32, 224, 24), randrange(32, 224, 24), randrange(32, 224, 24))
original = Image.open(f)
new_image = Image.new('RGBA', original.size)
- for y in range(original.size[1]):
- for x in range(original.size[0]):
+ height = original.size[1]
+ width = original.size[0]
+ bar_size = 1
+ for y in range(height):
+ for x in range(width):
pixel = original.getpixel((x, y))
- if pixel[0] == 0 and pixel[1] == 0 and pixel[2] == 0:
- new_image.putpixel((x, y), (0, 0, 0, 0))
+ if height - bar_size <= y + 1 <= height:
+ new_image.putpixel((x, y), (color[0], color[1], color[2], 255))
else:
- new_image.putpixel((x, y), (color[0], color[1], color[2], pixel[3]))
+ new_image.putpixel((x, y), (pixel[0], pixel[1], pixel[2], pixel[3]))
stream = io.BytesIO()
new_image.save(stream, format="ICO")
return base64.b64encode(stream.getvalue())
diff --git a/odoo/addons/base/security/base_groups.xml b/odoo/addons/base/security/base_groups.xml
index 10541a1a4df..3bdf8ee3928 100644
--- a/odoo/addons/base/security/base_groups.xml
+++ b/odoo/addons/base/security/base_groups.xml
@@ -41,10 +41,6 @@
-
- Allow to toggle company visibility in the company switch bar
-
-
Contact Creation
diff --git a/odoo/addons/base/views/res_company_views.xml b/odoo/addons/base/views/res_company_views.xml
index c0138c94529..c835527c8c2 100644
--- a/odoo/addons/base/views/res_company_views.xml
+++ b/odoo/addons/base/views/res_company_views.xml
@@ -38,7 +38,7 @@
-
+