Process "Create AP Expense Invoices" creates wrong AP and expense postings if product's price list "isTaxIncluded=Y"

Description

Here is how to simulate the above error condition:

1. Create Price List and set Price includes Tax=Y
2. Create Price List version for Price List in 1.
3. Create Product, Product Type=Service, Tax Category: any category with VAT (in my example 7%). Create Price for Price List version in Product>Price
4. Create BP, set Employee=Y, create user in BP>Contact(User)
5.1 Create expense report using >Expense Report, enter Price List from 1. BP from 4.
5.2 Create expense report line, Product from 3, Expense amount=1,070.00 (includes 7% VAT)
5.3 Complete expense report
8.1 Execute process Create AP Expense Invoices, BP from 4.

An invoice will get generated with the following values:
C_InvoiceLine-LineNetAmt=1070 OK
C_InvoiceLine-LineTotalAmt=1070 OK
C_InvoiceLine-PriceEntered=1070 OK
C_InvoiceLine-PriceActual=1070 OK
C_InvoiceLine-TaxAmt=70 OK

C_Invoice-Totallines = 1070 OK
C_Invoice-GrandTotal = 1,140.00 *NOT OK (should be 1070) *

C_InvoiceTax-TaxAmt = 70 OK
C_InvoiceTax-TaxBaseAmt = 1000 =OK
Price includes Tax=N NOT OK (should be Y)

As a result, the invoice is wrongly posted
CR AP 1140 NOT OK (should be 1070)
DR Expense 1070 NOT OK (should be 1000)
DR VAT 70 OK

I have simulated this in https://demo.globalqss.com
Expense Report=10000004
Invoice=10000004

Environment

None

Attachments

1
  • 27 Jul 2018, 12:29 AM

Activity

Show:

Michael Powacht August 8, 2018 at 6:45 AM

Many thanks!

Heng Sin Low August 8, 2018 at 3:18 AM

Michael Powacht July 27, 2018 at 2:28 AM

Many thanks Soo Fang. I successfully tested your patch.
Could you please initiate a peer review for deployment in public repo?

Here is the test result using the same test parameters as above:

C_InvoiceLine-LineNetAmt=1070 OK
C_InvoiceLine-LineTotalAmt=1070 OK
C_InvoiceLine-PriceEntered=1070 OK
C_InvoiceLine-PriceActual=1070 OK
C_InvoiceLine-TaxAmt=70 OK

C_Invoice-Totallines = 1070 OK
C_Invoice-GrandTotal = 1070 OK

C_InvoiceTax-TaxAmt = 70 OK
C_InvoiceTax-TaxBaseAmt = 1000 OK
Price includes Tax=Y OK

Accounting facts:
CR AP 1070 OK
DR Expense 1000 OK
DR VAT 70 OK

Soo Fang Lee July 27, 2018 at 12:29 AM

Micheal,
Please apply the patch and perform the test. Thanks.

Fixed

Details

Assignee

Reporter

Components

Fix versions

Affects versions

Priority

Created July 26, 2018 at 1:09 AM
Updated October 1, 2018 at 10:09 AM
Resolved August 8, 2018 at 3:17 AM