Openbravo Issue Tracking System - Modules
View Issue Details
0038143ModulesRemittancepublic2018-03-14 15:222018-03-19 13:02
ngarcia 
AtulOpenbravo 
immediatemajoralways
closedfixed 
5
 
 
2017-05-31
https://code.openbravo.com/erp/mods/org.openbravo.module.remittance/rev/d675cb9dedd4 [^]
Production - Confirmed Stable
aferraz
734
OBPS
0038143: NullPointerException when posting a remittance that includes an invoice with more than two orders
NullPointerException when posting a remittance that includes an invoice with more than two orders

The problem is that in loadLinesFieldProvider function of DocREMRemittance class, it is trying to remove the last element of the list with

list.remove(i-1)

but i does not contain the list size as some elements have been previously removed
As group admin role:
   Apply module's dataset from Enterprise Module Management window
   Add Remittance payment method to Cuenta de Banco financial account
   Configure the Accounting for 'Printable Remittance' Remittance Type
   Create three purchase orders for the same business partner
   Set Remittance payment method and book them
   Create a Purchase Invoice, set Remittance payment method and add the three orders on it
   Complete it
   Create a Remittance header, increase its expected date to a date after invoice due date
   Select Order or Invoices
      Transaction Type: Payment Out
      Document: Order and Invoices
      Select the three lines associated with the invoice
   Process the remittance with the option 'Group by invoice'
   Try to post it and check you get the following error:
      java.lang.NullPointerException

   The log shows:
      ERROR org.openbravo.erpCommon.ad_forms.AcctServer - An error ocurred posting RecordId: <> - tableId: FF8080812E6C2859012E6D0271E1009D
java.lang.IndexOutOfBoundsException: Index: 1, Size: 1
    at java.util.ArrayList.rangeCheck(ArrayList.java:639)
    at java.util.ArrayList.remove(ArrayList.java:478)
    at org.openbravo.module.remittance.ad_forms.DocREMRemittance.loadLinesFieldProvider(DocREMRemittance.java:152)
No tags attached.
caused by defect 0036124 closed nonofrancisco Accounting information should be grouped by invoice when posting a remittance. 
Issue History
2018-03-14 15:22ngarciaNew Issue
2018-03-14 15:22ngarciaAssigned To => Triage Finance
2018-03-14 15:22ngarciaSupport ticket => 734
2018-03-14 15:22ngarciaOBNetwork customer => Yes
2018-03-14 15:24ngarciaResolution time => 1522792800
2018-03-14 15:26ngarciaRelationship addedrelated to 0036124
2018-03-14 15:27ngarciaIssue Monitored: networkb
2018-03-14 15:49ngarciaPriorityurgent => immediate
2018-03-14 15:49ngarciaRelationship replacedcaused by 0036124
2018-03-15 09:38aferrazAssigned ToTriage Finance => markmm82
2018-03-15 09:45aferrazAssigned Tomarkmm82 => AtulOpenbravo
2018-03-16 03:53AtulOpenbravoStatusnew => scheduled
2018-03-16 03:53AtulOpenbravoNote Added: 0103292
2018-03-16 04:05AtulOpenbravoNote Added: 0103293
2018-03-16 09:26AtulOpenbravoRegression date => 2017-05-31
2018-03-16 09:26AtulOpenbravoRegression introduced by commit => https://code.openbravo.com/erp/mods/org.openbravo.module.remittance/rev/d675cb9dedd4 [^]
2018-03-16 09:26AtulOpenbravoRegression level => Production - Confirmed Stable
2018-03-19 12:53hgbotCheckin
2018-03-19 12:53hgbotNote Added: 0103346
2018-03-19 12:53hgbotStatusscheduled => resolved
2018-03-19 12:53hgbotResolutionopen => fixed
2018-03-19 12:53hgbotFixed in SCM revision => http://code.openbravo.com/erp/mods/org.openbravo.module.remittance/rev/c13cad43cde57402071eb345f84971d73ed58381 [^]
2018-03-19 12:53hgbotCheckin
2018-03-19 12:53hgbotNote Added: 0103347
2018-03-19 13:02aferrazReview Assigned To => aferraz
2018-03-19 13:02aferrazNote Added: 0103348
2018-03-19 13:02aferrazStatusresolved => closed

