Amit Patel (OpenERP) has proposed merging
lp:~openerp-dev/openobject-addons/trunk-event-kanban-apa into
lp:openobject-addons.
Requested reviews:
OpenERP Core Team (openerp)
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-event-kanban-apa/+merge/99322
Hello,
I have improved following things.
1.Added kanban view for event and related changes.
2. add access rights for event registration
3. correct spelling in demo data.
4. change event group from other to event category.
5. Registration restrict to share user(new module event_share).
Thanks,
Amit
--
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-event-kanban-apa/+merge/99322
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openobject-addons/trunk-event-kanban-apa.
=== modified file 'event/__openerp__.py'
--- event/__openerp__.py 2012-02-29 13:00:41 +0000
+++ event/__openerp__.py 2012-03-26 13:23:32 +0000
@@ -53,6 +53,7 @@
],
'demo_xml': ['event_demo.xml'],
'test': ['test/process/event_draft2done.yml'],
+ 'css': ['static/src/css/event.css'],
'installable': True,
'application': True,
'auto_install': False,
=== modified file 'event/event.py'
--- event/event.py 2012-03-01 11:39:44 +0000
+++ event/event.py 2012-03-26 13:23:32 +0000
@@ -148,8 +148,28 @@
number = reg_done
elif field == 'register_prospect':
number = reg_draft
+ elif field == 'register_avail':
+ number = event.register_max-reg_open
res[event.id][field] = number
return res
+
+ def _subscribe_fnc(self, cr, uid, ids, fields, args, context=None):
+ """Get Subscribe or Unsubscribe registration value.
+ @param ids: List of Event registration type's id
+ @param fields: List of function fields(subscribe).
+ @param context: A standard dictionary for contextual values
+ @return: Dictionary of function fields value.
+ """
+ register_pool = self.pool.get('event.registration')
+ res = {}
+ for event in self.browse(cr, uid, ids, context=context):
+ curr_reg_id = register_pool.search(cr,uid,[('user_id','=',uid),('event_id','=',event.id)])
+ if not curr_reg_id:res[event.id] = False
+ if curr_reg_id:
+ for reg in register_pool.browse(cr,uid,curr_reg_id,context=context):
+ res[event.id] = False
+ if reg.subscribe:res[event.id]= True
+ return res
_columns = {
'name': fields.char('Name', size=64, required=True, translate=True, readonly=False, states={'done': [('readonly', True)]}),
@@ -158,6 +178,7 @@
'register_max': fields.integer('Maximum Registrations', help="You can for each event define a maximum registration level. If you have too much registrations you are not able to confirm your event. (put 0 to ignore this rule )", readonly=True, states={'draft': [('readonly', False)]}),
'register_min': fields.integer('Minimum Registrations', help="You can for each event define a minimum registration level. If you do not enough registrations you are not able to confirm your event. (put 0 to ignore this rule )", readonly=True, states={'draft': [('readonly', False)]}),
'register_current': fields.function(_get_register, string='Confirmed Registrations', multi='register_numbers'),
+ 'register_avail': fields.function(_get_register, string='Available Registrations', multi='register_numbers',type='integer'),
'register_prospect': fields.function(_get_register, string='Unconfirmed Registrations', multi='register_numbers'),
'register_attended': fields.function(_get_register, string='Attended Registrations', multi='register_numbers'),
'registration_ids': fields.one2many('event.registration', 'event_id', 'Registrations', readonly=False, states={'done': [('readonly', True)]}),
@@ -182,6 +203,7 @@
type='many2one', relation='res.country', string='Country', readonly=False, states={'done': [('readonly', True)]}),
'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)]}),
+ 'subscribe' : fields.function(_subscribe_fnc, type="boolean", string='Subscribe'),
}
_defaults = {
@@ -189,6 +211,25 @@
'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,
}
+
+ def subscribe_to_event(self,cr,uid,ids,context=None):
+ register_pool = self.pool.get('event.registration')
+ user_pool = self.pool.get('res.users')
+ user = user_pool.browse(cr,uid,uid,context)
+ curr_reg_id = register_pool.search(cr,uid,[('user_id','=',user.id),('event_id','=',ids[0])])
+ if not curr_reg_id:
+ curr_reg_id = register_pool.create(cr, uid, {'event_id':ids[0],'email':user.user_email,
+ 'name':user.name,'user_id':user.id,
+ 'subscribe':True
+ })
+ if isinstance(curr_reg_id, (int, long)):curr_reg_id = [curr_reg_id]
+ return register_pool.confirm_registration(cr,uid,curr_reg_id,context)
+
+ def unsubscribe_to_event(self,cr,uid,ids,context=None):
+ register_pool = self.pool.get('event.registration')
+ curr_reg_id = register_pool.search(cr,uid,[('user_id','=',uid),('event_id','=',ids[0])])
+ if isinstance(curr_reg_id, (int, long)):curr_reg_id = [curr_reg_id]
+ return register_pool.button_reg_cancel(cr,uid,curr_reg_id,context)
def _check_closing_date(self, cr, uid, ids, context=None):
for event in self.browse(cr, uid, ids, context=context):
@@ -233,19 +274,19 @@
'log_ids': fields.one2many('mail.message', 'res_id', 'Logs', domain=[('email_from', '=', False),('model','=',_name)]),
'event_end_date': fields.related('event_id','date_end', type='datetime', string="Event End Date", readonly=True),
'event_begin_date': fields.related('event_id', 'date_begin', type='datetime', string="Event Start Date", readonly=True),
- 'user_id': fields.many2one('res.users', 'Responsible', states={'done': [('readonly', True)]}),
+ 'user_id': fields.many2one('res.users', 'Attendee', states={'done': [('readonly', True)]}),
'company_id': fields.related('event_id', 'company_id', type='many2one', relation='res.company', string='Company', store=True, readonly=True, states={'draft':[('readonly',False)]}),
'state': fields.selection([('draft', 'Unconfirmed'),
('open', 'Confirmed'),
('cancel', 'Cancelled'),
('done', 'Attended')], 'State',
- size=16, readonly=True)
+ size=16, readonly=True),
+ 'subscribe': fields.boolean('Subscribe'),
}
_defaults = {
'nb_register': 1,
'state': 'draft',
- 'user_id': lambda self, cr, uid, ctx: uid,
}
_order = 'name, create_date desc'
@@ -255,7 +296,7 @@
def confirm_registration(self, cr, uid, ids, context=None):
self.message_append(cr, uid, ids,_('State set to open'),body_text= _('Open'))
- return self.write(cr, uid, ids, {'state': 'open'}, context=context)
+ return self.write(cr, uid, ids, {'state': 'open','subscribe':True}, context=context)
def registration_open(self, cr, uid, ids, context=None):
@@ -282,7 +323,7 @@
def button_reg_cancel(self, cr, uid, ids, context=None, *args):
self.message_append(cr, uid, ids,_('State set to Cancel'),body_text= _('Cancel'))
- return self.write(cr, uid, ids, {'state': 'cancel'})
+ return self.write(cr, uid, ids, {'state': 'cancel','subscribe':False})
def mail_user(self, cr, uid, ids, context=None):
"""
=== modified file 'event/event_demo.xml'
--- event/event_demo.xml 2012-02-24 15:50:59 +0000
+++ event/event_demo.xml 2012-03-26 13:23:32 +0000
@@ -32,7 +32,6 @@
<field name="name">Concert of Bon Jovi</field>
<field eval="time.strftime('%Y-%m-01 19:05:15')" name="date_begin"/>
<field eval="time.strftime('%Y-%m-01 23:05:15')" name="date_end"/>
- <field name="user_id" ref="base.user_root"/>
<field name="register_max">500</field>
<field name="type" ref="event_type_1"/>
</record>
@@ -42,17 +41,15 @@
<field eval="time.strftime('%Y-%m-05 18:00:00')" name="date_begin"/>
<field eval="time.strftime('%Y-%m-05 21:00:00')" name="date_end"/>
<field name="type" ref="event_type_1"/>
- <field name="user_id" ref="base.user_root"/>
<field name="register_min">50</field>
<field name="register_max">350</field>
</record>
<record id="event_2" model="event.event">
- <field name="name">Conference on ERP Buisness</field>
+ <field name="name">Conference on ERP Business</field>
<field eval="time.strftime('%Y-%m-05 14:00:00')" name="date_begin"/>
<field eval="time.strftime('%Y-%m-05 16:30:00')" name="date_end"/>
<field name="type" ref="event_type_2"/>
<field name="register_max">200</field>
- <field name="user_id" ref="base.user_root"/>
</record>
<function model="event.event" name="button_confirm" eval="[ref('event_2')]"/>
<function model="event.event" name="button_confirm" eval="[ref('event_2')]"/>
=== modified file 'event/event_view.xml'
--- event/event_view.xml 2012-03-26 11:48:47 +0000
+++ event/event_view.xml 2012-03-26 13:23:32 +0000
@@ -63,7 +63,7 @@
<page string="Event">
<separator string="Description" colspan="4"/>
<field name="note" colspan="4" nolabel="1"/>
- <field name="registration_ids" colspan="4" nolabel="1">
+ <field name="registration_ids" colspan="4" nolabel="1" groups="event.group_event_manager,event.group_event_user">
<tree string="Registration" editable="top">
<field name="name" />
<field name="email" />
@@ -156,6 +156,71 @@
</tree>
</field>
</record>
+
+ <!-- Event Kanban View -->
+
+ <record model="ir.ui.view" id="view_event_kanban">
+ <field name="name">event.event.kanban</field>
+ <field name="model">event.event</field>
+ <field name="type">kanban</field>
+ <field name="arch" type="xml">
+ <kanban>
+ <field name="register_max"/>
+ <field name="type"/>
+ <field name="user_id"/>
+ <field name="register_current"/>
+ <field name="subscribe"/>
+ <field name="country_id"/>
+ <field name="date_begin"/>
+ <field name="state"/>
+ <field name="register_avail"/>
+ <templates>
+ <t t-name="kanban-box">
+ <div class="oe_module_vignette">
+ <a type="edit" class="oe_module_icon">
+ <div class="oe_event_date "><t t-esc="record.date_begin.raw_value.getDate()"/></div>
+ <div class="oe_event_month_year">
+ <t t-esc="record.date_begin.raw_value.toString('MMM')"/>
+ <t t-esc="record.date_begin.raw_value.getFullYear()"/>
+ </div>
+ <div class="oe_event_time"><t t-esc="record.date_begin.raw_value.toString('hh:mm tt')"/></div>
+ </a>
+ <div class="oe_module_desc">
+ <h4><a type="edit"><field name="name"/></a></h4>
+ <p>
+ <t t-if="record.country_id.raw_value">@<field name="country_id"/><br/></t>
+ <t t-if="record.user_id.raw_value">Organized by <field name="user_id"/><br/></t>
+ <t t-if="record.register_avail.raw_value lte 10 and record.register_avail.raw_value gt 0"><i>Only</i></t>
+ <t t-if="record.register_avail.raw_value == 0"><i>No ticket available.</i></t>
+ <t t-if="record.register_avail.raw_value != 0">
+ <i><b><field name="register_avail"/></b></i>
+ <i>
+ <t t-if="record.register_avail.raw_value > 1">tickets </t>
+ <t t-if="record.register_avail.raw_value == 1 || !record.register_avail.raw_value > 1">ticket </t>available.
+ </i>
+ </t>
+
+ </p>
+ <t t-if="record.register_avail.raw_value != 0">
+ <t t-if="!record.subscribe.raw_value">
+ <button type="object" name="subscribe_to_event" class="subscribe_button oe_event_button_subscribe">
+ <span >Subscribe</span>
+ </button>
+ </t>
+ </t>
+ <t t-if="record.subscribe.raw_value">
+ <button type="object" name="unsubscribe_to_event" class="unsubscribe_button oe_event_button_unsubscribe">
+ <span>Subscribed</span>
+ <span class="unsubscribe">Unsubscribe</span>
+ </button>
+ </t>
+ </div>
+ </div>
+ </t>
+ </templates>
+ </kanban>
+ </field>
+ </record>
<!-- Events Calendar View -->
@@ -199,6 +264,10 @@
<filter icon="terp-check" string="Unconfirmed" name="draft" domain="[('state','=','draft')]" help="Events in New state"/>
<filter icon="terp-camera_test" string="Confirmed" domain="[('state','=','confirm')]" help="Confirmed events"/>
<separator orientation="vertical"/>
+ <filter icon="terp-go-today" string="Upcoming"
+ name="upcoming"
+ domain="[('date_begin','>=', time.strftime('%%Y-%%m-%%d 00:00:00'))]"
+ help="Up coming events from today" />
<field name="name"/>
<field name="type" widget="selection"/>
<field name="user_id" widget="selection">
@@ -229,8 +298,8 @@
<field name="type">ir.actions.act_window</field>
<field name="res_model">event.event</field>
<field name="view_type">form</field>
- <field name="view_mode">tree,form,calendar,graph</field>
- <field name="context">{"search_default_section_id": section_id}</field>
+ <field name="view_mode">kanban,calendar,tree,form,graph</field>
+ <field name="context">{"search_default_upcoming":1}</field>
<field name="search_view_id" ref="view_event_search"/>
<field name="help">Event is the low level object used by meeting and others documents that should be synchronized with mobile devices or calendar applications through caldav. Most of the users should work in the Calendar menu, and not in the list of events.</field>
</record>
@@ -415,7 +484,7 @@
<menuitem
name="Registrations"
id="menu_action_registration" parent="base.menu_event_main"
- action="action_registration"/>
+ action="action_registration" groups="event.group_event_manager,event.group_event_user"/>
<menuitem name="Reporting" id="base.menu_report_association" parent="event_main_menu" sequence="20"/>
=== modified file 'event/security/event_security.xml'
--- event/security/event_security.xml 2012-03-01 11:45:23 +0000
+++ event/security/event_security.xml 2012-03-26 13:23:32 +0000
@@ -2,12 +2,20 @@
<openerp>
<data noupdate="0">
+ <record model="ir.module.category" id="module_category_event_management">
+ <field name="name">Event</field>
+ <field name="description">Helps you manage your Events.</field>
+ <field name="sequence">3</field>
+ </record>
+
+ <record id="group_event_user" model="res.groups">
+ <field name="name">User</field>
+ <field name="category_id" ref="module_category_event_management"/>
+ </record>
+
<record id="group_event_manager" model="res.groups">
- <field name="name">Event Manager</field>
- </record>
-
- <record id="group_event_user" model="res.groups">
- <field name="name">Event User</field>
+ <field name="name">Manager</field>
+ <field name="category_id" ref="module_category_event_management"/>
</record>
<record model="res.users" id="base.user_admin">
=== added directory 'event/static/src/css'
=== added file 'event/static/src/css/event.css'
--- event/static/src/css/event.css 1970-01-01 00:00:00 +0000
+++ event/static/src/css/event.css 2012-03-26 13:23:32 +0000
@@ -0,0 +1,118 @@
+.oe_event_date{
+ border-top-left-radius:3px;
+ border-top-right-radius:3px;
+ font-size: 48px;
+ height: auto;
+ font-weight: bold;
+ text-align: center;
+ margin-bottom:-7px;
+ color: #FFFFFF;
+ -webkit-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
+ background-color: #8A89BA;
+}
+.oe_event_time{
+ border-bottom-left-radius:3px;
+ border-bottom-right-radius:3px;
+ font-size: 12px;
+ text-align: center;
+ font-weight: bold;
+ color: #8A89BA;
+ -webkit-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
+ background-color: #FFFFFF;
+}
+.oe_event_month_year{
+ border-bottom-left-radius:3px;
+ border-bottom-right-radius:3px;
+ font-size: 12px;
+ text-align: center;
+ font-weight: bold;
+ color: #FFFFFF;
+ background-color: #8A89BA;
+}
+div.oe_fold_column{
+ padding:0px !important;
+}
+.oe_event_button_subscribe {
+ display: inline-block;
+ border: 1px solid #ababab;
+ color: #404040;
+ font-size: 12px;
+ padding: 3px 10px;
+ text-align: center;
+ -o-background-size: 100% 100%;
+ -moz-background-size: 100% 100%;
+ -webkit-background-size: auto auto !important;
+ background-size: 100% 100%;
+ background: #d8d8d8 none;
+ background: none, -webkit-gradient(linear, left top, left bottom, from(#efefef), to(#d8d8d8));
+ background: none, -webkit-linear-gradient(#efefef, #d8d8d8);
+ background: none, -moz-linear-gradient(#efefef, #d8d8d8);
+ background: none, -o-linear-gradient(top, #efefef, #d8d8d8);
+ background: none, -khtml-gradient(linear, left top, left bottom, from(#efefef), to(#d8d8d8));
+ background: -ms-linear-gradient(top, #efefef, #d8d8d8);
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#efefef', endColorstr='#d8d8d8',GradientType=0 );
+ -moz-border-radius: 3px;
+ -webkit-border-radius: 3px;
+ -o-border-radius: 3px;
+ -ms-border-radius: 3px;
+ border-radius: 3px;
+ -moz-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 1px rgba(255, 255, 255, 0.8) inset;
+ -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 1px rgba(255, 255, 255, 0.8) inset;
+ -o-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 1px rgba(255, 255, 255, 0.8) inset;
+ box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 1px rgba(255, 255, 255, 0.8) inset;
+ text-shadow: 0 1px 1px rgba(255, 255, 255, 0.5);
+ -webkit-font-smoothing: antialiased;
+ outline: none;
+}
+.oe_event_button_unsubscribe {
+ display: inline-block;
+ border: 1px solid #AAA;
+ color: #404040;
+ font-size: 12px;
+ padding: 3px 10px;
+ text-align: center;
+ -o-background-size: 100% 100%;
+ -moz-background-size: 100% 100%;
+ -webkit-background-size: auto auto !important;
+ background-size: 100% 100%;
+ background: #AAA none;
+ background: none, -webkit-gradient(linear, left top, left bottom, from(#AAA), to(#AAA));
+ background: none, -webkit-linear-gradient(#AAA, #AAA);
+ background: none, -moz-linear-gradient(#AAA, #AAA);
+ background: none, -o-linear-gradient(top, #AAA, #AAA);
+ background: none, -khtml-gradient(linear, left top, left bottom, from(#AAA), to(#AAA));
+ background: -ms-linear-gradient(top, #AAA, #AAA);
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#AAA, endColorstr='#AAA',GradientType=0 );
+ -moz-border-radius: 3px;
+ -webkit-border-radius: 3px;
+ -o-border-radius: 3px;
+ -ms-border-radius: 3px;
+ border-radius: 3px;
+ -moz-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 1px rgba(255, 255, 255, 0.8) inset;
+ -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 1px rgba(255, 255, 255, 0.8) inset;
+ -o-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 1px rgba(255, 255, 255, 0.8) inset;
+ box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 1px rgba(255, 255, 255, 0.8) inset;
+ text-shadow: 0 1px 1px rgba(255, 255, 255, 0.5);
+ -webkit-font-smoothing: antialiased;
+ outline: none;
+}
+.oe_event_button_subscribe:hover {
+ cursor: pointer;
+ background-size: 100% 100%;
+ /*background: #DC5F59 none;*/
+
+}
+.oe_event_button_unsubscribe:hover {
+ cursor: pointer;
+ background-size: 100% 100%;
+ background: #DC5F59 none;
+ }
+ .unsubscribe, .unsubscribe_button:hover span {
+ display: none;
+ background-color: #DC5F59
+ }
+ .unsubscribe_button:hover .unsubscribe {
+ display: inline;
+ background-color: #DC5F59;
+ }
+
=== modified file 'event_sale/__openerp__.py'
--- event_sale/__openerp__.py 2012-03-01 16:25:13 +0000
+++ event_sale/__openerp__.py 2012-03-26 13:23:32 +0000
@@ -37,8 +37,8 @@
'depends': ['event','sale','sale_crm'],
'update_xml': [
'event_sale_view.xml',
- 'event_demo.xml',
],
+ 'demo_xml': ['event_demo.xml'],
'test':['test/confirm.yml'],
'installable': True,
'active': False,
=== added directory 'event_share'
=== added file 'event_share/__init__.py'
--- event_share/__init__.py 1970-01-01 00:00:00 +0000
+++ event_share/__init__.py 2012-03-26 13:23:32 +0000
@@ -0,0 +1,24 @@
+# -*- 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:
+
=== added file 'event_share/__openerp__.py'
--- event_share/__openerp__.py 1970-01-01 00:00:00 +0000
+++ event_share/__openerp__.py 2012-03-26 13:23:32 +0000
@@ -0,0 +1,35 @@
+# -*- 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:
=== added directory 'event_share/wizard'
=== added file 'event_share/wizard/__init__.py'
--- event_share/wizard/__init__.py 1970-01-01 00:00:00 +0000
+++ event_share/wizard/__init__.py 2012-03-26 13:23:32 +0000
@@ -0,0 +1,24 @@
+# -*- 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:
+
=== added file 'event_share/wizard/wizard_share.py'
--- event_share/wizard/wizard_share.py 1970-01-01 00:00:00 +0000
+++ event_share/wizard/wizard_share.py 2012-03-26 13:23:32 +0000
@@ -0,0 +1,48 @@
+# -*- 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:
\ No newline at end of file
_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help : https://help.launchpad.net/ListHelp