From f4a77965101817374df4186de01020855f627384 Mon Sep 17 00:00:00 2001 From: Sylvain LE GAL Date: Mon, 17 Oct 2016 01:22:47 +0200 Subject: [PATCH] [REF] remove web_easy_switch_company. feature is now in the Odoo web Module --- web_easy_switch_company/README.rst | 92 ----------- web_easy_switch_company/__init__.py | 23 --- web_easy_switch_company/__manifest__.py | 41 ----- .../controllers/__init__.py | 23 --- web_easy_switch_company/controllers/main.py | 38 ----- web_easy_switch_company/model/__init__.py | 24 --- web_easy_switch_company/model/res_company.py | 57 ------- web_easy_switch_company/model/res_users.py | 31 ---- .../static/description/icon.png | Bin 6125 -> 0 bytes .../static/description/selection-off.png | Bin 112 -> 0 bytes .../static/description/selection-on.png | Bin 445 -> 0 bytes .../static/src/js/switch_company.js | 152 ------------------ .../static/src/xml/switch_company.xml | 49 ------ .../view/res_users_view.xml | 24 --- 14 files changed, 554 deletions(-) delete mode 100644 web_easy_switch_company/README.rst delete mode 100644 web_easy_switch_company/__init__.py delete mode 100644 web_easy_switch_company/__manifest__.py delete mode 100644 web_easy_switch_company/controllers/__init__.py delete mode 100644 web_easy_switch_company/controllers/main.py delete mode 100644 web_easy_switch_company/model/__init__.py delete mode 100644 web_easy_switch_company/model/res_company.py delete mode 100644 web_easy_switch_company/model/res_users.py delete mode 100644 web_easy_switch_company/static/description/icon.png delete mode 100644 web_easy_switch_company/static/description/selection-off.png delete mode 100644 web_easy_switch_company/static/description/selection-on.png delete mode 100644 web_easy_switch_company/static/src/js/switch_company.js delete mode 100644 web_easy_switch_company/static/src/xml/switch_company.xml delete mode 100644 web_easy_switch_company/view/res_users_view.xml diff --git a/web_easy_switch_company/README.rst b/web_easy_switch_company/README.rst deleted file mode 100644 index 7b017a23..00000000 --- a/web_easy_switch_company/README.rst +++ /dev/null @@ -1,92 +0,0 @@ -.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg - :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html - :alt: License: AGPL-3 - -======================= -web_easy_switch_company -======================= - -This module extend web backend and allow user to switch to another company more easily. - -Configuration -============= - -To configure this module, you need to: - -* Enable multi company in your odoo instance -* Add your user in at least 2 companies, and you will see the switch at the upper right corner - -Usage -===== - -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; - -.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas - :alt: Try me on Runbot - :target: https://runbot.odoo-community.org/runbot/162/9.0 - - -Known issues / Roadmap -====================== - -Bug Tracker -=========== - -Bugs are tracked on `GitHub Issues -`_. In case of trouble, please -check there if your issue has already been reported. If you spotted it first, -help us smashing it by providing a detailed and welcomed `feedback -`_. - -Credits -======= - -Images ------- - -* Odoo Community Association: `Icon `_. - -Contributors ------------- - -* Copyright: 2014, Groupement Régional Alimentaire de Proximité; -* Author: Sylvain LE GAL (https://twitter.com/legalsylvain); -* Contributor: Nicolas JEUDY - Sudokeys (https://github.com/njeudy) - -Maintainer ----------- - -.. image:: https://odoo-community.org/logo.png - :alt: Odoo Community Association - :target: https://odoo-community.org - -This module is maintained by the OCA. - -OCA, or the Odoo Community Association, is a nonprofit organization whose -mission is to support the collaborative development of Odoo features and -promote its widespread use. - -To contribute to this module, please visit https://odoo-community.org. diff --git a/web_easy_switch_company/__init__.py b/web_easy_switch_company/__init__.py deleted file mode 100644 index 546a4603..00000000 --- a/web_easy_switch_company/__init__.py +++ /dev/null @@ -1,23 +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 . -# -############################################################################## -from . import model -from . import controllers diff --git a/web_easy_switch_company/__manifest__.py b/web_easy_switch_company/__manifest__.py deleted file mode 100644 index 6f3d4432..00000000 --- a/web_easy_switch_company/__manifest__.py +++ /dev/null @@ -1,41 +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 . -# -############################################################################## - -{ - 'name': 'Multicompany - Easy Switch Company', - 'version': '9.0.1.0.0', - 'category': 'web', - 'author': "GRAP,Sudokeys,Odoo Community Association (OCA)", - 'website': 'http://www.grap.coop', - 'license': 'AGPL-3', - 'depends': [ - 'web', - ], - 'data': [ - 'view/res_users_view.xml', - ], - 'qweb': [ - 'static/src/xml/switch_company.xml', - ], - 'installable': False, - 'auto_install': False, -} diff --git a/web_easy_switch_company/controllers/__init__.py b/web_easy_switch_company/controllers/__init__.py deleted file mode 100644 index b40fe569..00000000 --- a/web_easy_switch_company/controllers/__init__.py +++ /dev/null @@ -1,23 +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 . -# -############################################################################## - -from . import main diff --git a/web_easy_switch_company/controllers/main.py b/web_easy_switch_company/controllers/main.py deleted file mode 100644 index 87221880..00000000 --- a/web_easy_switch_company/controllers/main.py +++ /dev/null @@ -1,38 +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 . -# -############################################################################# -import openerp -import openerp.http as http -from openerp.http import request - - -class WebEasySwitchCompanyController(http.Controller): - @http.route( - '/web_easy_switch_company/switch/change_current_company', - type='json', auth='none') - def change_current_company(self, company_id): - registry = openerp.modules.registry.RegistryManager.get( - request.session.db) - uid = request.session.uid - with registry.cursor() as cr: - res = registry.get("res.users").change_current_company( - cr, uid, company_id) - return res diff --git a/web_easy_switch_company/model/__init__.py b/web_easy_switch_company/model/__init__.py deleted file mode 100644 index e1bd2b92..00000000 --- a/web_easy_switch_company/model/__init__.py +++ /dev/null @@ -1,24 +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 . -# -############################################################################## - -from . import res_users -from . import res_company diff --git a/web_easy_switch_company/model/res_company.py b/web_easy_switch_company/model/res_company.py deleted file mode 100644 index 000e21e1..00000000 --- a/web_easy_switch_company/model/res_company.py +++ /dev/null @@ -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 . -# -############################################################################## - -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), - } - ), - } diff --git a/web_easy_switch_company/model/res_users.py b/web_easy_switch_company/model/res_users.py deleted file mode 100644 index c2ab2c13..00000000 --- a/web_easy_switch_company/model/res_users.py +++ /dev/null @@ -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 . -# -############################################################################## - -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}) diff --git a/web_easy_switch_company/static/description/icon.png b/web_easy_switch_company/static/description/icon.png deleted file mode 100644 index ee270eb32c8a2a81c134da15e544c50f69d07315..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6125 zcma)Ahd)(++`mR5JDbSL&WMn#>}wOUZ`s))D_M~h3R#yH!cV#hNiMR=-g{+_Y_iw$ zxz8W)yq@!VUB|um+;hI?^ZC5jiP6_pC%?pe34uV6BQ;bEVIPWn5fj1R2KfhVup{(V zLK+dn7DQ|p4ev=jHO#yb2#QAB3-7fc1q*!0rg?hmAcu((Qqx zy`lXByMRY6_Ob{BgELa)j*)-XTJ{tDl*NgCh5a|fR`<>5Q%kR0puS)uL7$>x!Bw^; zAy%xjsFSISmb5*N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^SO`kW7{>0Lb|=}_7Dn@*w%B?3xGBu?`H4qf`uXV9cQB-*Cm14Y_{HwQF9JC; l{slUC1oHpe9E8rv<=v8RgkBuQz@vEtQdL*wv(o+W{{d)*p0WS{ diff --git a/web_easy_switch_company/static/description/selection-off.png b/web_easy_switch_company/static/description/selection-off.png deleted file mode 100644 index c8e922cc52b4e47aeb67397084070164ae6db15a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 112 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`EX7WqAsj$Z!;#Vf4nJ z@ErkR#;MwT(m+8WPZ!4!i{9h}3D(64B0WqTKz#xXjP<@1eLz_TPgg&ebxsLQ09bVu A-T(jq diff --git a/web_easy_switch_company/static/description/selection-on.png b/web_easy_switch_company/static/description/selection-on.png deleted file mode 100644 index 8faf7d4def9060c05b2bd335adc56a42a13834e4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 445 zcmV;u0Yd(XP)F4y14e=>LK&E2J>|n? zM3tMqe1E_4{`>1Qx1|4g1e0bWq~F(`Pf=Y~KUqghTTw+?JC=t@Knq!(paDwaYN?V^ z5|+RIePwv@{^_x|zh9g~mS;ic7|<^RGU_VE+L`?HM<-@N)+4HRY6)0sH`a(sCC z_0fZ;H>T{)Vt9qq04-K|S0!!jqDL=p9pq`hvshVLFJD|zjPLuekALqyyuI%IkLRb+ zU5FBh6`SqP*&4X&{r>ZZ@yhLUuM}jIc)zp1. -******************************************************************************/ - -odoo.define('web.web_easy_switch_company',function (require) { - - "use strict"; - - var Widget = require('web.Widget'); - var SystrayMenu = require('web.SystrayMenu'); - var web_client = require('web.web_client'); - var Model = require('web.Model'); - - /*************************************************************************** - Create an new 'SwitchCompanyWidget' widget that allow users to switch - from a company to another more easily. - ***************************************************************************/ - var SwitchCompanyWidget = Widget.extend({ - - template:'web_easy_switch_company.SwitchCompanyWidget', - - /*********************************************************************** - Overload section - ***********************************************************************/ - - /** - * Overload 'init' function to initialize the values of the widget. - */ - init: function(parent){ - this._super(parent); - this.companies = []; - this.current_company_id = 0; - this.current_company_name = ''; - }, - - /** - * Overload 'start' function to load datas from DB. - */ - start: function () { - this._super(); - this._load_data(); - }, - - /** - * Overload 'renderElement' function to set events on company items. - */ - renderElement: function() { - var self = this; - this._super(); - if (this.companies.length === 1) { - this.$el.hide(); - } - else{ - 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() - }); - } - }); - } - }, - - - /*********************************************************************** - Custom section - ***********************************************************************/ - - /** - * helper function to load data from the server - */ - _fetch: function(model, fields, domain, ctx){ - return new Model(model).query(fields).filter(domain).context(ctx).all(); - }, - - /** - * - Load data of the companies allowed to the current users; - * - Launch the rendering of the current widget; - */ - _load_data: function(){ - var self = this; - // Request for current users information - - this._fetch('res.users',['company_id'],[['id','=',this.session.uid]]).then(function(res_users){ - self.current_company_id = res_users[0].company_id[0]; - self.current_company_name = res_users[0].company_id[1]; - // Request for other companies - // We have to go through fields_view_get to emulate the - // exact (exotic) behavior of the user preferences form in - // fetching the allowed companies wrt record rules. - // Note: calling res.company.name_search with - // user_preference=True in the context does - // not work either. - new 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'; - } - else{ - logo_state = '/web_easy_switch_company/static/description/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(); - }); - }); - }, - - }); - -SystrayMenu.Items.push(SwitchCompanyWidget); - -}); diff --git a/web_easy_switch_company/static/src/xml/switch_company.xml b/web_easy_switch_company/static/src/xml/switch_company.xml deleted file mode 100644 index c34c9db1..00000000 --- a/web_easy_switch_company/static/src/xml/switch_company.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - diff --git a/web_easy_switch_company/view/res_users_view.xml b/web_easy_switch_company/view/res_users_view.xml deleted file mode 100644 index 5bc633b3..00000000 --- a/web_easy_switch_company/view/res_users_view.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - res.users.form - res.users - - - - - 1 - - - - - - - -