We're updating the issue view to help you get more done. 

Wrong organziation (*) in matched PO document when reversing MR with invoice.

Description

Wrong organization (ad_org_id=* instead of real organization) in matched PO document when reversing MR with invoice under the following conditions:

CLIENT_ACCOUNTING=Q
Costing Method=Average PO

1. Create Purchase Order for a product in org=A, qty=10
2. Create MR, qty=10, org=A
2.1 =>Creates a Matched PO with org=A =>OK
3. Create Vendor Invoice, qty=10, org=A
3.1 =>The matched PO document in step2 is updated with the invoice line =>OK
4. Reverse/Correct MR.
4.1 =>Creates a matched PO reversal document with org=A =>OK
4.2 =>Creates a new matched PO document with matched vendor invoice and with the same M_PO documentNo as in 2 (with new m_matchpo_id) but with org=* => NOT OK
5. Because the matched PO document in 4.2 is assinged to org=*, the document can't be posted =>NOT OK
6. PO OnOrder qty=10 but PO qty delivered is now -10 =>NOT OK
7. An attempt to post a new MR fails with Database Error.: DBExecuteError:ERROR: null value in column "c_invoiceline_id" violates not-null constraint

Screenshot of the matched PO situation is attached.

Environment

None

Status

Assignee

Heng Sin Low

Reporter

Michael Powacht

Labels

None

Tested By

None

Components

Fix versions

Affects versions

4.1
5.1

Priority

Major