From 035e9c9ee081afba130735aca356a02b131b8c8d Mon Sep 17 00:00:00 2001 From: "Amit Patel (OpenERP)" Date: Mon, 26 Mar 2012 16:15:31 +0530 Subject: [PATCH] [ADD]:added event share module bzr revid: apa@tinyerp.com-20120326104531-nzsg2lyy6up8ost7 --- addons/event_share/__init__.py | 24 ++++++++++++ addons/event_share/__openerp__.py | 35 +++++++++++++++++ addons/event_share/wizard/__init__.py | 24 ++++++++++++ addons/event_share/wizard/wizard_share.py | 47 +++++++++++++++++++++++ 4 files changed, 130 insertions(+) create mode 100644 addons/event_share/__init__.py create mode 100644 addons/event_share/__openerp__.py create mode 100644 addons/event_share/wizard/__init__.py create mode 100644 addons/event_share/wizard/wizard_share.py diff --git a/addons/event_share/__init__.py b/addons/event_share/__init__.py new file mode 100644 index 00000000000..8dbeda71145 --- /dev/null +++ b/addons/event_share/__init__.py @@ -0,0 +1,24 @@ +# -*- 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 . +# +############################################################################## + +import wizard +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: + diff --git a/addons/event_share/__openerp__.py b/addons/event_share/__openerp__.py new file mode 100644 index 00000000000..f6ad583364a --- /dev/null +++ b/addons/event_share/__openerp__.py @@ -0,0 +1,35 @@ +# -*- 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 . +# +############################################################################## + + +{ + '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: diff --git a/addons/event_share/wizard/__init__.py b/addons/event_share/wizard/__init__.py new file mode 100644 index 00000000000..d62c6170854 --- /dev/null +++ b/addons/event_share/wizard/__init__.py @@ -0,0 +1,24 @@ +# -*- 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 . +# +############################################################################## + +import wizard_share +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: + diff --git a/addons/event_share/wizard/wizard_share.py b/addons/event_share/wizard/wizard_share.py new file mode 100644 index 00000000000..02b5ae26009 --- /dev/null +++ b/addons/event_share/wizard/wizard_share.py @@ -0,0 +1,47 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2011 OpenERP S.A (). +# +# 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 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): + print "Calling _add_access_rights_for_share_group.....!!!" + """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) + access_model.write(cr, uid, access_ids, {'perm_read': True, 'perm_write': True}) + return res + +share_wizard_event() + + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file