Openbravo Issue Tracking System - Localization Pack: Spain | |||||||||||||
| View Issue Details | |||||||||||||
| ID | Project | Category | View Status | Date Submitted | Last Update | ||||||||
| 0045428 | Localization Pack: Spain | SII | public | 2020-11-11 18:02 | 2020-12-16 11:15 | ||||||||
| Reporter | shuehner | ||||||||||||
| Assigned To | Mery Anelo | ||||||||||||
| Priority | normal | Severity | major | Reproducibility | have not tried | ||||||||
| Status | closed | Resolution | fixed | ||||||||||
| Platform | OS | 5 | OS Version | ||||||||||
| Product Version | |||||||||||||
| Target Version | Fixed in Version | ||||||||||||
| Merge Request Status | approved | ||||||||||||
| Regression date | |||||||||||||
| Regression introduced by commit | |||||||||||||
| Regression level | |||||||||||||
| Review Assigned To | |||||||||||||
| Support ticket | |||||||||||||
| OBNetwork customer | No | ||||||||||||
| Regression introduced in release | |||||||||||||
| Summary | 0045428: FacturasEventHandler -> SIIUtils.getLegalOrganization has setAdminMode but never calls restorePreviousMode | ||||||||||||
| Description | Found via many Junit tests from backoffice failing with Test case should take care of reseting admin mode correctly in a finally block, use OBContext.restorePreviousMode when having org.openbravo.module.sii template installed. For example org.openbravo.test.costing.TestCostingSourceAdjustments.testCostingAAA (around 60-70 in total) Debugging this points to SIIUtils.getLegalOrganization utility Function called via FacturasEventHandler at org.openbravo.dal.core.OBContext.addStackTrace(OBContext.java:362) at org.openbravo.dal.core.OBContext.setAdminMode(OBContext.java:223) at org.openbravo.module.sii.utils.SIIUtils.getLegalOrganization(SIIUtils.java:308) at org.openbravo.module.sii.eventhandlers.FacturasEventHandler.checkInvoice(FacturasEventHandler.java:116) at org.openbravo.module.sii.eventhandlers.FacturasEventHandler.onUpdate(FacturasEventHandler.java:68) Reviewing that function shows it uses setAdminMode but does never restorePreviousMode violating calling convention to always use those in pairs (typically with a finally block) | ||||||||||||
| Steps To Reproduce | Found in specific customer instance but probably following is enough: a.) Backoffice environment (testing in release/20Q4 branch) b.) Add sii module c.) run junit tests. c.1) For example the following tests showcases the problem: org.openbravo.test.createlinesfrom.CreateLinesFromTest | ||||||||||||
| Proposed Solution | Review code and fix calling convention for adminMode by using the typical recommended pattern. OBContext.setAdminMode(bool) try { <code running with adminMode> } finally { OBContext.restorePreviousMode(); } | ||||||||||||
| Additional Information | |||||||||||||
| Tags | No tags attached. | ||||||||||||
| Relationships |
| ||||||||||||
| Attached Files | https://issues.openbravo.com/file_download.php?file_id=15082&type=bug | ||||||||||||
| Issue History | |||||||||||||
| Date Modified | Username | Field | Change | ||||||||||
| 2020-11-11 18:02 | shuehner | New Issue | |||||||||||
| 2020-11-11 18:02 | shuehner | Assigned To | => Jorge Bravo | ||||||||||
| 2020-11-11 18:02 | shuehner | OBNetwork customer | => No | ||||||||||
| 2020-11-11 18:03 | shuehner | Note Added: 0124284 | |||||||||||
| 2020-11-11 18:27 | shuehner | Relationship added | related to 0045429 | ||||||||||
| 2020-11-11 18:47 | shuehner | File Added: 45428.diff | |||||||||||
| 2020-11-11 18:48 | shuehner | Note Added: 0124285 | |||||||||||
| 2020-11-12 08:17 | Jorge Bravo | Assigned To | Jorge Bravo => Mery Anelo | ||||||||||
| 2020-11-24 23:56 | Mery Anelo | Note Added: 0124602 | |||||||||||
| 2020-11-24 23:57 | hgbot | Merge Request Status | => open | ||||||||||
| 2020-11-24 23:57 | hgbot | Note Added: 0124603 | |||||||||||
| 2020-11-25 00:01 | Mery Anelo | Status | new => scheduled | ||||||||||
| 2020-12-16 11:15 | hgbot | Merge Request Status | open => approved | ||||||||||
| 2020-12-16 11:15 | hgbot | Resolution | open => fixed | ||||||||||
| 2020-12-16 11:15 | hgbot | Status | scheduled => closed | ||||||||||
| 2020-12-16 11:15 | hgbot | Note Added: 0124877 | |||||||||||
| 2020-12-16 11:15 | hgbot | Note Added: 0124878 | |||||||||||
| 2020-12-16 11:15 | hgbot | Note Added: 0124879 | |||||||||||
| Notes | |||||
|
|
|||||
|
|
||||
|
|
|||||
|
|
||||
|
|
|||||
|
|
||||
|
|
|||||
|
|
||||
|
|
|||||
|
|
||||
|
|
|||||
|
|
||||
|
|
|||||
|
|
||||