Browse Source

[REF] web_easy_switch_company. use new API ; new readme syntax ; add image description

[IMP] Add new setting to have the choice to go the home page, or to keep to the current view
pull/1129/head
Sylvain LE GAL 6 years ago
parent
commit
c541b1f58b
  1. 42
      web_easy_switch_company/README.rst
  2. 24
      web_easy_switch_company/__init__.py
  3. 67
      web_easy_switch_company/__openerp__.py
  4. 23
      web_easy_switch_company/controllers/__init__.py
  5. 26
      web_easy_switch_company/controllers/main.py
  6. 9
      web_easy_switch_company/data/ir_config_parameter.xml
  7. 9
      web_easy_switch_company/demo/res_company.xml
  8. 9
      web_easy_switch_company/demo/res_groups.xml
  9. 11
      web_easy_switch_company/demo/res_groups.yml
  10. 9
      web_easy_switch_company/demo/res_users.xml
  11. 57
      web_easy_switch_company/model/res_company.py
  12. 31
      web_easy_switch_company/model/res_users.py
  13. 3
      web_easy_switch_company/models/__init__.py
  14. 25
      web_easy_switch_company/models/res_company.py
  15. 14
      web_easy_switch_company/models/res_users.py
  16. 8
      web_easy_switch_company/readme/CONFIGURE.rst
  17. 1
      web_easy_switch_company/readme/CONTRIBUTORS.rst
  18. 9
      web_easy_switch_company/readme/DESCRIPTION.rst
  19. 1
      web_easy_switch_company/readme/ROADMAP.rst
  20. 2
      web_easy_switch_company/readme/USAGE.rst
  21. BIN
      web_easy_switch_company/static/description/switch_company_menu.png
  22. 4
      web_easy_switch_company/static/src/css/switch_company.css
  23. 0
      web_easy_switch_company/static/src/img/selection-off.png
  24. 0
      web_easy_switch_company/static/src/img/selection-on.png
  25. 94
      web_easy_switch_company/static/src/js/switch_company.js
  26. 25
      web_easy_switch_company/static/src/xml/switch_company.xml
  27. 25
      web_easy_switch_company/view/res_users_view.xml
  28. 11
      web_easy_switch_company/views/templates.xml
  29. 16
      web_easy_switch_company/views/view_res_users.xml

42
web_easy_switch_company/README.rst

@ -0,0 +1,42 @@
**This file is going to be generated by oca-gen-addon-readme.**
*Manual changes will be overwritten.*
Please provide content in the ``readme`` directory:
* **DESCRIPTION.rst** (required)
* INSTALL.rst (optional)
* CONFIGURE.rst (optional)
* **USAGE.rst** (optional, highly recommended)
* DEVELOP.rst (optional)
* ROADMAP.rst (optional)
* HISTORY.rst (optional, recommended)
* **CONTRIBUTORS.rst** (optional, highly recommended)
* CREDITS.rst (optional)
Content of this README will also be drawn from the addon manifest,
from keys such as name, authors, maintainers, development_status,
and license.
A good, one sentence summary in the manifest is also highly recommended.
**This file is going to be generated by oca-gen-addon-readme.**
*Manual changes will be overwritten.*
Please provide content in the ``readme`` directory:
* **DESCRIPTION.rst** (required)
* INSTALL.rst (optional)
* CONFIGURE.rst (optional)
* **USAGE.rst** (optional, highly recommended)
* DEVELOP.rst (optional)
* ROADMAP.rst (optional)
* HISTORY.rst (optional, recommended)
* **CONTRIBUTORS.rst** (optional, highly recommended)
* CREDITS.rst (optional)
Content of this README will also be drawn from the addon manifest,
from keys such as name, authors, maintainers, development_status,
and license.
A good, one sentence summary in the manifest is also highly recommended.

24
web_easy_switch_company/__init__.py

@ -1,23 +1,3 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# Web Easy Switch Company module for OpenERP
# Copyright (C) 2014 GRAP (http://www.grap.coop)
# @author Sylvain LE GAL (https://twitter.com/legalsylvain)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from . import model
# coding: utf-8
from . import models
from . import controllers

67
web_easy_switch_company/__openerp__.py

@ -1,56 +1,12 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# Web Easy Switch Company module for OpenERP
# Copyright (C) 2014 GRAP (http://www.grap.coop)
# @author Sylvain LE GAL (https://twitter.com/legalsylvain)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
# coding: utf-8
# Copyright (C) 2014 - Today: GRAP (http://www.grap.coop)
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
'name': 'Multicompany - Easy Switch Company',
'version': '8.0.1.0.0',
'version': '8.0.2.0.0',
'category': 'web',
'description': """
Add menu to allow user to switch to another company more easily
===============================================================
Functionality:
--------------
* Add a new menu in the top bar to switch to another company more easily;
* Remove the old behaviour to switch company;
Documentations:
---------------
* Video : http://www.youtube.com/watch?v=Cpm6dg-IEQQ
Technical information:
----------------------
* Create a field function 'logo_topbar' in res_company to have a good"""
"""resized logo;
Limits:
-------
* It would be interesting to show the structure of the companies;
Copyright, Author and Licence:
------------------------------
* Copyright: 2014, Groupement Régional Alimentaire de Proximité;
* Author: Sylvain LE GAL (https://twitter.com/legalsylvain);
* Licence: AGPL-3 (http://www.gnu.org/licenses/)""",
'author': "GRAP,Odoo Community Association (OCA)",
'website': 'http://www.grap.coop',
'license': 'AGPL-3',
@ -58,11 +14,20 @@ Copyright, Author and Licence:
'web',
],
'data': [
'view/res_users_view.xml',
'data/ir_config_parameter.xml',
'views/templates.xml',
'views/view_res_users.xml',
],
'qweb': [
'static/src/xml/switch_company.xml',
],
'demo': [
'demo/res_groups.xml',
'demo/res_company.xml',
'demo/res_users.xml',
],
'images': [
'static/description/switch_company_menu.png',
],
'installable': True,
'auto_install': False,
}

23
web_easy_switch_company/controllers/__init__.py

@ -1,23 +1,2 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# Web Easy Switch Company module for OpenERP
# Copyright (C) 2014 GRAP (http://www.grap.coop)
# @author Sylvain LE GAL (https://twitter.com/legalsylvain)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
# coding: utf-8
from . import main

26
web_easy_switch_company/controllers/main.py

@ -1,24 +1,8 @@
# -*- encoding: utf-8 -*-
# #############################################################################
#
# Web Easy Switch Company module for OpenERP
# Copyright (C) 2014 GRAP (http://www.grap.coop)
# @author Sylvain LE GAL (https://twitter.com/legalsylvain)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
#############################################################################
# coding: utf-8
# Copyright (C) 2014 - Today: GRAP (http://www.grap.coop)
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
import openerp
import openerp.http as http
from openerp.http import request

9
web_easy_switch_company/data/ir_config_parameter.xml

@ -0,0 +1,9 @@
<?xml version='1.0' encoding='UTF-8' ?>
<openerp><data noupdate="1">
<record id="keep_url" model="ir.config_parameter">
<field name="key">web_easy_switch_company.keep_url</field>
<field name="value">False</field>
</record>
</data></openerp>

9
web_easy_switch_company/demo/res_company.xml

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8" ?>
<openerp><data>
<record id="other_company" model="res.company">
<field name="name">Other Company</field>
</record>
</data></openerp>

9
web_easy_switch_company/demo/res_groups.xml

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8" ?>
<openerp><data>
<record id="base.group_multi_company" model="res.groups">
<field name="users" eval="[(4, ref('base.user_root'))]" />
</record>
</data></openerp>

11
web_easy_switch_company/model/__init__.py → web_easy_switch_company/demo/res_groups.yml

@ -1,8 +1,8 @@
# -*- encoding: utf-8 -*-
# -*- coding: utf-8 -*-
##############################################################################
#
# Web Easy Switch Company module for OpenERP
# Copyright (C) 2014 GRAP (http://www.grap.coop)
# OpenERP, Open Source Management Solution
# Copyright (C) 2015-Today GRAP
# @author Sylvain LE GAL (https://twitter.com/legalsylvain)
#
# This program is free software: you can redistribute it and/or modify
@ -20,5 +20,6 @@
#
##############################################################################
from . import res_users
from . import res_company
- !record {model: res.groups, id: base.group_no_one}:
users:
- base.user_root

9
web_easy_switch_company/demo/res_users.xml

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8" ?>
<openerp><data>
<record id="base.user_root" model="res.users">
<field name="company_ids" eval="[(4, ref('other_company'))]" />
</record>
</data></openerp>

57
web_easy_switch_company/model/res_company.py

@ -1,57 +0,0 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# Web Easy Switch Company module for OpenERP
# Copyright (C) 2014 GRAP (http://www.grap.coop)
# @author Sylvain LE GAL (https://twitter.com/legalsylvain)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from openerp.osv import fields
from openerp.osv.orm import Model
from openerp.tools import image_resize_image
class res_company(Model):
_inherit = 'res.company'
# Custom Section
def _switch_company_get_companies_from_partner(
self, cr, uid, ids, context=None):
return self.pool['res.company'].search(
cr, uid, [('partner_id', 'in', ids)], context=context)
# Fields function Section
def _get_logo_topbar(self, cr, uid, ids, _field_name, _args, context=None):
result = dict.fromkeys(ids, False)
for record in self.browse(cr, uid, ids, context=context):
size = (48, 48)
result[record.id] = image_resize_image(
record.partner_id.image, size)
return result
# Columns Section
_columns = {
'logo_topbar': fields.function(
_get_logo_topbar,
string="Logo displayed in the switch company menu",
type="binary", store={
'res.company': (lambda s, c, u, i, x: i, ['partner_id'], 10),
'res.partner': (_switch_company_get_companies_from_partner,
['image'], 10),
}
),
}

31
web_easy_switch_company/model/res_users.py

@ -1,31 +0,0 @@
# -*- encoding: utf-8 -*-
# #############################################################################
#
# Web Easy Switch Company module for OpenERP
# Copyright (C) 2014 GRAP (http://www.grap.coop)
# @author Sylvain LE GAL (https://twitter.com/legalsylvain)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from openerp.osv.orm import Model
class res_users(Model):
_inherit = 'res.users'
# Custom Function Section
def change_current_company(self, cr, uid, company_id, context=None):
return self.write(cr, uid, uid, {'company_id': company_id})

3
web_easy_switch_company/models/__init__.py

@ -0,0 +1,3 @@
# coding: utf-8
from . import res_users
from . import res_company

25
web_easy_switch_company/models/res_company.py

@ -0,0 +1,25 @@
# coding: utf-8
# Copyright (C) 2014 - Today: GRAP (http://www.grap.coop)
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import api, fields, models
from openerp.tools import image_resize_image
class ResCompany(models.Model):
_inherit = 'res.company'
# Columns Section
logo_topbar = fields.Binary(
compute='_compute_logo_topbar', store=True,
string="Logo displayed in the switch company menu")
# Compute Section
@api.multi
@api.depends('partner_id.image')
def _compute_logo_topbar(self):
for company in self:
size = (48, 48)
company.logo_topbar = image_resize_image(
company.partner_id.image, size)

14
web_easy_switch_company/models/res_users.py

@ -0,0 +1,14 @@
# coding: utf-8
# Copyright (C) 2014 - Today: GRAP (http://www.grap.coop)
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import api, models
class ResUsers(models.Model):
_inherit = 'res.users'
@api.model
def change_current_company(self, company_id):
return self.env.user.write({'company_id': company_id})

8
web_easy_switch_company/readme/CONFIGURE.rst

@ -0,0 +1,8 @@
When you switch the company, you can choose to stay on the current model and
item, you are viewing, or to go back to the home page. (by default)
To configure that setting:
* Go to 'Settings' / 'Technical' / 'Parameters' / 'system Parameters'
* Set the key ``web_easy_switch_company.keep_url`` to ``True`` to keep the url
when switching the company.

1
web_easy_switch_company/readme/CONTRIBUTORS.rst

@ -0,0 +1 @@
* Sylvain LE GAL (https://twitter.com/legalsylvain)

9
web_easy_switch_company/readme/DESCRIPTION.rst

@ -0,0 +1,9 @@
This module adds a new menu in the top bar to switch to another company more
easily and removes the old behaviour to switch company.
.. figure:: ../static/description/switch_company_menu.png
**Technical information**
It creates a field function ``logo_topbar`` on ``res.company`` to have a good
resized logo.

1
web_easy_switch_company/readme/ROADMAP.rst

@ -0,0 +1 @@
* It would be interesting to show the structure of the companies

2
web_easy_switch_company/readme/USAGE.rst

@ -0,0 +1,2 @@
* Video : http://www.youtube.com/watch?v=Cpm6dg-IEQQ

BIN
web_easy_switch_company/static/description/switch_company_menu.png

After

Width: 421  |  Height: 123  |  Size: 14 KiB

4
web_easy_switch_company/static/src/css/switch_company.css

@ -1,5 +1,5 @@
.switch_company_menu {
height: auto;
max-height: 50vh;
max-height: 100vh;
overflow-x: hidden;
cursor: pointer;
}

0
web_easy_switch_company/static/description/selection-off.png → web_easy_switch_company/static/src/img/selection-off.png

Before

Width: 16  |  Height: 16  |  Size: 112 B

After

Width: 16  |  Height: 16  |  Size: 112 B

0
web_easy_switch_company/static/description/selection-on.png → web_easy_switch_company/static/src/img/selection-on.png

Before

Width: 16  |  Height: 16  |  Size: 445 B

After

Width: 16  |  Height: 16  |  Size: 445 B

94
web_easy_switch_company/static/src/js/switch_company.js

@ -1,20 +1,9 @@
/******************************************************************************
Web Easy Switch Company module for OpenERP
Copyright (C) 2014 GRAP (http://www.grap.coop)
@author Sylvain LE GAL (https://twitter.com/legalsylvain)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Copyright (C) 2014 - Today: GRAP (http://www.grap.coop)
@author: Sylvain LE GAL (https://twitter.com/legalsylvain)
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
******************************************************************************/
openerp.web_easy_switch_company = function (instance) {
@ -54,6 +43,7 @@ openerp.web_easy_switch_company = function (instance) {
*/
renderElement: function() {
var self = this;
this._super();
if (this.companies.length === 1) {
this.$el.hide();
@ -62,13 +52,19 @@ openerp.web_easy_switch_company = function (instance) {
this.$el.show();
this.$el.find('.easy_switch_company_company_item').on('click', function(ev) {
var company_id = $(ev.target).data("company-id");
if (company_id != self.current_company_id){
var func = '/web_easy_switch_company/switch/change_current_company';
var param = {'company_id': company_id}
self.rpc(func, param).done(function(res) {
window.location.reload()
if (self.easy_switch_company_keep_url) {
window.location.reload();
} else {
if (self.session.debug) {
window.location = "/web/?debug";
} else {
window.location = "/web";
}
}
});
}
});
@ -105,33 +101,43 @@ openerp.web_easy_switch_company = function (instance) {
// user_preference=True in the context does
// not work either.
new instance.web.Model('res.company').call('name_search',{context:{'user_preference':'True'}}).then(function(res){
var res_company = res;
for ( var i=0 ; i < res_company.length; i++) {
var logo_topbar, logo_state;
// TODO: fetching the logo of other companies fails with the
// default res.company record rule, so we should
// probably remove the logos from the menu :(
logo_topbar = self.session.url(
'/web/binary/image', {
model:'res.company',
field: 'logo_topbar',
id: res_company[i][0]
});
if (res_company[i][0] == self.current_company_id){
logo_state = '/web_easy_switch_company/static/description/selection-on.png';
self._fetch('ir.config_parameter', ['value'], [['key', '=', 'web_easy_switch_company.keep_url']]).then(function(res_config){
if (res_config.length === 1 && res_config[0].value === 'True'){
self.easy_switch_company_keep_url = true;
}
else{
logo_state = '/web_easy_switch_company/static/description/selection-off.png';
else {
self.easy_switch_company_keep_url = false;
}
self.companies.push({
id: res_company[i][0],
name: res_company[i][1],
logo_topbar: logo_topbar,
logo_state: logo_state
});
}
// Update rendering
self.renderElement();
var res_company = res;
for ( var i=0 ; i < res_company.length; i++) {
var logo_topbar, logo_state;
// TODO: fetching the logo of other companies fails with the
// default res.company record rule, so we should
// probably remove the logos from the menu :(
logo_topbar = self.session.url(
'/web/binary/image', {
model:'res.company',
field: 'logo_topbar',
id: res_company[i][0]
});
if (res_company[i][0] == self.current_company_id){
logo_state = '/web_easy_switch_company/static/src/img/selection-on.png';
}
else{
logo_state = '/web_easy_switch_company/static/src/img/selection-off.png';
}
self.companies.push({
id: res_company[i][0],
name: res_company[i][1],
logo_topbar: logo_topbar,
logo_state: logo_state
});
}
// Update rendering
self.renderElement();
});
});
});
},

25
web_easy_switch_company/static/src/xml/switch_company.xml

@ -1,23 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- ********************************************************************** -->
<!-- -->
<!--Web Easy Switch Company module for OpenERP -->
<!--Copyright (C) 2014 GRAP (http://www.grap.coop) -->
<!--@author Sylvain LE GAL (https://twitter.com/legalsylvain) -->
<!--This program is free software: you can redistribute it and/or modify -->
<!--it under the terms of the GNU Affero General Public License as -->
<!--published by the Free Software Foundation, either version 3 of the -->
<!--License, or (at your option) any later version. -->
<!-- -->
<!--This program is distributed in the hope that it will be useful, -->
<!--but WITHOUT ANY WARRANTY; without even the implied warranty of -->
<!--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -->
<!--GNU Affero General Public License for more details. -->
<!-- -->
<!--You should have received a copy of the GNU Affero General Public License-->
<!--along with this program. If not, see <http://www.gnu.org/licenses/>. -->
<!-- ********************************************************************** -->
<!--
Copyright (C) 2014 - Today: GRAP (http://www.grap.coop)
@author: Sylvain LE GAL (https://twitter.com/legalsylvain)
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
-->
<template>
<t t-name="web_easy_switch_company.SwitchCompanyWidget">
@ -33,7 +19,6 @@
<t t-foreach="widget.companies" t-as="company">
<li>
<a class="easy_switch_company_company_item"
href="#"
t-att-data-company-id="company.id">
<img class="oe_topbar_avatar" t-att-src="company.logo_topbar"/>
<img class="oe_topbar_avatar" t-att-src="company.logo_state"/>

25
web_easy_switch_company/view/res_users_view.xml

@ -1,25 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<data>
<record id="view_res_users_simple_modif_form" model="ir.ui.view">
<field name="name">res.users.form</field>
<field name="model">res.users</field>
<field name="inherit_id" ref="base.view_users_form_simple_modif"/>
<field name="arch" type="xml">
<!-- hide old behaviour to change company -->
<field name="company_id" position="attributes">
<attribute name="invisible">1</attribute>
</field>
</field>
</record>
<template id="assets_backend" name="web_easy_switch_company assets" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<script type="text/javascript" src="/web_easy_switch_company/static/src/js/switch_company.js"></script>
<link rel="stylesheet" href="/web_easy_switch_company/static/src/css/switch_company.css"/>
</xpath>
</template>
</data>
</openerp>

11
web_easy_switch_company/views/templates.xml

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<openerp><data>
<template id="assets_backend" name="web_easy_switch_company assets" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<script type="text/javascript" src="/web_easy_switch_company/static/src/js/switch_company.js"></script>
<link rel="stylesheet" href="/web_easy_switch_company/static/src/css/switch_company.css"/>
</xpath>
</template>
</data></openerp>

16
web_easy_switch_company/views/view_res_users.xml

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<openerp><data>
<record id="view_res_users_simple_modif_form" model="ir.ui.view">
<field name="name">res.users.form</field>
<field name="model">res.users</field>
<field name="inherit_id" ref="base.view_users_form_simple_modif"/>
<field name="arch" type="xml">
<!-- hide old behaviour to change company -->
<field name="company_id" position="attributes">
<attribute name="invisible">1</attribute>
</field>
</field>
</record>
</data></openerp>
Loading…
Cancel
Save