Skip to content

Commit

Permalink
Merge branch '9.0' into page_planning
Browse files Browse the repository at this point in the history
  • Loading branch information
emillumine committed Dec 19, 2019
2 parents 8e30852 + a187b97 commit 6699c35
Show file tree
Hide file tree
Showing 223 changed files with 58,002 additions and 1,220 deletions.
3 changes: 2 additions & 1 deletion chouettecoop_addons/readme
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
x

Modules modifiés ou dévelopés par La Chouette Coop
5 changes: 5 additions & 0 deletions chouettecoop_addons/restrict_db_mgr/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Restrict access to Manage Databases feature,
only administrator or members of 'Access Right' group allowed.

Code modified by La Chouette Coop from original:
https://github.com/OpenSur/Odoo_addons/tree/master/restrict_db_mgr
10 changes: 4 additions & 6 deletions louve_addons/louve_custom_cpo/__init__.py → ...tecoop_addons/restrict_db_mgr/__init__.py
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Product - Average Consumption Module for Odoo
# Copyright (C) 2013-Today GRAP (http://www.grap.coop)
# @author Julien WESTE
# @author Sylvain LE GAL (https://twitter.com/legalsylvain)
# OpenERP, Open Source Enterprise Management Solution
# risk_management Module
# Copyright (C) 2014 OpenSur ([email protected])
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
Expand All @@ -20,5 +19,4 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################

from . import model
from . import controllers
29 changes: 19 additions & 10 deletions ...cpo/model/computed_purchase_order_line.py → ...oop_addons/restrict_db_mgr/__openerp__.py
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Purchase - Computed Purchase Order Module for Odoo
# Copyright (C) 2013-Today GRAP (http://www.grap.coop)
# @author Julien WESTE
# @author Sylvain LE GAL (https://twitter.com/legalsylvain)
# OpenERP, Open Source Enterprise Management Solution
# risk_management Module
# Copyright (C) 2014 OpenSur ([email protected])
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
Expand All @@ -20,10 +19,20 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
{
'name' : 'Restrict access to Manage Databases',
'summary' : "Restrict access to Manage Databases feature, only administrator or members of 'Access Right' group allowed.",
'category' : 'Website',
'author' : 'OpenSur SA',
'website' : 'http://www.opensur.com',
'version' : '9.0.0.1.0',
'license' : "AGPL-3",
'depends': [
'base',
'web',
],
'installable': True,
'auto_install': True,
'active': False,
}

from openerp import models


class ComputedPurchaseOrderLine(models.Model):
_inherit = 'computed.purchase.order.line'
_order = 'product_code'
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# -*- encoding: utf-8 -*-
# -*- coding: utf-8 -*-
##############################################################################
#
# Hardware Telium Payment Terminal module for Odoo
# Copyright (C) 2014 Akretion (http://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com>
# OpenERP, Open Source Enterprise Management Solution
# risk_management Module
# Copyright (C) 2014 OpenSur (comercial@opensur.com)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
Expand All @@ -19,6 +19,4 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################


from . import main
105 changes: 105 additions & 0 deletions chouettecoop_addons/restrict_db_mgr/controllers/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2014 OpenSur.
#
# 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 import http
from openerp import SUPERUSER_ID
from openerp.http import request
from openerp.addons.web.controllers.main import Database
from openerp.exceptions import AccessError
import werkzeug.utils

ADMIN_CATEGORY = 'Administration'
ADMIN_GROUP = 'Access Rights'

class Database_restrict(Database):

def _is_usr_admin(self):
uid = request.session.uid
if uid == SUPERUSER_ID:
return True
cr, context, registry = request.cr, request.context, request.registry
admin_category = registry('ir.module.category').search(
cr, SUPERUSER_ID, [('name','=',ADMIN_CATEGORY),])
if len(admin_category):
admin_group = registry('res.groups').search(cr, SUPERUSER_ID,
['&', ('name','=',ADMIN_GROUP),
('category_id','=',admin_category[0]),])
if len(admin_group):
user_id = registry('res.groups').search(
cr, SUPERUSER_ID,
[('id','=',admin_group[0]), ('users','in', [uid])],
context=context)
return user_id and True or False
return False

def _access_forbidden(self):
return werkzeug.utils.redirect('/web/login', 303)

@http.route('/web/database/manager')
def manager(self, *args, **kwargs):
if self._is_usr_admin():
return super(Database_restrict, self).manager(*args, **kwargs)
else:
return self._access_forbidden()

@http.route('/web/database/create')
def create(self, *args, **kwargs):
if self._is_usr_admin():
return super(Database_restrict, self).create(*args, **kwargs)
else:
return self._access_forbidden()

@http.route('/web/database/duplicate')
def duplicate(self, *args, **kwargs):
if self._is_usr_admin():
return super(Database_restrict, self).duplicate(*args, **kwargs)
else:
return self._access_forbidden()

@http.route('/web/database/drop')
def drop(self, *args, **kwargs):
if self._is_usr_admin():
return super(Database_restrict, self).drop(*args, **kwargs)
else:
return self._access_forbidden()

@http.route('/web/database/backup')
def backup(self, *args, **kwargs):
if self._is_usr_admin():
return super(Database_restrict, self).backup(*args, **kwargs)
else:
return self._access_forbidden()

@http.route('/web/database/restore')
def restore(self, *args, **kwargs):
if self._is_usr_admin():
return super(Database_restrict, self).restore(*args, **kwargs)
else:
return self._access_forbidden()

@http.route('/web/database/change_password')
def change_password(self, *args, **kwargs):
if self._is_usr_admin():
return super(Database_restrict, self).change_password(*args, **kwargs)
else:
return self._access_forbidden()

# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions chouettecoop_addons/user_menu_chouette/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
User Menu for La Chouette Coop, Odoo addon
==========================================

Replace the standard top right UserMenu:

* Replace "Support" link from Odoo.com/buy to a link configurable in
Configuration/General Settings/Menu Support
* Remove "My Oddo Account" link

Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Product - Average Consumption Module for Odoo
# Copyright (C) 2013-Today GRAP (http://www.grap.coop)
# @author Julien WESTE
# @author Sylvain LE GAL (https://twitter.com/legalsylvain)
# User Switch From Group, Odoo addon
# Copyright La Chouette Coop
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
Expand All @@ -20,5 +18,4 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################

from . import computed_purchase_order_line
from . import models
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# POS Payment Terminal module for Odoo
# Copyright (C) 2015 Mathieu VATEL <[email protected]>
# Require User Login, Odoo addon
# Copyright La Chouette Coop
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
Expand All @@ -18,13 +18,25 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################

from openerp import models, fields


class AccountJournal(models.Model):
_inherit = 'account.journal'

iface_automatic_cashdrawer = fields.Boolean(
'Automatic cashdrawer',
help="Check this if this journal is linked to an automatic cashdrawer")
{
'name' : "User Menu for La Chouette Coop",
'summary' : "Replace top right UserMenu: change support link, remvoe My Odoo Account link",
'category' : 'Extra Tools',
'author' : "La Chouette Coop",
'website' : "http://www.lachouettecoop.fr",
'license' : "AGPL-3",
'version' : '9.0.0.0.1',
'installable': True,
'depends' : [
'base_setup',
'base',
'web',
],
'data' : [
'data/user_menu_chouette.xml',
'views/res_config_view.xml',
],
'qweb' : [
'static/src/xml/base.xml',
],
}
13 changes: 13 additions & 0 deletions chouettecoop_addons/user_menu_chouette/data/user_menu_chouette.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>

<!-- extend template addons/web/views/webclient_templates.xml to include our javascript file -->
<template id="assets_backend" name="user_menu_chouette assets" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<script type="text/javascript" src="/user_menu_chouette/static/src/js/menu.js"></script>
</xpath>
</template>

</data>
</openerp>
2 changes: 2 additions & 0 deletions chouettecoop_addons/user_menu_chouette/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

from . import res_config
40 changes: 40 additions & 0 deletions chouettecoop_addons/user_menu_chouette/models/res_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Require User Login, Odoo addon
# Copyright La Chouette Coop
#
# 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 import api, fields, models

class user_menu_chouette_config_settings(models.TransientModel):
""" Inherit the base setting to add the url to use for User Menu «Support» link. """

_inherit = 'base.config.settings'

x_user_menu_support_url = fields.Char("Menu Support", help="Lien «Support» dans le menu utilisateur")

@api.multi
def get_default_x_user_menu_support_url(self):
url = self.env["ir.config_parameter"].get_param("x_user_menu_support_url", default=None)
return { 'x_user_menu_support_url': url or False }

@api.multi
def set_x_user_menu_support_url(self):
for record in self:
self.env['ir.config_parameter'].set_param("x_user_menu_support_url", self.x_user_menu_support_url or '')

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions chouettecoop_addons/user_menu_chouette/static/src/js/menu.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
odoo.define('user_menu_chouette.support_chouette', function (require) {
"use strict";

var Model = require('web.Model');
var UserMenu = require('web.UserMenu');

// Modify behaviour of addons/web/static/src/js/widgets/user_menu.js
UserMenu.include({
on_menu_support_chouette: function () {
var support_window = window.open('', '_blank');
new Model('ir.config_parameter')
.call('get_param', ['x_user_menu_support_url'])
.then(function(url) {
if (url) {
support_window.location = url;
}
});
}
});

});
16 changes: 16 additions & 0 deletions chouettecoop_addons/user_menu_chouette/static/src/xml/base.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates id="template" xml:space="preserve">

<!-- replace UserMenu dropdown-menu defined in addons/web/static/src/xml/base.xml -->
<t t-extend="UserMenu" >
<t t-jquery="ul.dropdown-menu" t-operation="inner">
<li><a href="#" data-menu="documentation">Documentation</a></li>
<li><a href="#" data-menu="support_chouette">Support</a></li>
<li><a href="#" data-menu="about">About</a></li>
<li class="divider"/>
<li><a href="#" data-menu="settings">Preferences</a></li>
<li class="dropdown-menu-last"><a href="#" data-menu="logout">Log out</a></li>
</t>
</t>

</templates>
23 changes: 23 additions & 0 deletions chouettecoop_addons/user_menu_chouette/views/res_config_view.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<!-- modify Configuration/GeneralSettings view defined in
addons/base_setup/res_config_view.xml -->
<record id="view_general_configuration_x_user_menu_support_url" model="ir.ui.view">
<field name="name">base.config.settings.x_user_menu_support_url</field>
<field name="model">base.config.settings</field>
<field name="inherit_id" ref="base_setup.view_general_configuration"/>
<field name="arch" type="xml">
<xpath expr="//group[@name='google']" position='before'>
<group>
<label for="x_user_menu_support_url"/>
<div name="x_user_menu_support">
<field name="x_user_menu_support_url"/>
<label string="Lien «Support» dans le menu utilisateur"/>
</div>
</group>
</xpath>
</field>
</record>
</data>
</openerp>
Loading

0 comments on commit 6699c35

Please sign in to comment.