MatchInv posted error when default account in Invoice was replaced by GL_Distribution

Description

It's cause because Doc_MatchInv didn't know about GL_Distribution. Doc_MatchInv take default account, then look up factlines (call updateReverseLine()) from fact_acct for Invoice by default account and didn't find anything, because default account in Invoice posting was replaced by distribution.

The solution.
1. Create new table for trace replacement by distribution.
2. Edit Fact.java distribute() method for writes to trace table .
3. Edit Doc.java deleteAcct() method for delete from trace table.
4. Create a function that finds a new account for the replaced in trace table by default account.
5. Edit FactLine.java updateReverseLine method with new function.

This solution is universal and fix bug not only for MatchInv, but for other docs which use updateReverseLine method.

In our instance of Idempiere we wrote code by this variant of solution and it works fine. If anybody interested, I can attach all source code & functions of our solution.

Environment

Idempiere have a cool feature - GL Distibution.
We can create new Distribution for replace one account another.
In GL_Distribution set:

  • AnyAcct = 'Y'

  • Account_ID = 1111

  • C_DocType_ID = AP_Invoice
    In GL_DistributionLine set:

  • Percent = 100

  • OverwriteAcct = 'Y'

  • Account_ID = 2222

Then create AP Invoice and post it. Insteed 1111 account in fact_acct will be written 2222. It is cool.
After that we create MatchInv with this Invoice and try to post it, but taken a error - "Invoice not posted yet".

Attachments

2
  • 15 Apr 2017, 04:23 PM
  • 15 Apr 2017, 04:17 PM

Activity

Show:

Details

Assignee

Reporter

Components

Priority

Created April 15, 2017 at 4:16 PM
Updated April 15, 2017 at 4:23 PM