Wrong matched invoice GL posting (currency balancing) in alternate schema for vendor credit memo if > 1 credit memo line

Description

The incorrect GL posting can be simulated as follows:
2 accounting schemes: primary schema=local currency, secondary schema=USD
Currency rate local currency/USD = 31.526248754713

1. Create PO with 2 PO lines,
1.1 1st line Product=A, qty=2400, unit price=1.00 in local currency
1.2 2nd line Product=B, qty=2400, unit price=2.00 in local currency
2. Create vendor invoice using Invoice (Vendor) against above PO for both lines, total quantity
3. Create vendor credit memo using invoice (vendor) against above PO for both lines, credit memo qty=100 in each line
4.1 Matched invoice GL posting in USD schema of first credit memo line is correct:
CR Inventory Clearing USD 3.17
DR Inventory Clearing USD 3.17
4.2 Matched invoice GL posting in USD schema of second credit memo line is INCORRECT:
CR Inventory Clearing USD 6.34 => CORRECT
DR Inventory Clearing USD 6.34 => CORRECT
CR Inventory Clearing USD 3.17 =>INCORRECT
DR Currency Balancing USD 3.17 => INCORRECT
It appears as if the incorrect currency balancing posting amount comprises the sum of all other credit
memo lines (3.17) and matched invoice GL postings.

Other JIRA tickets related to this ticket are:
https://idempiere.atlassian.net/browse/IDEMPIERE-4006
https://idempiere.atlassian.net/browse/IDEMPIERE-4127

Environment

None

Assignee

Elaine Tan

Reporter

Michael Powacht

Labels

None

Tested By

None

Components

Affects versions

Priority

Major
Configure