Skip to content

Commit

Permalink
Merge remote-tracking branch 'odoo/7.0' into 7.0
Browse files Browse the repository at this point in the history
Conflicts:
	addons/stock/stock.py
  • Loading branch information
OCA git bot authored and OCA git bot committed Sep 26, 2015
2 parents b92ae25 + 117b636 commit 0a182c4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
8 changes: 8 additions & 0 deletions addons/mail/mail_mail.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
from urllib import urlencode
from urlparse import urljoin

import psycopg2

from openerp import tools
from openerp import SUPERUSER_ID
from openerp.osv import fields, osv
Expand Down Expand Up @@ -338,6 +340,12 @@ def send(self, cr, uid, ids, auto_commit=False, recipient_ids=None, context=None
# prevent catching transient MemoryErrors, bubble up to notify user or abort cron job
# instead of marking the mail as failed
raise
except psycopg2.Error:
# If an error with the database occurs, chances are that the cursor is unusable.
# This will lead to an `psycopg2.InternalError` being raised when trying to write
# `state`, shadowing the original exception and forbid a retry on concurrent
# update. Let's bubble it.
raise
except Exception:
_logger.exception('failed sending mail.mail %s', mail.id)
mail.write({'state': 'exception'})
Expand Down
3 changes: 1 addition & 2 deletions addons/stock/stock.py
Original file line number Diff line number Diff line change
Expand Up @@ -1145,8 +1145,7 @@ def action_invoice_create(self, cr, uid, ids, journal_id=False,
res = {}
inv_type = type
for picking_id in ids:
# We browse INSIDE THE LOOP in order to avoid this bug:
# https://github.com/odoo/odoo/issues/4201
# The browse inside the loop is done on purpose, as a change in the pickings during the loop is possible
picking = self.browse(cr, uid, picking_id, context=context)
if picking.invoice_state != '2binvoiced':
continue
Expand Down

0 comments on commit 0a182c4

Please sign in to comment.