[FIX] sale: don't try to post messages on SO if there is no sale related to an invoice

bzr revid: qdp-launchpad@openerp.com-20130314164413-qv3j3b3tcc4zt6b7
This commit is contained in:
Quentin (OpenERP) 2013-03-14 17:44:13 +01:00
parent 6262548099
commit 513601e641
1 changed files with 2 additions and 1 deletions

View File

@ -1020,7 +1020,8 @@ class account_invoice(osv.Model):
sale_order_obj = self.pool.get('sale.order')
res = super(account_invoice, self).confirm_paid(cr, uid, ids, context=context)
so_ids = sale_order_obj.search(cr, uid, [('invoice_ids', 'in', ids)], context=context)
sale_order_obj.message_post(cr, uid, so_ids, body=_("Invoice paid"), context=context)
if so_ids:
sale_order_obj.message_post(cr, uid, so_ids, body=_("Invoice paid"), context=context)
return res
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: