When recording a vendor RMA, Return to Vendor and Vendor Credit Memo, the system creates a matched invoice document between Vendor Credit Memo and Return to Vendor, however, the GL posting is incorrect:
CR Inventory Clearing, DR NIR
The correct GL posting would be DR Inventory Clearing, CR NIR because return to Vendor debits GL NIR and credit memo credits GL Inventory Clearing.
This error was introduced in the past year and could be related to https://idempiere.atlassian.net/browse/IDEMPIERE-4006.
Here are the steps to reproduce the issue:
Create Vendor RMA with reference to an earlier material receipt.
Create Return to Vendor with reference to the RMA in step 1.
Create a vendor credit memo with reference to the RMA/receipt.
A matched invoice is document is being generated with the aforementioned incorrect GL fact postings.
Please address my comments for the pull request.
This ticket is ready for review.