diff --git a/__unported__/web_easy_switch_company/__init__.py b/__unported__/web_easy_switch_company/__init__.py deleted file mode 100644 index f9951759..00000000 --- a/__unported__/web_easy_switch_company/__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 model -from . import controllers diff --git a/__unported__/web_easy_switch_company/__openerp__.py b/__unported__/web_easy_switch_company/__openerp__.py deleted file mode 100644 index 81310f60..00000000 --- a/__unported__/web_easy_switch_company/__openerp__.py +++ /dev/null @@ -1,71 +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': '1.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', - 'website': 'http://www.grap.coop', - 'license': 'AGPL-3', - 'depends': [ - 'web', - ], - 'data': [ - 'view/res_users_view.xml', - ], - 'js': [ - 'static/src/js/switch_company.js', - ], - 'qweb': [ - 'static/src/xml/switch_company.xml', - ], - 'installable': False, - 'auto_install': False, -} diff --git a/__unported__/web_easy_switch_company/controllers/__init__.py b/__unported__/web_easy_switch_company/controllers/__init__.py deleted file mode 100644 index b40fe569..00000000 --- a/__unported__/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/__unported__/web_easy_switch_company/controllers/main.py b/__unported__/web_easy_switch_company/controllers/main.py deleted file mode 100644 index 40387f90..00000000 --- a/__unported__/web_easy_switch_company/controllers/main.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 . -# -############################################################################## - -import openerp - - -class WebEasySwitchCompanyController(openerp.addons.web.http.Controller): - _cp_path = '/web_easy_switch_company/switch' - - @openerp.addons.web.http.jsonrequest - def change_current_company(self, req, company_id): - req.session.model('res.users').change_current_company(company_id) diff --git a/__unported__/web_easy_switch_company/model/__init__.py b/__unported__/web_easy_switch_company/model/__init__.py deleted file mode 100644 index e1bd2b92..00000000 --- a/__unported__/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/__unported__/web_easy_switch_company/model/res_company.py b/__unported__/web_easy_switch_company/model/res_company.py deleted file mode 100644 index 000e21e1..00000000 --- a/__unported__/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/__unported__/web_easy_switch_company/model/res_users.py b/__unported__/web_easy_switch_company/model/res_users.py deleted file mode 100644 index 68c6fdfa..00000000 --- a/__unported__/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/__unported__/web_easy_switch_company/static/src/img/icon.png b/__unported__/web_easy_switch_company/static/src/img/icon.png deleted file mode 100644 index ee270eb3..00000000 Binary files a/__unported__/web_easy_switch_company/static/src/img/icon.png and /dev/null differ diff --git a/__unported__/web_easy_switch_company/static/src/img/selection-off.png b/__unported__/web_easy_switch_company/static/src/img/selection-off.png deleted file mode 100644 index c8e922cc..00000000 Binary files a/__unported__/web_easy_switch_company/static/src/img/selection-off.png and /dev/null differ diff --git a/__unported__/web_easy_switch_company/static/src/img/selection-on.png b/__unported__/web_easy_switch_company/static/src/img/selection-on.png deleted file mode 100644 index 8faf7d4d..00000000 Binary files a/__unported__/web_easy_switch_company/static/src/img/selection-on.png and /dev/null differ diff --git a/__unported__/web_easy_switch_company/static/src/js/switch_company.js b/__unported__/web_easy_switch_company/static/src/js/switch_company.js deleted file mode 100644 index fd25d200..00000000 --- a/__unported__/web_easy_switch_company/static/src/js/switch_company.js +++ /dev/null @@ -1,153 +0,0 @@ -/****************************************************************************** - 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 . -******************************************************************************/ - -openerp.web_easy_switch_company = function (instance) { - - /*************************************************************************** - Create an new 'SwitchCompanyWidget' widget that allow users to switch - from a company to another more easily. - ***************************************************************************/ - instance.web.SwitchCompanyWidget = instance.web.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 instance.web.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 instance.web.Model('res.users').call('fields_view_get',{context:{'form_view_ref':'base.view_users_form_simple_modif'}}).then(function(res){ - var res_company = res.fields.company_id.selection; - 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(); - }); - }); - }, - - }); - - /*************************************************************************** - Extend 'UserMenu' Widget to insert a 'SwitchCompanyWidget' widget. - ***************************************************************************/ - instance.web.UserMenu = instance.web.UserMenu.extend({ - - init: function(parent) { - this._super(parent); - var switch_button = new instance.web.SwitchCompanyWidget(); - switch_button.appendTo(instance.webclient.$el.find('.oe_systray')); - }, - - }); - -}; - diff --git a/__unported__/web_easy_switch_company/static/src/xml/switch_company.xml b/__unported__/web_easy_switch_company/static/src/xml/switch_company.xml deleted file mode 100644 index 9f540b23..00000000 --- a/__unported__/web_easy_switch_company/static/src/xml/switch_company.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/__unported__/web_easy_switch_company/view/res_users_view.xml b/__unported__/web_easy_switch_company/view/res_users_view.xml deleted file mode 100644 index 571c28de..00000000 --- a/__unported__/web_easy_switch_company/view/res_users_view.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - res.users.form - res.users - - - - - 1 - - - - - diff --git a/placeholder/__init__.py b/placeholder/__init__.py deleted file mode 100644 index 9dd152f9..00000000 --- a/placeholder/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# This module copyright (C) 2014 Therp BV (). -# -# 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 . -# -############################################################################## diff --git a/placeholder/__openerp__.py b/placeholder/__openerp__.py deleted file mode 100644 index 473029a1..00000000 --- a/placeholder/__openerp__.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# This module copyright (C) 2014 Therp BV (). -# -# 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": "placeholder", - "version": "1.0", - "author": "Therp BV", - "license": "AGPL-3", - "complexity": "normal", - "description": """ -This is a placeholder module because odoo checks if an addons path contains -addons at all. This makes travis fail, so we need this until the first addon is -ported. - -Please remove as soon as you commit your first port! - """, - "category": "", - "depends": [ - ], - "data": [ - ], - "js": [ - ], - "css": [ - ], - "qweb": [ - ], - "auto_install": False, - "installable": True, - "application": False, - "external_dependencies": { - 'python': [], - }, -}