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

View Issue DetailsJump to Notes ] Issue History ] Print ]
ID
0007323
TypeCategorySeverityReproducibilityDate SubmittedLast Update
defect[Openbravo ERP] 07. Sales managementminoralways2009-02-02 18:192009-03-25 10:28
ReporterrafarodaView Statuspublic 
Assigned Torafaroda 
PriorityhighResolutionno change requiredFixed in Version
StatusclosedFix in branchFixed in SCM revision
ProjectionnoneETAnoneTarget Version
OSLinux 32 bitDatabasePostgreSQLJava version1.5
OS VersionUbuntu 7.10Database version8.3Ant version1.7
Product Version2.35SCM revision 
Review Assigned To
Web browser
ModulesCore
Regression level
Regression date
Regression introduced in release
Regression introduced by commit
Triggers an Emergency PackNo
Summary

0007323: Discount is not correctly calculated when Price Adjustments are applied

DescriptionDiscount field inside in the lines of Sales or Purchase Orders is not correctly calculated when Price Adjustments are applied.
Steps To Reproduce1) Create a price adjustment in 'Master Data Management || Pricing || Price Adjustments || Adjustments' with values:
* Starting date = 01-01-2000
* Discount % = 50
* Min Quantity = 499
* Business Partner = All Selected
* Product = All Selected
2) Move to Business Partner tab and select one business partner
3) Move to Product tab and select one product
4) Create a new Sales or Purchase Order for the business partner of the price adjustment
5) Create one line for the product of the price adjustment.

Notice that the Discount field is correctly calculated as:
* Unit Price = UP
* List Price = LP
* Discount = D = 100*(1-(UP/LP))

6) Save this line
7) Change quantity to 500. Unit Price should have half amount

But notice that the Discount remains the same.

8) Change Unit Price to the same value that the List Price.

Discount should be 0 but is calculated as -100.
Proposed SolutionReview https://dev.openbravo.com/websvn/openbravo/trunk/src/org/openbravo/erpCommon/ad_callouts/SL_Order_Product.java [^] specially the lines where it says:

BigDecimal discount = new BigDecimal(0.0);
    if (priceList.compareTo(discount) != 0) {
      discount = (((priceList.subtract(priceStd)).divide(priceList, 12, BigDecimal.ROUND_HALF_EVEN))
          .multiply(new BigDecimal("100"))).setScale(2, BigDecimal.ROUND_HALF_UP);
    }

Should the discount be calculated using the unit price instead of the price std?
TagsNo tags attached.
Attached Files

- Relationships Relation Graph ] Dependency Graph ]
related to defect 00070982.40 closedrafaroda Unit price set to zero when you change quantity in lines created with Copy Lines button 

-  Notes
(0013111)
galderromo (reporter)
2009-02-03 21:34

In my opinion this is not a bug.
It is different a price adjustment from a discount.
Think you are the person who introduce the information on the application. And you have your customer on the phone. The customer wants 525 units of your product, and you comunicate there is a 50% off adjustment. The customer, does not agree with the adjustment because is a very special customer, and this adjustment applies to every customer. Is asking you for an extra personal discount, so you decide to give a extra 10% (you include it on discount field). So Unitprice, supposing price list is 100 Euros will be 100 - 50 - 5 = 45 Euros. This is why I think the behaviour is ok. Therefore is not a bug.
(0013789)
pjuvara (reporter)
2009-02-20 09:16

Reminder sent to: psarobe, rafaroda

Rafa, Pablo,

can you please review this defect and decide whether it is a defect or not?
Please consider Galder's comment and his explanation of why this is not a defect.

Thanks,

Paolo
(0014932)
rafaroda (developer)
2009-03-25 10:28

This is not a bug but the correct behavior of price adjustments:
* Discount is calculated as (List Price - Standard Price)/List Price: CORRECT
* When changing Unit Price, Standard Price is re-calculated: CORRECT

For a better understanding of price adjustments have a look at documentation issue 0008275

For an improvement of price adjustments have a look at feature request 0008161

- Issue History
Date Modified Username Field Change
2009-02-02 18:19 rafaroda New Issue
2009-02-02 18:19 rafaroda Assigned To => galderromo
2009-02-02 18:19 rafaroda sf_bug_id 0 => 2557615
2009-02-02 18:19 rafaroda Regression testing => No
2009-02-02 19:01 galderromo Issue Monitored: galderromo
2009-02-03 21:34 galderromo Note Added: 0013111
2009-02-03 21:35 galderromo Assigned To galderromo => rafaroda
2009-02-10 10:51 psarobe Status new => feedback
2009-02-19 14:16 rafaroda Severity major => minor
2009-02-20 09:16 pjuvara Issue Monitored: psarobe
2009-02-20 09:16 pjuvara Note Added: 0013789
2009-02-23 13:07 rafaroda Relationship added related to 0007098
2009-03-25 10:28 rafaroda Status feedback => closed
2009-03-25 10:28 rafaroda Note Added: 0014932
2009-03-25 10:28 rafaroda Resolution open => no change required


Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker