Openbravo Issue Tracking System - POS2
View Issue Details
0049286POS2POSpublic2022-05-10 18:062022-05-20 08:56
jmelin 
Retail 
urgentcriticalalways
closedfixed 
5
 
 
No
0049286: JIRA 2974 - Credit note - Can't import an order with credit note payment
When “Use credit note once” is checked in BO then the following error when importing the order where the credit note is used:

java.lang.Exception: GCNV_ErrorGiftCardClosed:XXXD/XXXXX
org.openbravo.retail.giftcards.GiftCardModel.consumeAmountGiftCard(GiftCardModel.java:283)at org.openbravo.retail.giftcards.GiftCardModel.populateGiftCardTransaction(GiftCardModel.java:503)
This is not reproducible on build env only customer env

Create an order and do an overpayment using "Ticket CRT"
Note the credit note id
Create a new order and pay using the credit note (complete with other payment method if necessary)

=> KO, in BO, the order is not loaded because of the error
java.lang.Exception: GCNV_ErrorGiftCardClosed:XXXD/XXXXX


Note:
If you unchecked the filed "Use credit note once" for the org, then you can import the order
The credit note closing logic was in a separate order loader hook (OrderLoaderHookCreditNote). There is another orderloader: OrderLoaderHookGiftcard, which consumes the giftcard. If this OrderLoaderHookGiftcard was executed after the OrderLoaderHookCreditNote then an error is thrown.

The solution is to move the code of the OrderLoaderHookCreditNote inside the OrderLoaderHookGiftcard to control the order of execution.
No tags attached.
Issue History
2022-05-10 18:06jmelinNew Issue
2022-05-10 18:06jmelinAssigned To => Retail
2022-05-10 18:06jmelinTriggers an Emergency Pack => No
2022-05-19 16:06hgbotNote Added: 0137543
2022-05-19 17:01mtaalNote Added: 0137546
2022-05-19 17:01mtaalStatusnew => scheduled
2022-05-19 17:01mtaalStatusscheduled => resolved
2022-05-19 17:01mtaalResolutionopen => fixed
2022-05-19 20:35hgbotStatusresolved => closed
2022-05-19 20:35hgbotNote Added: 0137547
2022-05-19 20:35hgbotNote Added: 0137548
2022-05-20 08:56mtaalProposed Solution updated

Notes
(0137543)
hgbot   
2022-05-19 16:06   
Merge Request created: https://gitlab.com/openbravo/product/pmods/org.openbravo.retail.giftcards/-/merge_requests/119 [^]
(0137546)
mtaal   
2022-05-19 17:01   
For information on the test and setup see the MR
(0137547)
hgbot   
2022-05-19 20:35   
Directly closing issue as related merge request is already approved.

Repository: https://gitlab.com/openbravo/product/pmods/org.openbravo.retail.giftcards [^]
Changeset: 1665d4ba5293491daa23accb9f4d74020037f11e
Author: Martin Taal <martin.taal@openbravo.com>
Date: 19-05-2022 16:03:44
URL: https://gitlab.com/openbravo/product/pmods/org.openbravo.retail.giftcards/-/commit/1665d4ba5293491daa23accb9f4d74020037f11e [^]

Fixes ISSUE-49286: credit note should be closed after consuming the amount and not before

---
M src/org/openbravo/retail/giftcards/hooks/OrderLoaderHookGiftCard.java
R src/org/openbravo/retail/giftcards/hooks/OrderLoaderHookCreditNote.java
---
(0137548)
hgbot   
2022-05-19 20:35   
Merge request merged: https://gitlab.com/openbravo/product/pmods/org.openbravo.retail.giftcards/-/merge_requests/119 [^]