Notes
(0103292)
AtulOpenbravo   
2018-03-16 03:53   
- Login as F&B International Group Admin role.
- Apply module's dataset from Enterprise Module Management window.
- Add Remittance payment method to Cuenta de Banco financial account.
- Configure the Accounting for 'Printable Remittance' Remittance Type for both General Ledgers.
- Create three purchase orders for the same business partner with any product, set Remittance payment method and book them.
- Create a Purchase Invoice, set Remittance payment method and add the three orders lines in it using Create Lines From. Complete it
- Create a Remittance header, set its expected date to a date after invoice due date, select Order or Invoices
      Transaction Type: Payment Out
      Document: Order and Invoices
      Select the three lines associated with the invoice
- Process the remittance with the option 'Group by invoice'
- Post the remittance and realize that it is processed successfully.
(0103293)
AtulOpenbravo   
2018-03-16 04:05   
Test Plan

- Install remittance module and apply its datase to F&B España organization.
- Go to Remittance type and select "Printable Remittance".
- Fill in Accounting information for both General Ledger (EUR and USD ones).
- Go to Financial Account window, and select "Cuenta de Banco". Go to Payment Method tab, and select "Remittance" payment method.
- Enter a purchase order for Bebidas Alegres business partner. Select any product and enter below data:
  - Ordered Qty = 5
  - price = 1.00
  - tax rate = Compras exentas.
  Book the order.
- Enter another purchase order for Bebidas Alegres business partner. Select any product and enter below data:
  - Ordered Qty = 30
  - price = 1.00
  - tax rate = Compras exentas.
  Book the order.

- Go to Purchase Invoice window, and create a new one for Bebidas Alegres business partner. Use Create Lines From to select just created order lines. Change paymento method to "Remittance". Complete and Post the invoice. Take note of the due date = 17-04-2018.

- Go to Remittance window and create a new one for F&B España. Enter an expected date of 18-04-2018.
Click on "Select Orders or Invoices". Once in that new window, select "Payment Out" in the field "Transaction Type" and select the purchase invoice just created for an expected amount = 35.00. Press Process.

- Verify that two lines are shown. Click on Process.
- Post the document
- Verify Posting details shows only two lines

35.00 (40000) DEBIT
35.00 (43120) CREDIT
(0103346)
hgbot   
2018-03-19 12:53   
Repository: erp/mods/org.openbravo.module.remittance
Changeset: c13cad43cde57402071eb345f84971d73ed58381
Author: Atul Gaware <atul.gaware <at> openbravo.com>
Date: Mon Mar 19 14:17:15 2018 +0530
URL: http://code.openbravo.com/erp/mods/org.openbravo.module.remittance/rev/c13cad43cde57402071eb345f84971d73ed58381 [^]

Fixes issue 38143: NullPointerException when posting a remittance

NullPointerException when posting a remittance
that includes an invoice with more than two orders

Removing last element from the ArrayList is not feasible using
[index-1] as in the for loop index is incremented and removing
elements size of ArrayList is reduced. To avoid
java.lang.IndexOutOfBoundsException, store last element in
a variable.

---
M src/org/openbravo/module/remittance/ad_forms/DocREMRemittance.java
---
(0103347)
hgbot   
2018-03-19 12:53   
Repository: erp/mods/org.openbravo.module.remittance
Changeset: 97da9031eedad620398aaff67b5de5c2f15f3392
Author: Alvaro Ferraz <alvaro.ferraz <at> openbravo.com>
Date: Mon Mar 19 12:45:21 2018 +0100
URL: http://code.openbravo.com/erp/mods/org.openbravo.module.remittance/rev/97da9031eedad620398aaff67b5de5c2f15f3392 [^]

Related to issue 38143: Update module version

---
M src-db/database/sourcedata/AD_MODULE.xml
---
(0103348)
aferraz   
2018-03-19 13:02   
Code review + Testing OK