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

View Issue DetailsJump to Notes ] Issue History ] Print ]
ID
0035773
TypeCategorySeverityReproducibilityDate SubmittedLast Update
feature request[Openbravo ERP] 09. Financial managementtrivialhave not tried2017-04-12 14:062017-04-12 14:07
ReportervmromanosView Statuspublic 
Assigned ToTriage Omni OMS 
PrioritynormalResolutionopenFixed in Version
StatusnewFix in branchFixed in SCM revision
ProjectionnoneETAnoneTarget Version
OSAnyDatabaseAnyJava version
OS VersionDatabase versionAnt version
Product VersionSCM revision 
Review Assigned To
Web browser
ModulesCore
Regression level
Regression date
Regression introduced in release
Regression introduced by commit
Triggers an Emergency PackNo
Summary

0035773: Several improvements in FinancialUtils class

DescriptionThe Taxes Calculation at document level project (0032265) slightly changed the way taxes are calculated to avoid rounding precision issues.
Right now the line net amount is calculated from the line gross amount instead of getting the line net price from the line gross amount and then line net amount from line net price.

The FinancialUtils.calculateNetFromGross() method was deprecated and a new calculateNetAmtFromGross() was created as part of the project.

These two methods are not equivalent, because the first one returns a Price, and the second one returns an Amount, so that usually means that, if you want to get the Price after the refactor, you need to manually divide the Amount by the Quantity (Price = Amount/Quantity).

This could create a misunderstanding when refactoring affected code.
Steps To ReproduceNA
Proposed SolutionThese are the proposed changes:

1. The Javadoc for FinancialUtils.calculateNetAmtFromGross() method must say "Calculates the net amount using the C_GET_NET_AMOUNT_FROM_GROSS stored procedure" (amount, not unit price).

2. A new method called calculateNetUnitPriceFromGross() must be developed that will be in charge of returning the net unit price. It will receive the same parameters as calculateNetAmtFromGross() and the quantity and price precission.
It will call the calculateNetAmtFromGross() and divide the amount by the quantity rounding to the price precision (control divide by 0 scenario).

3. The deprecated info at calculateNetFromGross() method will point to the new method calculateNetUnitPriceFromGross()

4. We will replace the calls to calculateNetAmtFromGross() by the new method calculateNetUnitPriceFromGross() in the places where we are interested in getting the price only.

Example of a candidate to change:
        BigDecimal netAmount = FinancialUtils.calculateNetAmtFromGross(strTaxId, grossAmount,
            StdPrecision, taxBaseAmt);
        priceActual = BigDecimal.ZERO;
        if (qtyInvoice.compareTo(BigDecimal.ZERO) != 0) {
          priceActual = netAmount.divide(qtyInvoice, PricePrecision, RoundingMode.HALF_UP);
        }
TagsNo tags attached.
Attached Files

- Relationships Relation Graph ] Dependency Graph ]
related to defect 0035428 closedaferraz Do not calculate Net Price and Net Amount outside triggers when creating new Order/Invoice with Price Including Taxes 
related to design defect 0032265 closedaferraz [SER QA 1434] Taxes at document level are not properly calculated in some cases 

-  Notes
There are no notes attached to this issue.

- Issue History
Date Modified Username Field Change
2017-04-12 14:06 vmromanos New Issue
2017-04-12 14:06 vmromanos Assigned To => Triage Finance
2017-04-12 14:06 vmromanos Modules => Core
2017-04-12 14:06 vmromanos Triggers an Emergency Pack => No
2017-04-12 14:07 vmromanos Relationship added related to 0035428
2017-04-12 14:07 vmromanos Relationship added related to 0032265


Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker