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

Activity

Show:
Michael Powacht
March 18, 2021, 12:36 AM

Thanks to Elaine and Heng-Sin for fixing this issue. Zuellig Industrial is sponsoring this bug fix.

Elaine Tan
March 10, 2021, 2:28 AM

Hi ,

This ticket is ready for peer review.

Thanks,
Elaine

Michael Powacht
March 8, 2021, 11:51 PM

Hi @Elaine, we successfully tested this patch in 7.1 and we are going to deploy it today in our 7.1 Production. Could you please have all changes pushed/merged to i8.2?

Thanks, Michael

Elaine Tan
March 4, 2021, 5:50 AM

Hi ,

Changes:

  • Fix the bug at the reversed matched invoice

Patch: 0009-IDEMPIERE-4263-Wrong-matched-invoice-GL-posting-curr.patch

Thanks,
Elaine

Michael Powacht
March 2, 2021, 3:17 AM
Edited

Thanks Elaine, yesterday we started testing your patch but we are not quite done yet as we want to test other scenarios as well. Here is what we found so far: Ib the spreadsheet we sent, there are two issues. Issue 1.PIC not Zero-Resolved is resolved but 2. Reversal Posting is still a problem with unnecessary unrealized gain loss postings offset against a large amount of Currency Balancing.

All tests are still based on release 7.1.

Fixed

Assignee

Heng Sin Low

Reporter

Michael Powacht

Labels

None

Tested By

None

Components

Fix versions

Affects versions

Priority

Major