Openbravo Issue Tracking System - Retail Modules
View Issue Details
0041659Retail ModulesGift cards and gift voucherspublic2019-08-16 12:102019-11-06 07:26
kchoperena 
ranjith_qualiantech_com 
normalmajoralways
closedfixed 
5
 
RR20Q1 
marvintm
No
0041659: OBSecurtyException when reimburse a credit note created in a different organization
OBSecurtyException error when trying to reimburse a credit note in a different organization than the created one.

org.openbravo.base.exception.OBSecurityException: Entity SPRR1000036 - 16-08-2019 - TEST REIMBURSE99 - 5.0 (FIN_Payment) with organization Yosemite Store references an entity Demo User - 16-08-2019 10:03:03 - PS POS Terminal through its property FIN_Payment.obposAppCashup but this referenced entity belongs to an organization Posets Store which is not part of the natural tree of Yosemite Store
    at org.openbravo.dal.core.OBInterceptor.checkReferencedOrganizations(OBInterceptor.java:316)
    at org.openbravo.dal.core.OBInterceptor.onFlushDirty(OBInterceptor.java:189)
    at org.hibernate.event.internal.DefaultFlushEntityEventListener.invokeInterceptor(DefaultFlushEntityEventListener.java:355)
    at org.hibernate.event.internal.DefaultFlushEntityEventListener.handleInterception(DefaultFlushEntityEventListener.java:332)
    at org.hibernate.event.internal.DefaultFlushEntityEventListener.scheduleUpdate(DefaultFlushEntityEventListener.java:283)
    at org.hibernate.event.internal.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:154)
    at org.hibernate.event.internal.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:235)
    at org.hibernate.event.internal.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:94)
    at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:38)
    at org.hibernate.internal.SessionImpl.doFlush(SessionImpl.java:1484)
    at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1470)
    at org.openbravo.dal.service.OBDal.flush(OBDal.java:265)
    at org.openbravo.retail.giftcards.process.GiftCardGLItemUtils.makePayment(GiftCardGLItemUtils.java:300)
    at org.openbravo.retail.giftcards.hooks.ProcessCashMgmtHookGiftCard.exec(ProcessCashMgmtHookGiftCard.java:66)
    at org.openbravo.retail.giftcards.hooks.ProcessCashMgmtHookGiftCard$Proxy$_$$_WeldClientProxy.exec(Unknown Source)
    at org.openbravo.retail.posterminal.ProcessCashMgmt.executeHooks(ProcessCashMgmt.java:303)
    at org.openbravo.retail.posterminal.ProcessCashMgmt.saveRecord(ProcessCashMgmt.java:283)
1.- Log into the Web POS YS-11
2.- Create a customer
3.- In the menu, click on 'Return Receipt'
4.- Add a product
5.- Complete the order using the Credit Note payment method to generate a new credit note
6.- Log into the Web POS PS-1
7.- In the menu, click on 'Gift / Credit Notes'
8.- Reimburse previously created Credit Note

EXPECTED RESULTS:
In the Web POS the reimbursement process seems to be completed successfully but in the openbravo.log there is an exception. Also, in the 'Errors While Importing POS Data' window there is an error
VIDEO: https://drive.google.com/file/d/1ll5EJEXaUcI_sXeSd4vKqocvl0gvvLGF/view?usp=sharing [^]


The base problem is that the reimburse payment is generated in the organization where the credit note was created, which is wrong.
This happens in the following line:
https://code.openbravo.com/erp/pmods/org.openbravo.retail.giftcards/file/tip/src/org/openbravo/retail/giftcards/hooks/ProcessCashMgmtHookGiftCard.java#l66 [^]

All payments generated during the reimburse process should be linked to the organization where the reimburse is happening.

Additional note: The documentNo of both generated payments should be generated from the sequence defined for the current organizaton. Right now the sequences are generated using the sequence of the original org [1][2]

[1] https://code.openbravo.com/erp/pmods/org.openbravo.retail.giftcards/file/tip/src/org/openbravo/retail/giftcards/process/GiftCardGLItemUtils.java#l261 [^]

[2] https://code.openbravo.com/erp/pmods/org.openbravo.retail.giftcards/file/tip/src/org/openbravo/retail/giftcards/process/GiftCardGLItemUtils.java#l330 [^]
No tags attached.
related to defect 0041052 closed Retail System Problem when incrementing a Credit Note in a different store 
Issue History
2019-08-16 12:10kchoperenaNew Issue
2019-08-16 12:10kchoperenaAssigned To => Retail
2019-08-16 12:10kchoperenaResolution time => 1567116000
2019-08-16 12:10kchoperenaTriggers an Emergency Pack => No
2019-08-16 12:34ranjith_qualiantech_comAssigned ToRetail => ranjith_qualiantech_com
2019-08-16 12:34ranjith_qualiantech_comStatusnew => scheduled
2019-09-02 15:02ranjith_qualiantech_comNote Added: 0114360
2019-09-11 17:57aaroncaleroRelationship addedrelated to 0041052
2019-09-18 18:10marvintmResolution time1567116000 => 1569880800
2019-10-09 12:38aaroncaleroProposed Solution updated
2019-10-09 13:13aaroncaleroProposed Solution updated
2019-10-24 08:03hgbotCheckin
2019-10-24 08:03hgbotNote Added: 0115257
2019-10-24 12:23hgbotCheckin
2019-10-24 12:23hgbotNote Added: 0115264
2019-10-24 12:23ranjith_qualiantech_comStatusscheduled => resolved
2019-10-24 12:23ranjith_qualiantech_comResolutionopen => fixed
2019-10-25 09:44marvintmReview Assigned To => marvintm
2019-10-25 09:44marvintmStatusresolved => closed
2019-10-25 09:44marvintmFixed in Version => RR20Q1
2019-11-06 07:26hgbotCheckin
2019-11-06 07:26hgbotNote Added: 0115419
2019-11-06 07:50ranjith_qualiantech_comNote Deleted: 0115419

Notes
(0114360)
ranjith_qualiantech_com   
2019-09-02 15:02   
TestAnnotations waitFixOf should be removed for the Test I40960_VerifyCreditNoteReimburseInCrossStore, Once its resolved
(0115257)
hgbot   
2019-10-24 08:03   
Repository: erp/pmods/org.openbravo.retail.giftcards
Changeset: 8e3cafdcf9de6854339b3c1188e36334413724da
Author: Ranjith S R <ranjith <at> qualiantech.com>
Date: Thu Oct 24 11:33:22 2019 +0530
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.giftcards/rev/8e3cafdcf9de6854339b3c1188e36334413724da [^]

Related to issue 41659 : CreditNote payment should be created under User Organization

* When Reimbursing/Cancelling Credit Note and Gift Certificate,
  Payment should be created with Processing organization

---
M src/org/openbravo/retail/giftcards/GiftCardModel.java
M src/org/openbravo/retail/giftcards/hooks/ProcessCashMgmtHookGiftCard.java
M src/org/openbravo/retail/giftcards/process/GiftCardGLItemUtils.java
---
(0115264)
hgbot   
2019-10-24 12:23   
Repository: tools/automation/pi-mobile
Changeset: a0707d106c70dcb0055465e1b050cd78c3f5e18b
Author: Ranjith S R <ranjith <at> qualiantech.com>
Date: Thu Oct 24 15:53:17 2019 +0530
URL: http://code.openbravo.com/tools/automation/pi-mobile/rev/a0707d106c70dcb0055465e1b050cd78c3f5e18b [^]

Verifies issue 41659 : Enabled I40960_VerifyCreditNoteReimburseInCrossStore Test

---
M src-test/org/openbravo/test/mobile/retail/extmodules/selenium/tests/creditnote/I40960_VerifyCreditNoteReimburseInCrossStore.java
---