Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0032914Openbravo ERP07. Sales managementpublic2016-05-10 12:592016-06-17 19:37
psanjuan 
aferraz 
immediatemajoralways
closedfixed 
20Professional Appliance
 
 
vmromanos
Core
Packaging and release
2016-01-13
main
https://code.openbravo.com/erp/devel/pi/rev/cac91026199d [^]
No
0032914: Wrong payment status as well payment in details when partially paying a Reversed Sales Invoice
Wrong payment status as well payment details when partially paying a Reversed Sales Invoice
- Go to Sales Invoice window. Create a new one for F&B España, Alimentos BP.
- Change document type to "Reversed Sales Invoice".
- Save it

- Go to lines and create a new one.
** Product = Agua sin Gas 1
** Invoiced Quantity = -500
- Complete it. (If there is any credit available, do NOT use it).

- Press Add Payment.
- Change Actual Payment amount to -500.00
- Make sure only the reversed sales invoice just created is selected. Change its amount from -925.65 to -500.00 (see Issue 32914_Image 1).
- Press Done

- Realize that Payment Complete status of the invoice has turned into Yes (which is not correct).

- Go to Payment Plan tab and check neither received amount, outstanding amount are correct.

- Navigate to the payment in created and realize that not only the total reversed sales invoice amount has been paid, but also some credit amount has been generated. (see Issue32914_Image2)

Take note that same error is happening in purchase.
Payment Complete status should not turn into Yes because the reverse sales invoice has been partially paid.

Payment Plan should be updated properly

Payment In created should be the correct one base on actual payment entered.
No tags attached.
related to defect 0032959 closed aferraz Not possible to add more than one partial payment to a negative purchase order 
depends on backport 00329163.0PR16Q2 closed aferraz Wrong payment status as well payment in details when partially paying a Reversed Sales Invoice 
caused by defect 0031457 closed AtulOpenbravo Invoice with negative amount with an order with lower amount is set as not paid. Positive and negative schedule details pending 
related to defect 0032915 scheduled collazoandy4 Not correct distribution while partially paying a reversed sales invoice. 
related to design defect 0033026 new Triage Omni OMS Outstanding amount pending to be settle in the order while booking a prepayment 
png 32914_image1.png (72,078) 2016-05-10 13:08
https://issues.openbravo.com/file_download.php?file_id=9379&type=bug
png

png Issue32914_Image2.png (115,307) 2016-05-10 13:09
https://issues.openbravo.com/file_download.php?file_id=9380&type=bug
png

? Payment_Details_Issue32914.ods (49,272) 2016-05-20 15:20
https://issues.openbravo.com/file_download.php?file_id=9431&type=bug
Issue History
2016-05-10 12:59psanjuanNew Issue
2016-05-10 12:59psanjuanAssigned To => Triage Finance
2016-05-10 12:59psanjuanModules => Core
2016-05-10 12:59psanjuanRegression introduced in release => main
2016-05-10 12:59psanjuanTriggers an Emergency Pack => No
2016-05-10 13:08psanjuanRegression level => Packaging and release
2016-05-10 13:08psanjuanSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=12031#r12031
2016-05-10 13:08psanjuanProposed Solution updated
2016-05-10 13:08psanjuanFile Added: 32914_image1.png
2016-05-10 13:09psanjuanFile Added: Issue32914_Image2.png
2016-05-10 13:09psanjuanSummaryWrong payment status as well payment details when partially paying a Reversed Sales Invoice => Wrong payment status as well payment in details when partially paying a Reversed Sales Invoice
2016-05-10 13:12psanjuanSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=12032#r12032
2016-05-10 14:02psanjuanRelationship addedrelated to 0032915
2016-05-10 14:14aferrazRelationship addedcaused by 0031457
2016-05-10 14:18aferrazRegression date => 2016-01-13
2016-05-10 14:18aferrazRegression introduced by commit => https://code.openbravo.com/erp/devel/pi/rev/cac91026199d [^]
2016-05-10 14:19aferrazStatusnew => scheduled
2016-05-10 14:19aferrazAssigned ToTriage Finance => AtulOpenbravo
2016-05-12 15:59AtulOpenbravoNote Added: 0086413
2016-05-12 16:26AtulOpenbravoNote Added: 0086418
2016-05-12 16:28AtulOpenbravoNote Added: 0086419
2016-05-12 16:30AtulOpenbravoNote Added: 0086420
2016-05-13 13:03psanjuanNote Edited: 0086413bug_revision_view_page.php?bugnote_id=0086413#r12097
2016-05-13 13:08psanjuanNote Edited: 0086418bug_revision_view_page.php?bugnote_id=0086418#r12099
2016-05-13 13:09psanjuanNote Edited: 0086418bug_revision_view_page.php?bugnote_id=0086418#r12100
2016-05-13 13:29psanjuanNote Edited: 0086413bug_revision_view_page.php?bugnote_id=0086413#r12101
2016-05-13 13:39psanjuanNote Edited: 0086413bug_revision_view_page.php?bugnote_id=0086413#r12102
2016-05-13 13:45psanjuanNote Edited: 0086413bug_revision_view_page.php?bugnote_id=0086413#r12103
2016-05-13 13:45psanjuanNote Edited: 0086413bug_revision_view_page.php?bugnote_id=0086413#r12104
2016-05-13 13:57psanjuanNote Edited: 0086413bug_revision_view_page.php?bugnote_id=0086413#r12105
2016-05-13 14:30psanjuanNote Edited: 0086419bug_revision_view_page.php?bugnote_id=0086419#r12107
2016-05-13 14:41psanjuanNote Edited: 0086419bug_revision_view_page.php?bugnote_id=0086419#r12108
2016-05-13 14:51psanjuanNote Edited: 0086419bug_revision_view_page.php?bugnote_id=0086419#r12109
2016-05-13 14:52psanjuanNote Edited: 0086420bug_revision_view_page.php?bugnote_id=0086420#r12111
2016-05-13 15:05psanjuanNote Edited: 0086418bug_revision_view_page.php?bugnote_id=0086418#r12112
2016-05-13 15:07psanjuanNote Edited: 0086419bug_revision_view_page.php?bugnote_id=0086419#r12113
2016-05-13 15:07psanjuanNote Edited: 0086420bug_revision_view_page.php?bugnote_id=0086420#r12114
2016-05-13 15:13psanjuanNote Edited: 0086418bug_revision_view_page.php?bugnote_id=0086418#r12115
2016-05-13 15:14psanjuanRelationship addedrelated to 0032959
2016-05-13 15:21psanjuanNote Edited: 0086419bug_revision_view_page.php?bugnote_id=0086419#r12116
2016-05-16 15:09psanjuanNote Edited: 0086419bug_revision_view_page.php?bugnote_id=0086419#r12121
2016-05-16 15:11psanjuanNote Edited: 0086419bug_revision_view_page.php?bugnote_id=0086419#r12122
2016-05-16 15:20psanjuanNote Edited: 0086419bug_revision_view_page.php?bugnote_id=0086419#r12123
2016-05-18 10:21psanjuanNote Edited: 0086413bug_revision_view_page.php?bugnote_id=0086413#r12144
2016-05-18 12:22psanjuanNote Edited: 0086413bug_revision_view_page.php?bugnote_id=0086413#r12145
2016-05-19 15:40psanjuanNote Added: 0086580
2016-05-19 15:46psanjuanNote Edited: 0086580bug_revision_view_page.php?bugnote_id=0086580#r12170
2016-05-19 15:49psanjuanNote Edited: 0086580bug_revision_view_page.php?bugnote_id=0086580#r12171
2016-05-20 08:59psanjuanNote Edited: 0086580bug_revision_view_page.php?bugnote_id=0086580#r12177
2016-05-20 09:11psanjuanNote Edited: 0086580bug_revision_view_page.php?bugnote_id=0086580#r12178
2016-05-20 09:15psanjuanNote Edited: 0086418bug_revision_view_page.php?bugnote_id=0086418#r12179
2016-05-20 09:49psanjuanNote Edited: 0086413bug_revision_view_page.php?bugnote_id=0086413#r12180
2016-05-20 10:07psanjuanNote Edited: 0086413bug_revision_view_page.php?bugnote_id=0086413#r12181
2016-05-20 10:10psanjuanNote Edited: 0086413bug_revision_view_page.php?bugnote_id=0086413#r12182
2016-05-20 10:16psanjuanNote Edited: 0086413bug_revision_view_page.php?bugnote_id=0086413#r12183
2016-05-20 15:09psanjuanNote Edited: 0086419bug_revision_view_page.php?bugnote_id=0086419#r12190
2016-05-20 15:12psanjuanNote Edited: 0086419bug_revision_view_page.php?bugnote_id=0086419#r12191
2016-05-20 15:12psanjuanNote Edited: 0086419bug_revision_view_page.php?bugnote_id=0086419#r12192
2016-05-20 15:17psanjuanNote Deleted: 0086420
2016-05-20 15:17psanjuanNote Added: 0086631
2016-05-20 15:17psanjuanFile Added: Payment_Details.ods
2016-05-20 15:20psanjuanFile Deleted: Payment_Details.ods
2016-05-20 15:20psanjuanFile Added: Payment_Details_Issue32914.ods
2016-05-23 10:07aferrazAssigned ToAtulOpenbravo => aferraz
2016-05-23 13:43hgbotCheckin
2016-05-23 13:43hgbotNote Added: 0086654
2016-05-23 13:43hgbotStatusscheduled => resolved
2016-05-23 13:43hgbotResolutionopen => fixed
2016-05-23 13:43hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/036fbe5f521cf65b516c065463160fe59d6b9ef3 [^]
2016-05-23 13:44vmromanosReview Assigned To => vmromanos
2016-05-23 13:44vmromanosNote Added: 0086656
2016-05-23 13:44vmromanosStatusresolved => closed
2016-05-23 13:59vmromanosSeveritycritical => major
2016-05-23 15:14psanjuanRelationship addedrelated to 0033026
2016-06-17 19:37hudsonbotCheckin
2016-06-17 19:37hudsonbotNote Added: 0087550

Notes
(0086413)
AtulOpenbravo   
2016-05-12 15:59   
(edited on: 2016-05-20 10:16)
Test Plan 1 - Verified

- Go to Sales Invoice window. Create a new one for F&B España, Alimento BP.
- Go to lines and enter two lines for different products, any invoiced quantity.
- Complete the invoice.Do not use credit if any.
- Press Add Payment. Enter some partial payments for the invoice, at least two.
- Verify that invoice payment complete status does not change to Yes until the invoice is fully paid.
- Verify that payment plan lines and payment details are correct.

Repeat same test as above for:
- positive purchase invoice
- negative sales invoice
- negative purchase invoice
- two positive invoices
- two negative invoices with a not single payment terms but 30-60 for instance.
- two invoices, one positive and the other one negative

Test Plan 2 - Verified.

- Go to Sales Invoice window. Create a new one for F&B España, Alimentos BP.
- Change document type to "Reversed Sales Invoice".
- Save it.

- Go to lines and create a new one.
  - Product = Agua sin Gas 1
  - Invoiced Quantity = -500
- Complete it. (If there is any credit available, do not use it).

- Press Add Payment.
  - Change Actual Payment amount to -500.00
  - Make sure only the reversed sales invoice just created is selected. Change its amount from -925.65 to -500.00
- Press Done.

- Check that Payment Complete status of the invoice is No.

- Go to Payment Plan tab and check received amount is -500, outstanding amount is -425.65, both are correct.


- Press Add Payment.
  - Change Actual Payment amount to -200.00
  - Make sure only the reversed sales invoice just created is selected. Change its amount to -200.00
- Press Done.

- Check that Payment Complete status of the invoice is No.

- Go to Payment Plan tab and check that Received amount is -700, outstanding amount is -225.65, both are correct.

- Press Add Payment.
  - Pay invoice remaining amount.
- Press Done.

- Check that Payment Complete status of the invoice is now Yes.

- Go to Payment Plan tab and check that a new received amount is -925.65, outstanding amount is 0.00, both are correct.

Repeat same test as above (Test Plan 2) for a negative AR Invoice, and for a Return Material Sales Invoice.

Repeat same test as above (Test Plan 2) for purchase invoice

Repeat same test as above (Test Plan 2) for Reverse purchase invoice and Reverse sales invoice but:
- including more than 1 negative invoice
- including a not single payment term but 30-60 for instance, therefore more than one payment plan line is created and therefore can be paid.

(0086418)
AtulOpenbravo   
2016-05-12 16:26   
(edited on: 2016-05-20 09:15)
Test Plan 3 - Verified.

- Go to Purchase Order window. Create a new one for F&B España, and Business Partner as "Bebidas Alegres, S.L.".
- Keep document type as "Standard Order".
- Save it.

- Go to lines and create a new one.
  - Product = Vino Blanco
  - Ordered Quantity = -500
  - Price = 1
  - Tax = Compras Exentas
- Complete it.

- Press Add Payment.
- Make sure only the Purchase Order just created is selected. Change its amount from -500 to -200.00
- Check that Actual Amount sets as -200.
- Press Done.

- Go to Payment Plan tab and check received amount is -200, outstanding amount is -300, both are correct.

- Try to add one additional payment to this order. Check that "Add Payment " button is not there.

It is not possible to add multiple partial payments to an order, see issue related: 32959

Repeat same test as above for Sales Order.

(0086419)
AtulOpenbravo   
2016-05-12 16:28   
(edited on: 2016-05-20 15:12)
Test Plan 4 - Verified

- Login as F&B International Group Admin Role.
- Create a Purchase Order
   Add a product with a negative quantity -200.00, VAT exempt, price = 1.00
   (Total gross amount:= -200). Book the order.
- Create a purchase invoice header.
   Add the previously created order.
   Add a positive line for another product, Invoiced qty = 50, VAT exempt, price = 1.00. Complete the invoice.
   (Total gross amount:= -150.00)
   Complete it. Do not use credit if any.

- Add a payment to it from the Purchase Invoice window for -50.00
- Check purchase invoice payment plan is:
* Expected Amount = -150
* Paid Amount = -50.00
* Outstanding Amount = -100.00
- Check purchase invoice payment details are:
* Line 1 - Received Amount = -100.00 Amount = -150.00
* Line 2 - Received Amount = 50.00 Amount = -150.00

- Go to the purchase order and verify Payment Plan as below:
* Expected Amount = -200.00
* Paid Amount = -100.00
* Outstanding Amount = -100.00

All of the above is correct, as order and invoice outstanding amounts are the same.

- Add another payment in the purchase invoice for -25.50

- Add another payment for the remaining amount -74.50

- Check purchase invoice payment plan is:
* Expected Amount = -150
* Paid Amount = -150
* Outstanding Amount = 0.00
- Check purchase invoice payment details are:
* Line 1 - Received Amount = -100.00 Amount = -150.00
* Line 2 - Received Amount = 50.00 Amount = -150.00
* Line 3 - Received Amount = -25.50 Amount = -150.00
* Line 4 - Received Amount = -74.50 Amount = -150.00

- Go to the purchase order and verify Payment Plan as below:
* Expected Amount = -200.00
* Paid Amount = -200.00
* Outstanding Amount = 0.00

All of the above is correct.

For additional test on this (invoice amount do not equal to order amount), see excel sheet attached, verified for both Sales and Purchase cycle.

(0086580)
psanjuan   
2016-05-19 15:40   
(edited on: 2016-05-20 09:11)
Issue 31457 related Test Plan - Verified.

- Login as F&B International Group Admin Role.
- Go to BP window and remove basic discount for Alimentos BP.
- Create a Sales Order for F&B España, Alimentos BP, set it as Invoice Terms = Immediate
   Add a product with a negative quantity. Enter a net unit price = 1.00 and select an exempt Tax. Book it
   (Total gross amount:= -200)
- Create a sales invoice header for F&B España, Alimentos BP.
   Add the previously created order.
   Add a positive line for any other product with invoiced qty = 50, unit price =1.00 and an exempt Tax.
   (Total gross amount:= -150)
   Complete it.
- Add a payment to it from the Sales Invoice window for the total amount of the invoice (-150).
- Verify that payment complete field = Yes.
- Go to Payment Plan tab and verify there is no outstanding amount to be paid, same as in Payment details tab. Expected amount = Received Amount = -150
- Go to Sales order, payment plan tab and check that Outstanding amount = 0.00. Expected Amount = Received Amount = -200.00

- Launch the payment report and check that the invoice is shown only once with "Deposited Not Cleared" status or "Payment Received", depending on payment method configuration; but it is not shown as "Awaiting Payment". Transaction amount and Base amount = -150.00

Repeat same test for Purchase flow - Verified.

- Launch the payment report and check that the invoice is shown only once with "Withdrawn Not Cleared" status or "Payment Made", depending on payment method configuration; but it is not shown as "Awaiting Payment". Transaction amount and Base amount = 150.00

(0086631)
psanjuan   
2016-05-20 15:17   
Test plan above verified.

issue can be code reviewed and closed.
(0086654)
hgbot   
2016-05-23 13:43   
Repository: erp/devel/pi
Changeset: 036fbe5f521cf65b516c065463160fe59d6b9ef3
Author: Alvaro Ferraz <alvaro.ferraz <at> openbravo.com>
Date: Thu May 19 15:15:02 2016 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/036fbe5f521cf65b516c065463160fe59d6b9ef3 [^]

Fixes issue 32914: Fix properly issue 31457

Change getOrderedPaymentScheduleDetails method in AddPaymentActionHandler class to order by absolute value of FIN_PaymentScheduleDetail.PROPERTY_AMOUNT property.
Change also the manage negative amounts check to recalculate remainingAmount if it is lower than outstandingAmount in case remainingAmount is negative.

---
M modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/actionHandler/AddPaymentActionHandler.java
---
(0086656)
vmromanos   
2016-05-23 13:44   
Code review OK
(0087550)
hudsonbot   
2016-06-17 19:37   
A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/0dc7be081b1c [^]
Maturity status: Test