[FIX] purchase: apply same fix to invoice paid
bzr revid: mat@openerp.com-20131029093404-hw95lpcjsnok2wxa
This commit is contained in:
parent
44d117398a
commit
7f9b84150f
|
@ -1244,9 +1244,14 @@ class account_invoice(osv.Model):
|
|||
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)
|
||||
# read access on purchase.order object is not required
|
||||
if not purchase_order_obj.check_access_rights(cr, uid, 'read', raise_exception=False):
|
||||
user_id = SUPERUSER_ID
|
||||
else:
|
||||
user_id = uid
|
||||
po_ids = purchase_order_obj.search(cr, user_id, [('invoice_ids', 'in', ids)], context=context)
|
||||
if po_ids:
|
||||
purchase_order_obj.message_post(cr, uid, po_ids, body=_("Invoice paid"), context=context)
|
||||
purchase_order_obj.message_post(cr, user_id, po_ids, body=_("Invoice paid"), context=context)
|
||||
return res
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue