[FIX] purchase: validate invoice

A user that has the rights in Accounting & Finance equal to Invoicing & Payments
must have the right to validate a supplier invoice.

opw:634601
This commit is contained in:
Goffin Simon 2015-05-19 12:51:24 +02:00
parent 335a8afe79
commit cc61d467fa
1 changed files with 3 additions and 3 deletions

View File

@ -1325,7 +1325,7 @@ class account_invoice(osv.Model):
user_id = uid
po_ids = purchase_order_obj.search(cr, user_id, [('invoice_ids', 'in', ids)], context=context)
wf_service = netsvc.LocalService("workflow")
for order in purchase_order_obj.browse(cr, uid, po_ids, context=context):
for order in purchase_order_obj.browse(cr, user_id, po_ids, context=context):
# Signal purchase order workflow that an invoice has been validated.
invoiced = []
shipped = True
@ -1338,8 +1338,8 @@ class account_invoice(osv.Model):
if all(line.invoice_id.state not in ['draft', 'cancel'] for line in po_line.invoice_lines):
invoiced.append(po_line.id)
if invoiced and shipped:
self.pool['purchase.order.line'].write(cr, uid, invoiced, {'invoiced': True})
wf_service.trg_write(uid, 'purchase.order', order.id, cr)
self.pool['purchase.order.line'].write(cr, user_id, invoiced, {'invoiced': True})
wf_service.trg_write(user_id, 'purchase.order', order.id, cr)
return res
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: