Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0030439Openbravo ERPZ. Otherspublic2015-07-28 13:482015-08-20 23:16
ngarcia 
aferraz 
immediatecriticalalways
closedfixed 
5
 
 
vmromanos
Advanced Payables and Receivables Mngmt
No
0030439: Credit is consumed from other payment when refunding the difference to a customer who has available credit
Credit is consumed from other payment when refunding the difference to a customer who has available credit
As group admin role:
   Create a Payment In of 50 to a customer and leave the amount to be used later
   Create a Sales Invoice of 60 to the same customer. Do not use the credit
   Create a new Payment In of 70 to the same customer. Select the option to Refund the difference to the customer
   Check the refund payment is pointing the payment where the credit was generated (first payment) instead of the payment where the invoice was paid (second payment): check the Used Credit Source tab of the refund payment and the used credit of the first payment
No tags attached.
Issue History
2015-07-28 13:48ngarciaNew Issue
2015-07-28 13:48ngarciaAssigned To => Triage Finance
2015-07-28 13:48ngarciaModules => Advanced Payables and Receivables Mngmt
2015-07-28 13:48ngarciaResolution time => 1441058400
2015-07-28 13:48ngarciaTriggers an Emergency Pack => No
2015-07-28 13:48ngarciaIssue Monitored: networkb
2015-07-28 13:59jpcalventeIssue Monitored: jpcalvente
2015-07-29 13:17ngarciaPriorityurgent => immediate
2015-07-29 13:17ngarciaSeveritymajor => critical
2015-08-04 11:23aferrazAssigned ToTriage Finance => aferraz
2015-08-05 13:50aferrazNote Added: 0079201
2015-08-05 13:54aferrazNote Edited: 0079201bug_revision_view_page.php?bugnote_id=0079201#r9157
2015-08-07 08:36vmromanosStatusnew => scheduled
2015-08-07 10:44vmromanosNote Added: 0079245
2015-08-07 10:47hgbotCheckin
2015-08-07 10:47hgbotNote Added: 0079246
2015-08-07 10:47hgbotStatusscheduled => resolved
2015-08-07 10:47hgbotResolutionopen => fixed
2015-08-07 10:47hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/f0a9563883215bfb8e8d98eeeaf8b03aa55ef01e [^]
2015-08-07 10:48vmromanosReview Assigned To => vmromanos
2015-08-07 10:48vmromanosNote Added: 0079247
2015-08-07 10:48vmromanosStatusresolved => closed
2015-08-20 23:16hudsonbotCheckin
2015-08-20 23:16hudsonbotNote Added: 0079532

Notes
(0079201)
aferraz   
2015-08-05 13:50   
(edited on: 2015-08-05 13:54)
Test Plan 1:

As F&B Admin:

Create a Payment In of 50 to a customer and leave the amount to be used later.
Create a Sales Invoice of 60 to the same customer. Do not use the credit.
  Click on Add Payment.
  Select an amount of 70.
  Select the option to Refund the difference to the customer.
Check in the Used Credit Source tab of the refund payment, that it points to the payment where the invoice was paid (second payment).
Check also the Generated Credit and Used Credit fields of three payments are correct.

Test Plan 2:

As F&B Admin:

Create a Payment In of 50 to a customer and leave the amount to be used later.
Create a Sales Invoice of 60 to the same customer. Do not use the credit.
  Click on Add Payment.
  Select an amount of 70.
  Select the available credit in Credit to Use grid.
  Select the option to Refund the difference to the customer.
Check in the Used Credit Source tab of the refund payment, that a record points to the payment where the invoice was paid (second payment) with an amount of 10 and another record points to the payment where the credit was generated (first payment) with an amount of 50.
Check also the Generated Credit and Used Credit fields of three payments are correct.

Test Plan 3:

As F&B Admin:

Create a Payment In of 50 to a customer and leave the amount to be used later.
Create a Sales Invoice of 60 to the same customer. Do not use the credit.
  Click on Add Payment.
  Select an amount of 0.
  Uncheck the invoice in the grid.
  Select the available credit in Credit to Use grid.
  Select the option to Refund the difference to the customer.
Check in the Used Credit Source tab of the refund payment, that a record points to the payment where the credit was generated (first payment) with an amount of 50.
Check also the Generated Credit and Used Credit fields of three payments are correct.

(0079245)
vmromanos   
2015-08-07 10:44   
Before fixing this issue, the credit was consumed from the oldest to the newest one (FIFO).
After this fix, in case of a refund, the credit is directly consumed from the payment that pays the invoice and generates the refund (regardless of a previous credit payment already exists)

This is a semantic functional change that has been approved by DME because it makes it easier to understand the flow.
Since the data generated by the previous behavior is correct (amounts are correct, only the credit source is difference), we have decided not to create a script to modify the existing data.
(0079246)
hgbot   
2015-08-07 10:47   
Repository: erp/devel/pi
Changeset: f0a9563883215bfb8e8d98eeeaf8b03aa55ef01e
Author: Alvaro Ferraz <alvaro.ferraz <at> openbravo.com>
Date: Wed Aug 05 10:21:32 2015 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/f0a9563883215bfb8e8d98eeeaf8b03aa55ef01e [^]

Fixes issue 30439: Credit wrongly consumed when refunding a difference

When refunding a payment difference to a customer who has available credit, credit was consumed by first generated credit instead of current payment.
If case of refunding an amount generated as credit in the same payment, this payment will be now used to consume the credit, sending payment info through strSelectedCreditLinesIds parameter.
Then, updateUsedCredit method in FIN_PaymentProcess will link them correctly.

---
M modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/actionHandler/AddPaymentActionHandler.java
---
(0079247)
vmromanos   
2015-08-07 10:48   
Code review + testing OK
(0079532)
hudsonbot   
2015-08-20 23: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/8c91718397a5 [^]
Maturity status: Test