[REF] event, event_share: removed the event_share module and replaced by the use of uid=1 in the functions used by the kanban view to subscribe/unsubscribe

bzr revid: qdp-launchpad@openerp.com-20120329102237-4q7qjepjutlyet2f
This commit is contained in:
Quentin (OpenERP) 2012-03-29 12:22:37 +02:00
parent 236ed739b9
commit 9d429e4446
5 changed files with 7 additions and 137 deletions

View File

@ -216,15 +216,16 @@ class event_event(osv.osv):
user_pool = self.pool.get('res.users')
user = user_pool.browse(cr, uid, uid, context=context)
curr_reg_ids = register_pool.search(cr, uid, [('user_id', '=', user.id), ('event_id', '=' , ids[0])])
#the subscription is done with UID = 1 because in case we share the kanban view, we want anyone to be able to subscribe
if not curr_reg_ids:
curr_reg_ids = [register_pool.create(cr, uid, {'event_id': ids[0] ,'email': user.user_email,
'name':user.name, 'user_id': user.id,})]
return register_pool.confirm_registration(cr, uid, curr_reg_ids, context=context)
curr_reg_ids = [register_pool.create(cr, 1, {'event_id': ids[0] ,'email': user.user_email, 'name':user.name, 'user_id': user.id,})]
return register_pool.confirm_registration(cr, 1, curr_reg_ids, context=context)
def unsubscribe_to_event(self,cr,uid,ids,context=None):
def unsubscribe_to_event(self, cr, uid, ids, context=None):
register_pool = self.pool.get('event.registration')
curr_reg_ids = register_pool.search(cr, uid, [('user_id', '=', uid), ('event_id', '=', ids[0])])
return register_pool.button_reg_cancel(cr, uid, curr_reg_ids, context=context)
#the unsubscription is done with UID = 1 because in case we share the kanban view, we want anyone to be able to unsubscribe
curr_reg_ids = register_pool.search(cr, 1, [('user_id', '=', uid), ('event_id', '=', ids[0])])
return register_pool.button_reg_cancel(cr, 1, curr_reg_ids, context=context)
def _check_closing_date(self, cr, uid, ids, context=None):
for event in self.browse(cr, uid, ids, context=context):

View File

@ -1,24 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# 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/>.
#
##############################################################################
import wizard
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,35 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# 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/>.
#
##############################################################################
{
'name': 'Events Share',
'version': '0.1',
'category': 'Tools',
'complexity': "easy",
'description': """ """,
'author': 'OpenERP SA',
'depends': ['event','share'],
'installable': True,
#'application': True,
'auto_install': False,
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,24 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# 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/>.
#
##############################################################################
import wizard_share
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,48 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2011 OpenERP S.A (<http://www.openerp.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
# 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 osv import osv, fields
from tools.translate import _
UID_ROOT = 1
EVENT_ACCESS = ('perm_read', 'perm_write', 'perm_create')
class share_wizard_event(osv.osv_memory):
"""Inherited share wizard to automatically create appropriate
menus in the selected portal upon sharing with a portal group."""
_inherit = "share.wizard"
def _add_access_rights_for_share_group(self, cr, uid, group_id, mode, fields_relations, context=None):
"""Adds access rights to group_id on object models referenced in ``fields_relations``,
intersecting with access rights of current user to avoid granting too much rights
"""
res = super(share_wizard_event, self)._add_access_rights_for_share_group(cr, uid, group_id, mode, fields_relations, context=context)
access_model = self.pool.get('ir.model.access')
access_ids = access_model.search(cr,uid,[('group_id','=',group_id)],context = context)
for record in access_model.browse(cr,uid,access_ids,context = context):
if record.model_id.model == 'event.registration':
access_model.write(cr, uid, record.id, {'perm_read': True, 'perm_write': True,'perm_create':True})
share_wizard_event()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: