[IMP] base: Remove group toggle_multi_company

Fp request
This commit is contained in:
Yannick Tivisse
2019-06-04 14:01:42 +02:00
parent 3d06a77393
commit 2996e7645f
10 changed files with 12 additions and 51 deletions
@@ -9,7 +9,6 @@ class ResConfigSettings(models.TransientModel):
_inherit = 'res.config.settings'
group_multi_company = fields.Boolean("Manage multiple companies", implied_group='base.group_multi_company')
group_toggle_company = fields.Boolean("Toggle multiple companies", implied_group='base.group_toggle_company')
company_id = fields.Many2one('res.company', string='Company', required=True,
default=lambda self: self.env.company)
user_default_rights = fields.Boolean(
@@ -141,18 +141,6 @@
</div>
</div>
</div>
<div class="col-12 col-lg-6 o_setting_box">
<div class="o_setting_left_pane">
<field name="group_toggle_company"/>
</div>
<div class="o_setting_right_pane">
<label string="Multi-companies by Tab" for="group_toggle_company"/>
<div class="text-muted">
Manage multiple companies on the same browser tab. Be careful that this advanced tool should
only be used for reporting purpose.
</div>
</div>
</div>
<div class="col-12 col-lg-6 o_setting_box" title="Configure company rules to automatically create SO/PO when one of your company sells/buys to another of your company." attrs="{'invisible': [('group_multi_company', '=', False)]}" id="inter_company">
<div class="o_setting_left_pane">
<field name="module_inter_company_rules" widget="upgrade_boolean"/>
+2 -7
View File
@@ -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()
-1
View File
@@ -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,
@@ -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) {
+10 -12
View File
@@ -1582,18 +1582,16 @@
</span>
</t>
</div>
<t t-if="widget.toggle_company">
<div class="ml-auto pl-3 pr-3 border border-top-0 border-right-0 border-bottom-0 toggle_company o_py">
<span style="height: 2rem;">
<t t-if="widget.allowed_company_ids.includes(company[0].toString())">
<i class="fa fa-fw fa-check-square pt-2"></i>
</t>
<t t-if="!widget.allowed_company_ids.includes(company[0].toString())">
<i class="fa fa-fw fa-square-o pt-2"></i>
</t>
</span>
</div>
</t>
<div class="ml-auto pl-3 pr-3 border border-top-0 border-right-0 border-bottom-0 toggle_company o_py">
<span style="height: 2rem;">
<t t-if="widget.allowed_company_ids.includes(company[0].toString())">
<i class="fa fa-fw fa-check-square pt-2"></i>
</t>
<t t-if="!widget.allowed_company_ids.includes(company[0].toString())">
<i class="fa fa-fw fa-square-o pt-2"></i>
</t>
</span>
</div>
</div>
</t>
</div>
-1
View File
@@ -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,
@@ -110,9 +110,5 @@
<field name="category_id" ref="module_category_usability"/>
</record>
<record id="group_toggle_company" model="res.groups">
<field name="category_id" ref="module_category_hidden"/>
</record>
</data>
</odoo>
@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data noupdate="1">
<record id="group_toggle_company" model="res.groups">
<field name="users" eval="[(4, ref('base.user_root')), (4, ref('base.user_admin'))]"/>
</record>
</data>
</odoo>
@@ -41,10 +41,6 @@
<field name="users" eval="[(4, ref('base.user_root')), (4, ref('base.user_admin'))]"/>
</record>
<record id="group_toggle_company" model="res.groups">
<field name="name">Allow to toggle company visibility in the company switch bar</field>
</record>
<record model="res.groups" id="group_partner_manager">
<field name="name">Contact Creation</field>
<field name="users" eval="[(4, ref('base.user_root')), (4, ref('base.user_admin'))]"/>