@param context: A standard dictionary for contextual values
@return: True
"""
- if not context:
- context = {}
res = False
if type(ids) in (int, long,):
ids = [ids]
+ if context is None:
+ context = {}
data_pool = self.pool.get('ir.model.data')
unconfirmed_ids = []
for event in self.browse(cr, uid, ids, context=context):
'user_id': lambda obj, cr, uid, context: uid,
}
- def _check_recursion(self, cr, uid, ids):
+ def _check_recursion(self, cr, uid, ids, context=None):
"""
Checks for recursion level for event
"""
level -= 1
return True
- def _check_closing_date(self, cr, uid, ids):
- for event in self.browse(cr, uid, ids):
+ def _check_closing_date(self, cr, uid, ids, context=None):
+ for event in self.browse(cr, uid, ids, context=context):
if event.date_end < event.date_begin:
return False
return True
inv_pool = self.pool.get('account.invoice')
product_pool = self.pool.get('product.product')
contact_pool = self.pool.get('res.partner.contact')
- if not context:
+ if context is None:
context = {}
# If date was specified, use it as date invoiced, usefull when invoices are generated this month and put the
# last day of the last month as invoice date
def do_close(self, cr, uid, ids, context=None):
""" Close Registration
"""
- if not context:
+ if context is None:
context = {}
invoice_id = context.get('invoice_id', False)
values = {'state': 'done', 'date_closed': time.strftime('%Y-%m-%d %H:%M:%S')}
@param context: A standard dictionary for contextual values
@return: True
"""
- if not context:
- context = {}
if type(ids) in (int, long,):
ids = [ids]
data_pool = self.pool.get('ir.model.data')
unconfirmed_ids = []
+ if context is None:
+ context = {}
for registration in self.browse(cr, uid, ids, context=context):
total_confirmed = registration.event_id.register_current + registration.nb_register
if total_confirmed <= registration.event_id.register_max or registration.event_id.register_max == 0:
def button_reg_close(self, cr, uid, ids, context=None):
"""This Function Close Event Registration.
"""
- if not context:
- context = {}
data_pool = self.pool.get('ir.model.data')
unclosed_ids = []
+ if context is None:
+ context = {}
for registration in self.browse(cr, uid, ids, context=context):
if registration.tobe_invoiced and not registration.invoice_id:
unclosed_ids.append(registration.id)
"""
Send email to user
"""
- if not context:
- context = {}
for regestration in self.browse(cr, uid, ids, context=context):
src = regestration.event_id.reply_to or False
subject = _('Auto Confirmation: [%s] %s') %(regestration.id, regestration.name)
body = regestration.event_id.mail_confirm
if subject or body:
- tools.email_send(src, email_to, subject, body, email_cc = email_cc, openobject_id = regestration.id)
+ tools.email_send(src, email_to, subject, body, email_cc=email_cc, openobject_id=regestration.id)
self.history(cr, uid, [regestration], subject, history = True, \
- email = email_to, details = body, \
- subject = subject, email_from = src, \
- email_cc = ', '.join(email_cc))
+ email=email_to, details=body, \
+ subjec=subject, email_from=src, \
+ email_cc=', '.join(email_cc))
return True