Wrong values when selecting a Invoice at Payment Window

Description

reported at https://groups.google.com/d/msg/idempiere/Xse7eaSM_uE/3HHvZckp9_QJ

Hi community,

I found a situation that we can reproduce at https://demo.idempiere.com/webui/:

  • Login to GardenWorld

  • Open Payment window and create a new record

  • Select "Joe Block" as Business Partner

  • Now, open the invoice info window and click on "ReQuery".
    This will show up 2 records (invoice pay schedule) from the same Invoice with Document Number: 100000, Grand Total: 228,85

  • Due date: 11/01/2003, Open Amt: 114,43

  • Due date: 12/01/2003, Open Amt: 114,42

  • Now, select one of the records (I selected 114,43) and click on "OK"

  • When the Info Window closes we can see the Payment window with:

  • The Invoice field filled with the selected invoice 100000 (this is OK);

  • the Payment amount field filled with the Invoice Grand Total (228,85), here i think that it's not ok. It shouldn't be 114,13 ?

Checking the CalloutPayment.invoice code, near line 72 we have:

if (Env.getContextAsInt (ctx, WindowNo, Env.TAB_INFO, "C_Invoice_ID") == C_Invoice_ID.intValue ()
&& Env.getContextAsInt (ctx, WindowNo, Env.TAB_INFO, "C_InvoicePaySchedule_ID") != 0)
{
C_InvoicePaySchedule_ID = Env.getContextAsInt (ctx, WindowNo, Env.TAB_INFO, "C_InvoicePaySchedule_ID");
}

Everything works ok if I change this code to:

if (Env.getContextAsInt (ctx, WindowNo, Env.TAB_INFO, "C_InvoicePaySchedule_ID") != 0)
{
C_InvoicePaySchedule_ID = Env.getContextAsInt (ctx, WindowNo, Env.TAB_INFO, "C_InvoicePaySchedule_ID");
}

Trying to understando more about the problem, I checked my context after closing Info Window and I don't have a C_Invoice_ID value defined:

1|1113|C_BPartner_ID == 118
1|1113|C_Currency_ID == 102
1|1113|C_InvoicePaySchedule_ID == 102
1|1113|ConvertedAmount == 125.87
1|1113|DateInvoiced == 2003-11-01 00:00:00.0
1|1113|Description == Export Order
1|1113|DocumentNo == 100000
1|1113|DueDate == 2003-11-01 00:00:00.0
1|1113|GrandTotal == 114.43
1|1113|IsPaid == false
1|1113|IsSOTrx == true
1|1113|OpenAmt == 114.43
1|1113|POReference ==

I would like to confirm if this is a bug or I'm doing something wrong.

Note: We have the same situation at CalloutPaymentAllocate.invoice

BR,

Environment

None

Activity

Fixed

Details

Assignee

Reporter

Priority

Created June 11, 2014 at 4:50 PM
Updated August 29, 2014 at 12:49 PM
Resolved June 11, 2014 at 4:51 PM