"""
proc_obj = self.pool.get('procurement.order')
#As this function is in a new thread, i need to open a new cursor, because the old one may be closed
- new_cr = pooler.get_db(cr.dbname).cursor()
+ new_cr = self.pool.cursor()
+ scheduler_cron_id = self.pool['ir.model.data'].get_object_reference(new_cr, SUPERUSER_ID, 'procurement', 'ir_cron_scheduler_action')[1]
+ # Avoid to run the scheduler multiple times in the same time
+ try:
+ with tools.mute_logger('openerp.sql_db'):
+ new_cr.execute("SELECT id FROM ir_cron WHERE id = %s FOR UPDATE NOWAIT", (scheduler_cron_id,))
+ except Exception:
+ _logger.info('Attempt to run procurement scheduler aborted, as already running')
+ new_cr.rollback()
+ new_cr.close()
+ return {}
for proc in self.browse(new_cr, uid, ids, context=context):
proc_obj.run_scheduler(new_cr, uid, automatic=proc.automatic, use_new_cursor=new_cr.dbname,\
context=context)
tx = request.registry['payment.transaction'].browse(cr, uid, tx_ids[0], context=context)
state = tx.state
if state == 'done':
- message = '<p>Your payment has been received.</p>'
+ message = '<p>%s</p>' % _('Your payment has been received.')
elif state == 'cancel':
- message = '<p>The payment seems to have been canceled.</p>'
+ message = '<p>%s</p>' % _('The payment seems to have been canceled.')
elif state == 'pending' and tx.acquirer_id.validation == 'manual':
- message = '<p>Your transaction is waiting confirmation.</p>'
+ message = '<p>%s</p>' % _('Your transaction is waiting confirmation.')
- message += tx.acquirer_id.post_msg
+ if tx.acquirer_id.post_msg:
+ message += tx.acquirer_id.post_msg
else:
- message = '<p>Your transaction is waiting confirmation.</p>'
+ message = '<p>%s</p>' % _('Your transaction is waiting confirmation.')
validation = tx.acquirer_id.validation
return {