Openbravo Issue Tracking System - Openbravo ERP | |||||
View Issue Details | |||||
ID | Project | Category | View Status | Date Submitted | Last Update |
0046309 | Openbravo ERP | 09. Financial management | public | 2021-04-20 16:45 | 2021-04-21 11:59 |
Reporter | gsuarez | ||||
Assigned To | Triage Omni OMS | ||||
Priority | high | Severity | major | Reproducibility | always |
Status | closed | Resolution | no change required | ||
Platform | OS | 5 | OS Version | ||
Product Version | |||||
Target Version | Fixed in Version | ||||
Merge Request Status | |||||
Review Assigned To | vmromanos | ||||
OBNetwork customer | |||||
Web browser | |||||
Modules | Advanced Payables and Receivables Mngmt | ||||
Support ticket | |||||
Regression level | |||||
Regression date | |||||
Regression introduced in release | |||||
Regression introduced by commit | |||||
Triggers an Emergency Pack | No | ||||
Summary | 0046309: Error in getConversionRate function of FIN_Utility class that belongs to org.openbravo.advpaymentmngt module | ||||
Description | In a custom process we use this function to get the conversion rate between 2 differents currencies. Openbravo only has records of conversion rate at organization 0 (*), but this function returns null when the organization is 0. I copy the function: public static ConversionRate getConversionRate(Currency fromCurrency, Currency toCurrency, Date conversionDate, Organization org) { java.util.List<ConversionRate> conversionRateList; ConversionRate conversionRate; OBContext.setAdminMode(true); try { final OBCriteria<ConversionRate> obcConvRate = OBDal.getInstance() .createCriteria(ConversionRate.class); obcConvRate.setFilterOnReadableOrganization(false); obcConvRate.add(Restrictions.eq(ConversionRate.PROPERTY_ORGANIZATION, org)); obcConvRate.add(Restrictions.eq(ConversionRate.PROPERTY_CURRENCY, fromCurrency)); obcConvRate.add(Restrictions.eq(ConversionRate.PROPERTY_TOCURRENCY, toCurrency)); obcConvRate.add(Restrictions.le(ConversionRate.PROPERTY_VALIDFROMDATE, conversionDate)); long oneDay = 24 * 60 * 60 * 1000; obcConvRate.add(Restrictions.ge(ConversionRate.PROPERTY_VALIDTODATE, new Date(conversionDate.getTime() - oneDay))); conversionRateList = obcConvRate.list(); if ((conversionRateList != null) && (conversionRateList.size() != 0)) { conversionRate = conversionRateList.get(0); } else { if ("0".equals(org.getId())) { conversionRate = null; } else { return getConversionRate(fromCurrency, toCurrency, conversionDate, OBDal.getInstance() .get(Organization.class, OBContext.getOBContext() .getOrganizationStructureProvider() .getParentOrg(org.getId()))); } } } catch (Exception e) { log4j.error("Error getting conversion rate", e); return null; } finally { OBContext.restorePreviousMode(); } return conversionRate; } | ||||
Steps To Reproduce | In a custom process, try to get a conversion rate using this function. | ||||
Proposed Solution | |||||
Additional Information | |||||
Tags | No tags attached. | ||||
Relationships | |||||
Attached Files | |||||
Issue History | |||||
Date Modified | Username | Field | Change | ||
2021-04-20 16:45 | gsuarez | New Issue | |||
2021-04-20 16:45 | gsuarez | Assigned To | => Triage Finance | ||
2021-04-20 16:45 | gsuarez | Modules | => Advanced Payables and Receivables Mngmt | ||
2021-04-20 16:45 | gsuarez | Resolution time | => 1620684000 | ||
2021-04-20 16:45 | gsuarez | Triggers an Emergency Pack | => No | ||
2021-04-21 11:59 | vmromanos | Review Assigned To | => vmromanos | ||
2021-04-21 11:59 | vmromanos | Note Added: 0127412 | |||
2021-04-21 11:59 | vmromanos | Status | new => closed | ||
2021-04-21 11:59 | vmromanos | Resolution | open => no change required |
Notes | |||||
|
|||||
|
|