Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0045143Openbravo ERP09. Financial managementpublic2020-09-25 12:202020-10-07 12:06
inigo_lerga 
inigo_lerga 
normalmajoralways
closedfixed 
5
 
PR21Q1 
Advanced Payables and Receivables Mngmt
No
0045143: Outstanding Amount not updated when closing Sales Order in Oracle
When a Sales Order is booked and has a prepayment, when the order is closed, the outstanding amount in the Payment Plan is not updated with the negative received amount, which is wrong.
1. Register Sales Order with total amount 100
2. Run Add Details process to register prepayment of 100
3. Close the order. Payment plan info will not be properly updated.
In APRM_GEN_PAYMENTSCHEDULE_ORD.xml, the following query retreives no records due to the situation generated with the stepts to reproduce, which causes an Exception due to Oracle's interpretation of SELECT INTO statements.

--Get fin_payment_scheduledetail not related to payments nor invoices.
SELECT fin_payment_scheduledetail_id, amount
  INTO v_finpaymentscheduledetailid, v_psd_amt
FROM fin_payment_scheduledetail
WHERE fin_payment_schedule_order = v_finpaymentscheduleid
  AND fin_payment_schedule_invoice IS NULL
  AND fin_payment_detail_id IS NULL;

Proposed solution is to add a "try-catch" block around that query.
No tags attached.
related to design defect 0045081 closed Triage Omni OMS Credit details appear in Aging report although prepaid order is closed 
Issue History
2020-09-25 12:20inigo_lergaNew Issue
2020-09-25 12:20inigo_lergaAssigned To => inigo_lerga
2020-09-25 12:20inigo_lergaModules => Advanced Payables and Receivables Mngmt
2020-09-25 12:20inigo_lergaTriggers an Emergency Pack => No
2020-09-25 12:20inigo_lergaStatusnew => scheduled
2020-09-25 12:22inigo_lergaNote Added: 0123378
2020-09-25 12:26inigo_lergaRelationship addedrelated to 0045081
2020-09-25 13:01hgbotNote Added: 0123380
2020-10-07 12:06hgbotResolutionopen => fixed
2020-10-07 12:06hgbotStatusscheduled => closed
2020-10-07 12:06hgbotFixed in Version => PR21Q1
2020-10-07 12:06hgbotNote Added: 0123596
2020-10-07 12:06hgbotNote Added: 0123597

Notes
(0123378)
inigo_lerga   
2020-09-25 12:22   
--Test Plan Mantis--

As the F&B International Group Admin role in Backend:
1º- Go to Sales Order window and create a new record with
    'Restaurantes Luna Llena, S.A.' as Business Partner.
2º- Go to Lines Tab and create a new record with 'Cola 0,5L'
    Product and 100 units as Ordered Quantity.
3º- Book the Sales Order.
4º- Press the Add Payment button and verify '95.41' (Expected Payment)
    as Actual Payment.
5º- Close the Sales Order.

# Check in Payment Plan Tab that Outstanding amount is properly updated to
'-95.41' (Negative Received Payment) #
(0123380)
hgbot   
2020-09-25 13:01   
Merge Request created: https://gitlab.com/openbravo/product/openbravo/-/merge_requests/183 [^]
(0123596)
hgbot   
2020-10-07 12:06   
Directly closing issue as related merge request is already approved.

Repository: https://gitlab.com/openbravo/product/openbravo [^]
Changeset: 0d06423744d2eae704e527630c75392b8eca6f77
Author: inigo_lerga <inigo.lerga@openbravo.com>
Date: 2020-10-07T10:06:02+00:00
URL: https://gitlab.com/openbravo/product/openbravo/-/commit/0d06423744d2eae704e527630c75392b8eca6f77 [^]

fixes BUG-45143:Outstanding Amount properly updated

"try-catch" block added around query that raised exception
when no records were retreived.

---
M modules/org.openbravo.advpaymentmngt/src-db/database/model/functions/APRM_GEN_PAYMENTSCHEDULE_ORD.xml
---
(0123597)
hgbot   
2020-10-07 12:06   
Merge request merged: https://gitlab.com/openbravo/product/openbravo/-/merge_requests/183 [^]