Anonymous | Login
Project:
RSS
  
News | My View | View Issues | Roadmap | Summary

View Issue DetailsJump to Notes ] Issue History ] Print ]
ID
0040157
TypeCategorySeverityReproducibilityDate SubmittedLast Update
defect[Modules] Remittancemajoralways2019-02-06 10:402019-02-18 13:36
ReporterngarciaView Statuspublic 
Assigned ToAtulOpenbravo 
PriorityimmediateResolutionfixedFixed in Version
StatusclosedFix in branchFixed in SCM revisione9fb2d8644ef
ProjectionnoneETAnoneTarget Version
OSAnyDatabaseAnyJava version
OS VersionDatabase versionAnt version
Product VersionSCM revision 
Regression date2019-07-24
Regression introduced by commithttps://code.openbravo.com/erp/devel/pi/rev/95dcfa93d706654e1fbddfc3966bec7280081ac1 [^]
Regression level
Review Assigned ToSandrahuguet
Regression introduced in release
Summary

0040157: Cannot reactivate a remittance: deleted object would be re-saved by cascade (remove deleted object from associations)

DescriptionCannot reactivate a remittance: deleted object would be re-saved by cascade (remove deleted object from associations): [REM_Instruction#...]

The problem is in the following piece of code of REM_RemittanceProcess class:

        // Remove instructions
        for (Instruction instr : remittance.getREMInstructionList()) {
          OBDal.getInstance().remove(instr);
        }
        remittance.setREMInstructionList(new ArrayList<Instruction>());
        OBDal.getInstance().save(remittance);
      }
      OBDal.getInstance().getSession().refresh(remittance);
      remittance.setProcessNow(false);
      OBDal.getInstance().save(remittance);
      OBDal.getInstance().flush();
Steps To ReproduceAs group admin role:
   Create a Sales Invoice, select Remittance payment method, add a line to it and complete it
   Create a Remittance header:
      Remittance Type: Printable Remittance
      Expected Date >= Sales Invoice - Payment Plan - Expected Date
      Select Orders or Invoices
      Select previously created invoice
   Process it
   Try to reactivate it and check the following error is shown:
      deleted object would be re-saved by cascade (remove deleted object from associations): [REM_Instruction#...]
TagsNo tags attached.
Attached Files

- Relationships Relation Graph ] Dependency Graph ]
related to design defect 0029947 acknowledgedplatform Openbravo ERP Wrong query launched when OBDal.getInstance.getSession.refresh(Object) 

-  Notes
(0109667)
AtulOpenbravo (developer)
2019-02-11 14:10

Apply remittance module dataset and add Remittance payment method in Financial account's payment method tab.

- Login As group admin role:
- Create a Sales Invoice, select Remittance payment method, add a line to it and complete it.
- Create a Remittance header:
      Remittance Type: Printable Remittance
      Expected Date >= Sales Invoice - Payment Plan - Expected Date
      Select Orders or Invoices
      Select previously created invoice
- Process it.
- Try to reactivate it and check the process is successful.
(0109679)
hgbot (developer)
2019-02-11 17:34

Repository: erp/mods/org.openbravo.module.remittance
Changeset: e9fb2d8644efe729acb88e5c318fcd1bef7718dd
Author: Atul Gaware <atul.gaware <at> openbravo.com>
Date: Mon Feb 11 18:37:12 2019 +0530
URL: http://code.openbravo.com/erp/mods/org.openbravo.module.remittance/rev/e9fb2d8644efe729acb88e5c318fcd1bef7718dd [^]

Fixes Issue 40157:Cannot reactivate a remittance: deleted object would be
re-saved by cascade (remove deleted object from associations)

** Avoid refreshing remittance using getSession() of OBDal instance.
** Clear instruction list from remittance.
** Avoid saving remittance.

---
M src/org/openbravo/module/remittance/process/REM_RemittanceProcess.java
---
(0109691)
AtulOpenbravo (developer)
2019-02-12 11:14
edited on: 2019-02-12 11:15

This issue was not reproducible until version 3.0PR18Q3.3 but was reproducible since version 3.0PR18Q4 in pi. Probably reason behind is the hibernate upgrade that has changed the behaviour in this case.

(0109692)
Sandrahuguet (developer)
2019-02-12 11:17

code review + testing ok
(0109903)
caristu (developer)
2019-02-18 13:36
edited on: 2019-02-18 13:38

This issue can be reproduced after the Hibernate upgrade because the behavior is different after invoking the OBDal.getInstance().getSession().refresh(bob) method:

- Hibernate 3.6 -> refresh also retrieves the first collection (see 0029947) from the database but it is NOT marked as initialized. This caused the "deleted object would be re-saved by cascade" check being skipped.

- Hibernate 5.3 -> the first collection is also being loaded (this problem remains) but it is marked as initialized. Therefore the "deleted object would be re-saved by cascade" check is performed and the error is correctly thrown.

Note that after the upgrade the process detects that a deleted object has been reloaded into the session. Before the upgrade, this was not being detected and the previously deleted objects of the collection was being re-saved because of the refresh call. So they were not being eventually deleted.


- Issue History
Date Modified Username Field Change
2019-02-06 10:40 ngarcia New Issue
2019-02-06 10:40 ngarcia Assigned To => Triage Finance
2019-02-06 10:40 ngarcia Issue Monitored: networkb
2019-02-06 10:42 Sandrahuguet Assigned To Triage Finance => AtulOpenbravo
2019-02-07 09:28 AtulOpenbravo Status new => scheduled
2019-02-11 11:23 caristu Relationship added related to 0029947
2019-02-11 14:10 AtulOpenbravo Note Added: 0109667
2019-02-11 17:34 hgbot Checkin
2019-02-11 17:34 hgbot Note Added: 0109679
2019-02-11 17:34 hgbot Status scheduled => resolved
2019-02-11 17:34 hgbot Resolution open => fixed
2019-02-11 17:34 hgbot Fixed in SCM revision => http://code.openbravo.com/erp/mods/org.openbravo.module.remittance/rev/e9fb2d8644efe729acb88e5c318fcd1bef7718dd [^]
2019-02-12 11:14 AtulOpenbravo Note Added: 0109691
2019-02-12 11:15 AtulOpenbravo Note Edited: 0109691 View Revisions
2019-02-12 11:17 Sandrahuguet Review Assigned To => Sandrahuguet
2019-02-12 11:17 Sandrahuguet Note Added: 0109692
2019-02-12 11:17 Sandrahuguet Status resolved => closed
2019-02-12 12:21 Sandrahuguet Regression date => 2019-07-24
2019-02-12 12:21 Sandrahuguet Regression introduced by commit => https://code.openbravo.com/erp/devel/pi/rev/95dcfa93d706654e1fbddfc3966bec7280081ac1 [^]
2019-02-18 13:36 caristu Note Added: 0109903
2019-02-18 13:37 caristu Note Edited: 0109903 View Revisions
2019-02-18 13:38 caristu Note Edited: 0109903 View Revisions


Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker