Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0029615Openbravo ERPZ. Otherspublic2015-04-16 18:232016-02-02 09:34
ngarcia 
umartirena 
immediatemajoralways
closedfixed 
5
 
 
vmromanos
Core
Production - Confirmed Stable
2014-06-19
3.0PR14Q3
https://code.openbravo.com/erp/devel/pi/rev/f94f08e02e3a [^]
Yes
0029615: Wrong amount in Used Credit Source tab when paying an invoice with credit and refunding the difference to the customer
Wrong amount in Used Credit Source tab when paying an invoice with credit and refunding the difference to the customer
As group admin role:
   Create a Payment In where you leave 100 EUR as credit to a Business Partner
   Create a Sales Invoice of 75 EUR for the same Business Partner
   Create a new Payment In, select the credit to use, the invoice to pay and Refund the amount to the Customer
   Check two payments are created:
      One with the refund that do not have any record in the Used Credit tab
      One with the invoice payment that has a record of 100 EUR in the Used Credit Source tab
   Post this last payment and check the difference of 25 is posted to Currency balancing account
No tags attached.
depends on backport 00296193.0PR15Q2 closed umartirena Wrong amount in Used Credit Source tab when paying an invoice with credit and refunding the difference to the customer 
depends on backport 00296203.0PR15Q1.4 closed umartirena Wrong amount in Used Credit Source tab when paying an invoice with credit and refunding the difference to the customer 
caused by feature request 0029391 closed Sandrahuguet Add Payment refactor project 
related to defect 0032579 closed markmm82 Generated credit is set as used although it is not possible to process the payment that uses it 
Issue History
2015-04-16 18:23ngarciaNew Issue
2015-04-16 18:23ngarciaAssigned To => Triage Finance
2015-04-16 18:23ngarciaModules => Core
2015-04-16 18:23ngarciaResolution time => 1432159200
2015-04-16 18:23ngarciaTriggers an Emergency Pack => No
2015-04-16 18:25ngarciaIssue Monitored: networkb
2015-04-16 19:35umartirenaRegression level => Production - Confirmed Stable
2015-04-16 19:35umartirenaRegression date => 2014-06-19
2015-04-16 19:35umartirenaRegression introduced in release => 3.0PR14Q3
2015-04-16 19:35umartirenaRegression introduced by commit => https://code.openbravo.com/erp/devel/pi/rev/f94f08e02e3a [^]
2015-04-16 19:35umartirenaTriggers an Emergency PackNo => Yes
2015-04-16 19:38umartirenaStatusnew => scheduled
2015-04-16 19:38umartirenaAssigned ToTriage Finance => umartirena
2015-04-17 14:42umartirenaNote Added: 0076609
2015-04-20 14:21hgbotCheckin
2015-04-20 14:21hgbotNote Added: 0076632
2015-04-20 14:22hgbotStatusscheduled => resolved
2015-04-20 14:22hgbotResolutionopen => fixed
2015-04-20 14:22hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/59ab316d379204bc4370719e9d45c4630da1ee0b [^]
2015-04-20 14:22vmromanosReview Assigned To => vmromanos
2015-04-20 14:22vmromanosNote Added: 0076633
2015-04-20 14:22vmromanosStatusresolved => closed
2015-04-22 10:12dmitry_mezentsevRelationship addedcaused by 0029391
2015-05-07 22:16hudsonbotCheckin
2015-05-07 22:16hudsonbotNote Added: 0077136
2015-05-20 10:20umartirenaNote Added: 0077596
2016-02-02 09:34hgbotCheckin
2016-02-02 09:34hgbotNote Added: 0083803
2016-04-07 10:55aferrazRelationship addedrelated to 0032579

Notes
(0076609)
umartirena   
2015-04-17 14:42   
Test Plan:

1)

* Create a Payment In where you leave 100 EUR as credit to a Business Partner
* Create a Sales Invoice of 75 EUR for the same Business Partner
* Create a new Payment In, select the credit to use, the invoice to pay and Refund the amount to the Customer
* Check two payments are created:
      - One with the refund payment has a record of 25 EUR in the Used Credit Source tab
      - One with the invoice payment that has a record of 75 EUR in the Used Credit Source tab
