[FIX] purchase; don't try to post messages on PO if there is no purchase related to an invoice
bzr revid: qdp-launchpad@openerp.com-20130314170226-3bvvsvd8aq2a9lkg
This commit is contained in:
@@ -1208,14 +1208,16 @@ class account_invoice(osv.Model):
|
||||
res = super(account_invoice, self).invoice_validate(cr, uid, ids, context=context)
|
||||
purchase_order_obj = self.pool.get('purchase.order')
|
||||
po_ids = purchase_order_obj.search(cr, uid, [('invoice_ids', 'in', ids)], context=context)
|
||||
purchase_order_obj.message_post(cr, uid, po_ids, body=_("Invoice received"), context=context)
|
||||
if po_ids:
|
||||
purchase_order_obj.message_post(cr, uid, po_ids, body=_("Invoice received"), context=context)
|
||||
return res
|
||||
|
||||
def confirm_paid(self, cr, uid, ids, context=None):
|
||||
res = super(account_invoice, self).confirm_paid(cr, uid, ids, context=context)
|
||||
purchase_order_obj = self.pool.get('purchase.order')
|
||||
po_ids = purchase_order_obj.search(cr, uid, [('invoice_ids', 'in', ids)], context=context)
|
||||
purchase_order_obj.message_post(cr, uid, po_ids, body=_("Invoice paid"), context=context)
|
||||
if po_ids:
|
||||
purchase_order_obj.message_post(cr, uid, po_ids, body=_("Invoice paid"), context=context)
|
||||
return res
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user