[IMP] use const SUPERUSER_ID insteand of int 1
bzr revid: abo@openerp.com-20120725152455-9q5kkogalmzmul4y
This commit is contained in:
parent
73b4690bae
commit
e2107d35d1
|
@ -23,6 +23,7 @@ import time
|
|||
from osv import fields, osv
|
||||
from tools.translate import _
|
||||
import decimal_precision as dp
|
||||
from openerp import SUPERUSER_ID
|
||||
|
||||
class event_type(osv.osv):
|
||||
""" Event Type """
|
||||
|
@ -227,18 +228,18 @@ class event_event(osv.osv):
|
|||
self.check_registration_limits_before(cr, uid, ids, num_of_seats, context=context)
|
||||
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
|
||||
#the subscription is done with SUPERUSER_ID 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, 1, {'event_id': ids[0] ,'email': user.user_email, 'name':user.name, 'user_id': user.id, 'nb_register': num_of_seats})]
|
||||
curr_reg_ids = [register_pool.create(cr, SUPERUSER_ID, {'event_id': ids[0] ,'email': user.user_email, 'name':user.name, 'user_id': user.id, 'nb_register': num_of_seats})]
|
||||
else:
|
||||
register_pool.write(cr, uid, curr_reg_ids, {'nb_register': num_of_seats}, context=context)
|
||||
return register_pool.confirm_registration(cr, 1, curr_reg_ids, context=context)
|
||||
return register_pool.confirm_registration(cr, SUPERUSER_ID, curr_reg_ids, context=context)
|
||||
|
||||
def unsubscribe_to_event(self, cr, uid, ids, context=None):
|
||||
register_pool = self.pool.get('event.registration')
|
||||
#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)
|
||||
#the unsubscription is done with SUPERUSER_ID because in case we share the kanban view, we want anyone to be able to unsubscribe
|
||||
curr_reg_ids = register_pool.search(cr, SUPERUSER_ID, [('user_id', '=', uid), ('event_id', '=', ids[0])])
|
||||
return register_pool.button_reg_cancel(cr, SUPERUSER_ID, 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):
|
||||
|
|
Loading…
Reference in New Issue