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

View Issue DetailsJump to Notes ] Issue History ] Print ]
ID
0033975
TypeCategorySeverityReproducibilityDate SubmittedLast Update
defect[Openbravo ERP] 02. Master data managementmajoralways2016-09-13 13:222016-09-29 00:02
ReporterngarciaView Statuspublic 
Assigned Tomarkmm82 
PriorityurgentResolutionfixedFixed in Version3.0PR16Q4
StatusclosedFix in branchFixed in SCM revisione94a1240a358
ProjectionnoneETAnoneTarget Version
OSAnyDatabaseAnyJava version
OS VersionDatabase versionAnt version
Product VersionSCM revision 
Review Assigned Toaferraz
Web browser
ModulesCore
Regression level
Regression date
Regression introduced in release
Regression introduced by commit
Triggers an Emergency PackNo
Summary

0033975: Wrong Net Unit Price and pricestd in order and invoice lines when applying a discount of a percentage with decimals

DescriptionWrong Net Unit Price and pricestd in order and invoice lines when applying a discount of a percentage with decimals
Steps To ReproduceAs group admin role:
   Set the Price Precision of the Currency to 2
   Create a new product
   Add a price of 34.27 to it
   Create a Price Adjustment for that product (Discount and Promotions):
      Discount %: 64.3
      Discount Amount: 0.00
   Create a Sales Order
   Add the previously created product and check the Net Unit Price is updated to 12.34
   Book it and check the Net Unit Price is updated to 12.24
   The correct value should be 12.23
   Repeat the process for sales invoices and also in purchase flow
Proposed SolutionThe problem seems to be in calculatePriceActual and calculatePriceStd functions of PriceAdjustment class as the discount percentage is rounded to the price precision after dividing it by 100. Example:

64.3 / 100 = 0.643 -> 0.64

.divide(BigDecimal.valueOf(100), precision, BigDecimal.ROUND_HALF_UP)
TagsNo tags attached.
Attached Files

- Relationships Relation Graph ] Dependency Graph ]
related to defect 0032544 closedshivum039 Retail Modules automatic discounts are applied in backoffice purchase flow 
related to defect 0034103 closedmarkmm82 Openbravo ERP Incorrect prices are calculated in Purchase Orders/Invoices when exists discounts or promotions related to products. 

-  Notes
(0090306)
markmm82 (developer)
2016-09-27 17:22

Test Plan 1:
As group admin role:
   Set the Price Precision of the Currency EUR to 2 if necessary
   Create a new product
      Search key/ Name: Test
   Add two prices of 34.27 to it. For instance for Tarifa Bebidas Alegres and Tarifa de Ventas price lists versions.
   Create a Price Adjustment for that product. Go to Discount and Promotions and add a new record:
      Discount %: 64.3
      Discount Amount: 0.00
      Included Products: Only those defined
   Add the new product in tab Products
   Create a Sales Order header for Alimentos y Supermercados, S.A bp.
   Create a line to the sales order:
     Add the previously created product (Test) and check the Net Unit Price is updated to 12.23.
   Set tax to Ventas exentas, to not apply taxes.
   Remove discounts from Basic Discounts if exists.
   Book it and check the following information is updated in Sales order header and line:
     Sales Order Line:
        Net Unit Price is updated to 12.23
     Sales Order Header:
    Total Gross Amount: 12.23
    Total Net Amount: 12.23
     It is correct, there are not taxes or discounts except applied to the price with the Price adjustment previously created to the product.

Test Plan 2:
As group admin role:
   Set the Price Precision of the Currency EUR to 2 if necessary
   Create a new product
      Search key/ Name: Test-II
   Add two prices of 34.27 to it. For instance for Tarifa Bebidas Alegres and Tarifa de Ventas price lists versions.
   Create a Price Adjustment for that product. Go to Discount and Promotions and add a new record:
      Discount %: 64.3
      Discount Amount: 0.00
      Included Products: Only those defined
   Add the new product in tab Products
   Create a Sales Invoice header for Alimentos y Supermercados, S.A bp.
   Create a line to the invoice:
     Add the previously created product (Test-II) and check the Net Unit Price is updated to 12.23.
   Set tax to Ventas exentas, to not apply taxes.
   Remove discounts from Basic Discounts if exists.
   Complete it and check the following information is updated in header and line:
     Sales Invoice Line:
        Net Unit Price is updated to 12.23
     Sales Invoice Header:
    Total Gross Amount: 12.23
    Total Net Amount: 12.23
     It is correct, there are not taxes or discounts except applied to the price with the Price adjustment previously created for the product.
(0090330)
hgbot (developer)
2016-09-28 09:53

Repository: erp/devel/pi
Changeset: e94a1240a35856cbe1cafacda5447ed54fef70fc
Author: Mark <markmm82 <at> gmail.com>
Date: Fri Sep 23 15:37:24 2016 -0400
URL: http://code.openbravo.com/erp/devel/pi/rev/e94a1240a35856cbe1cafacda5447ed54fef70fc [^]

Fixes issue 33975: Fixed Prices in sales order and invoice lines if discounts

Modified the calculatePriceActual and calculatePriceStd methods of PriceAdjustment class to rounds correctly the price precision when discount percentage is applied.

---
M src/org/openbravo/erpCommon/businessUtility/PriceAdjustment.java
---
(0090333)
aferraz (manager)
2016-09-28 10:02

Code review + Testing OK
(0090361)
hudsonbot (developer)
2016-09-29 00:02

A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/2cd54ee6264a [^]
Maturity status: Test

- Issue History
Date Modified Username Field Change
2016-09-13 13:22 ngarcia New Issue
2016-09-13 13:22 ngarcia Assigned To => Triage Finance
2016-09-13 13:22 ngarcia Modules => Core
2016-09-13 13:22 ngarcia Resolution time => 1475532000
2016-09-13 13:22 ngarcia Triggers an Emergency Pack => No
2016-09-13 13:22 ngarcia Issue Monitored: networkb
2016-09-15 11:16 aferraz Assigned To Triage Finance => markmm82
2016-09-20 17:27 markmm82 Status new => scheduled
2016-09-26 13:17 aferraz Relationship added related to 0032544
2016-09-27 17:22 markmm82 Note Added: 0090306
2016-09-27 17:37 markmm82 Relationship added related to 0034103
2016-09-28 09:53 hgbot Checkin
2016-09-28 09:53 hgbot Note Added: 0090330
2016-09-28 09:53 hgbot Status scheduled => resolved
2016-09-28 09:53 hgbot Resolution open => fixed
2016-09-28 09:53 hgbot Fixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/e94a1240a35856cbe1cafacda5447ed54fef70fc [^]
2016-09-28 10:02 aferraz Review Assigned To => aferraz
2016-09-28 10:02 aferraz Note Added: 0090333
2016-09-28 10:02 aferraz Status resolved => closed
2016-09-28 10:02 aferraz Fixed in Version => 3.0PR16Q4
2016-09-29 00:02 hudsonbot Checkin
2016-09-29 00:02 hudsonbot Note Added: 0090361


Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker