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

Activity

Show:
Michael Powacht
August 20, 2018, 3:05 AM

Thanks Soo Fang, will get back on this shortly.

Michael Powacht
August 20, 2018, 8:11 AM

Hello Soo Fang, I successfully applied the patch for MMatchPO but MInOut wasn't working (maybe because I haven't applied all the commits in the public repo since March 2018) so I added your patch code manually to MInOut.java. I simulated the above scenario and I still get error message "DBExecuteError:ERROR: null value in column "c_invoiceline_id" violates not-null constraint" in step 7.

Can you please take a look?
Michael

Soo Fang Lee
August 21, 2018, 1:57 AM

Micheal,
I've tested in my local with the described step in the ticket.
However I was not able to reproduce the error message
"DBExecuteError:ERROR: null value in column "c_invoiceline_id" violates
not-null constraint" in step 7.

On Mon, Aug 20, 2018 at 4:11 PM, Michael Powacht (JIRA) <


Regards,
Soo Fang

Soo Fang Lee
August 23, 2018, 12:02 AM

Micheal,
Please update the patch and re-test, thanks.

Michael Powacht
August 23, 2018, 4:44 AM

Thank you Soo Fang, I extended my tests and found another scenario where reversal behaves erratically:
PO Qty=10

Successful tests:
PO(10)=>MR(10)=>Inv(10)=>RevCorr MR=>MR(10) OK
PO(10)=>Inv(10)=>MR(10)=>RevCorr MR=>MR(10) OK
PO(10)=>MR1(5)=>Inv(10)=>MR2(5)=>RevCorr MR2=>MR2(5) OK
PO(10)=>Inv(10)=>MR(5)=>RevCorr MR=>MR(10) OK

Unsuccessful test:
PO(10)=>MR(10)=>Inv(5)=>RevCorr MR
There are 2 related issues:

Issue1: When creating Inv(5), the system does not create a matched PO for qty=5, instead it shows 2 separate lines:
Receipt line(10), Invoice line(5)
After MR, the system should first create 1 matched PO line for MR(10)
After Invoice, the system should create a new matched PO line with receipt/invoice(5) and update the 1st matched PO line to MR(5).
Issue2: After reverse/correct the system creates some additional matched PO lines with vendor invoice -5 +5. I am attaching a screen shot for more clarity:

Assignee

Heng Sin Low

Reporter

Michael Powacht

Labels

None

Tested By

None

Components

Fix versions

Affects versions

Priority

Major
Configure