Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0042495Openbravo ERP09. Financial managementpublic2019-12-09 22:312019-12-26 15:16
matias-bernal 
AtulOpenbravo 
normalminoralways
scheduledopen 
5
pi 
 
Core
No
0042495: Can not unpost invoices when exists an leaf organization and it is not ready
When you created a new organization child of another legal with accounting and this new organization is not set ready, you can not unpost invoices because the field ad_periodcontrolallowed_org_id in ad_org table is null, and a null pointer exeption is thrown in deleted method of class org.openbravo.financial.ResetAccounting.
1) Create a new organization child of an organization legal with accounting, but not set ready this new organization. (see attachment 13396_00.png)

2) Create a new sales invoice using parent legal with accounting organization, comple and post them. (see attachment 13396_01.png)

3)Unpost this sales order using delete accounting entry check. (see attachment 13396_03.png)

Then this procces returns an error (see attachment 13396_04.png)
Check in method delete in class org.openbravo.financial.ResetAccounting when you get the child tree (new OrganizationStructureProvider().getChildTree(adOrgId, true)) organization exclude not ready organizations

Set<String> orgIds = StringUtils.equals(org.getOrganizationType().getId(), "0")
          ? getLegalOrBusinessOrgsChilds(client, adOrgId)
          : new OrganizationStructureProvider().getChildTree(adOrgId, true);

or exclude not ready organization or use a coalesce in query

            String myQuery1 = "select ad_org_id, ad_periodcontrolallowed_org_id from ad_org where ad_org_id in (:orgIds)";

when it's code try get ad_periodcontrolallowed_org_id value.
No tags attached.
Issue History
2019-12-09 22:31matias-bernalNew Issue
2019-12-09 22:31matias-bernalAssigned To => Triage Finance
2019-12-09 22:31matias-bernalModules => Core
2019-12-09 22:31matias-bernalResolution time => 1577674800
2019-12-09 22:31matias-bernalTriggers an Emergency Pack => No
2019-12-10 18:55dmiguelezAssigned ToTriage Finance => AtulOpenbravo
2019-12-17 09:34AtulOpenbravoStatusnew => scheduled
2019-12-17 09:34AtulOpenbravoNote Added: 0116369
2019-12-18 17:46dmiguelezResolution time1577674800 => 1577660400
2019-12-18 17:46dmiguelezSeveritymajor => minor
2019-12-26 15:16ngarciaResolution time1577660400 =>

Notes
(0116369)
AtulOpenbravo   
2019-12-17 09:34   
Test Plan
- Login as F&B International Group Admin role
- Using Initial Organization Setup, create a Test Org with type Generic and Parent as F&B US inc, do not include accounting file, do not select any reference data, do not select any accounting dimension
- Navigate to Organization window, do not set this organization as ready.
- Create a Sales invoice in F&B US Inc organization with Today's date as invoice and accounting date, select any business partner and select any product in line, set Quantity = 10.
- Complete and Post the Sales Invoice.
- Navigate to Reset Accounting process, select client F&B International Group, F&B US Inc as Organization, C_Invoice (Purchase Invoice - Sales Invoice) in the table, Starting Date = Today's date
- Click on Done, realize that process is completed successfully.