* Post both payments:
      - The invoice payment posts 75 to "Customer Prepayments"
      - The refund payment posts 25 to "Customer Prepayments"

2)

* Create a Payment In where you leave 100 EUR as credit to a Business Partner
* Create a Payment In where you leave 50 EUR as credit to a Business Partner
* Create a Payment In where you leave 75 EUR as credit to a Business Partner
* Create a Sales Invoice of 75 EUR for the same Business Partner
* Create a new Payment In:
      - select an amount of 50 of the second payment created.
      - select an amount of 75 of the third payment created.
      - select the invoice to pay
      - select "Refund the amount to the Customer" (difference of 50)
* Check two payments are created:
      - One with the refund payment has a record of 50 EUR in the Used Credit Source tab pointint to second or third payments.
      - One with the invoice payment that has a record of 75 EUR in the Used Credit Source tab pointing. to second or third payments.
* Post both payments:
      - The invoice payment posts 75 to "Customer Prepayments"
      - The refund payment posts 50 to "Customer Prepayments"
(0076632)
hgbot   
2015-04-20 14:21   
Repository: erp/devel/pi
Changeset: 59ab316d379204bc4370719e9d45c4630da1ee0b
Author: Unai Martirena <unai.martirena <at> openbravo.com>
Date: Fri Apr 17 14:56:13 2015 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/59ab316d379204bc4370719e9d45c4630da1ee0b [^]

Fixes bug 29615: Correctly used credit when paying an invoice and refunding

There were two issues while managing this scenario:

[1] In 'addCredit' method inside AddPaymentActionHandler.java class, a loop of Credit to Use grid is done, creating Payment Credit Used records assigned to the new created payment of the invoice. This method was not taking into account that could be credit amount that exceeds the invoice amount (amount to be refunded) and it was assigning all the credit amount as used to the payment of the invoice. So the refund payment that is created right after was been left without any used credit payment.

[2] After fixing the previous method, the second issue appears. The 'updateUsedCredit' method inside FIN_PaymentProcess.java class retrieves all the payments of the business partner that has generated credit, and it assigns as used to the refund payment. The problem with this function is that before the Add Payment refactor it was not possible to select which credit payments we wanted to consume, it was only a total credit amount to be consumed and the system behind was being consuming any of them. But after the refactor it is possible to select the ones that want to be consumed.

In order to fix this last issue the selected credit line ids are added as a parameter to 'updateUsedCredit' method.

---
M modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/actionHandler/AddPaymentActionHandler.java
M modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/process/FIN_AddPayment.java
M modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/process/FIN_PaymentProcess.java
---
(0076633)
vmromanos   
2015-04-20 14:22   
Code review + testing OK
(0077136)
hudsonbot   
2015-05-07 22:16   
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/a1817f84bd8b [^]
Maturity status: Test
(0077596)
umartirena   
2015-05-20 10:20   
Test in TestLink: https://testlink.openbravo.com/testlink/linkto.php?tprojectPrefix=Communit&item=testcase&id=Communit-8282 [^]
(0083803)
hgbot   
2016-02-02 09:34   
Repository: tools/automation/int
Changeset: cf90a167c46d3e1861737041feec679f622b2828
Author: Alvaro Ferraz <alvaro.ferraz <at> openbravo.com>
Date: Mon Sep 21 09:43:16 2015 +0200
URL: http://code.openbravo.com/tools/automation/int/rev/cf90a167c46d3e1861737041feec679f622b2828 [^]

Related to issue 29615: Added some automated tests

---
M src-test/com/openbravo/test/integration/erp/gui/financial/receivablespayables/transactions/AddPaymentProcess.java
M src-test/com/openbravo/test/integration/erp/gui/financial/receivablespayables/transactions/paymentout/PaymentOutTab.java
M src-test/com/openbravo/test/integration/erp/modules/functionalteam/addpayment/testsuites/APR_Regressions/RegressionSuite.java
M src-test/com/openbravo/test/integration/erp/modules/functionalteam/addpayment/testsuites/APR_Regressions/build.xml
M src-test/com/openbravo/test/integration/erp/testscripts/financial/receivablespayables/transactions/PaymentOut.java
A src-test/com/openbravo/test/integration/erp/modules/functionalteam/addpayment/testsuites/APR_Regressions/APRRegression015.java
---