diff --git a/addons/event/event.py b/addons/event/event.py index 9e50128c592..cdaf333f749 100644 --- a/addons/event/event.py +++ b/addons/event/event.py @@ -173,6 +173,13 @@ class event_event(osv.osv): continue return res + def _get_visibility_selection(self, cr, uid, context=None): + """ Overriden in project_issue to offer more options """ + return [('public', 'All Users'), + ('employees', 'Employees Only')] + # Lambda indirection method to avoid passing a copy of the overridable method when declaring the field + _visibility_selection = lambda self, *args, **kwargs: self._get_visibility_selection(*args, **kwargs) + _columns = { 'name': fields.char('Name', size=64, required=True, translate=True, readonly=False, states={'done': [('readonly', True)]}), 'user_id': fields.many2one('res.users', 'Responsible User', readonly=False, states={'done': [('readonly', True)]}), @@ -210,11 +217,14 @@ class event_event(osv.osv): 'note': fields.text('Description', readonly=False, states={'done': [('readonly', True)]}), 'company_id': fields.many2one('res.company', 'Company', required=False, change_default=True, readonly=False, states={'done': [('readonly', True)]}), 'is_subscribed' : fields.function(_subscribe_fnc, type="boolean", string='Subscribed'), + 'visibility': fields.selection(_visibility_selection, 'Privacy / Visibility', + select=True, required=True), } _defaults = { 'state': 'draft', 'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'event.event', context=c), 'user_id': lambda obj, cr, uid, context: uid, + 'visibility': 'employees', } def subscribe_to_event(self, cr, uid, ids, context=None): diff --git a/addons/event/event_view.xml b/addons/event/event_view.xml index 8efae21f676..c061c842232 100644 --- a/addons/event/event_view.xml +++ b/addons/event/event_view.xml @@ -76,6 +76,7 @@
diff --git a/addons/event/security/event_security.xml b/addons/event/security/event_security.xml index 83039ca4686..90a232731a7 100644 --- a/addons/event/security/event_security.xml +++ b/addons/event/security/event_security.xml @@ -25,25 +25,35 @@ - - Event multi-company + + Event: multi-company - ['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])] + ['|', + ('company_id', '=', False), + ('company_id', 'child_of', [user.company_id.id]), + ] + - - - Event Registration multi-company + + Event/Registration: multi-company - ['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])] + ['|', + ('company_id', '=', False), + ('company_id', 'child_of', [user.company_id.id]), + ] + - - - Report Event Registration multi-company + + Event/Report Registration: multi-company - ['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])] + ['|', + ('company_id', '=', False), + ('company_id', 'child_of', [user.company_id.id]), + ] + diff --git a/addons/portal_event/__init__.py b/addons/portal_event/__init__.py index 60fb460545a..71376240d03 100644 --- a/addons/portal_event/__init__.py +++ b/addons/portal_event/__init__.py @@ -2,7 +2,7 @@ ############################################################################## # # OpenERP, Open Source Management Solution -# Copyright (C) 2004-2010 Tiny SPRL (). +# Copyright (C) 2004-TODAY OpenERP SA () # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as @@ -18,5 +18,3 @@ # along with this program. If not, see . # ############################################################################## - -import event diff --git a/addons/portal_event/__openerp__.py b/addons/portal_event/__openerp__.py index f97ad81efd9..05d84875647 100644 --- a/addons/portal_event/__openerp__.py +++ b/addons/portal_event/__openerp__.py @@ -2,7 +2,7 @@ ############################################################################## # # OpenERP, Open Source Management Solution -# Copyright (C) 2004-2010 Tiny SPRL (). +# Copyright (C) 2004-TODAY OpenERP SA () # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as @@ -30,11 +30,13 @@ This module adds event menu and features to your portal if event and portal are ========================================================================================== """, 'author': 'OpenERP SA', - 'depends': ['event','portal'], + 'depends': [ + 'event', + 'portal', + ], 'data': [ - 'event_view.xml', - 'security/portal_security.xml', 'portal_event_view.xml', + 'security/portal_security.xml', 'security/ir.model.access.csv', ], 'installable': True, diff --git a/addons/portal_event/event.py b/addons/portal_event/event.py deleted file mode 100644 index 45026da4eba..00000000000 --- a/addons/portal_event/event.py +++ /dev/null @@ -1,39 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2004-2010 Tiny SPRL (). -# -# 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, osv - -class event_event(osv.osv): - _description = 'Portal event' - _inherit = 'event.event' - - """ - ``visibility``: defines if the event appears on the portal's event page - - 'public' means the event will appear for everyone (anonymous) - - 'private' means the event won't appear - """ - _columns = { - 'visibility': fields.selection([('public', 'Public'),('private', 'Private')], - string='Visibility', help='Event\'s visibility in the portal\'s contact page'), - } - _defaults = { - 'visibility': 'private', - } diff --git a/addons/portal_event/event_view.xml b/addons/portal_event/event_view.xml deleted file mode 100644 index 3dec56fa526..00000000000 --- a/addons/portal_event/event_view.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - portal.event.form - event.event - - - - - - - - - - - - - diff --git a/addons/portal_event/security/portal_security.xml b/addons/portal_event/security/portal_security.xml index 926e4fdd0f2..7c9c1afc81d 100644 --- a/addons/portal_event/security/portal_security.xml +++ b/addons/portal_event/security/portal_security.xml @@ -2,17 +2,21 @@ - - Portal Visible Events - - ['|', ('visibility', '=', 'public'), ('message_follower_ids','in', [user.partner_id.id])] + + Event: portal and anonymous users: public only + + ['|', + ('visibility', '=', 'public'), + ('message_follower_ids', 'in', [user.partner_id.id]) + ] + - - Portal Personal Registrations - - [('user_id','=',user.id)] + + Event/Registration: portal and anonymous users: personal only + + [('user_id', '=', user.id)]