Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0041955Openbravo ERP07. Sales managementpublic2019-10-08 23:002019-12-12 23:01
lbressan 
markmm82 
urgentmajoralways
closedfixed 
5
3.0PR19Q2.2 
3.0PR20Q1 
Sandrahuguet
Core
No
0041955: discount value is being calculated incorrectly
When creating a purchase order line, the discount value is being calculated incorrectly, so the unit price is charged with a different value than the value found in the purchase price list.
Steps:
1. Create a new purchase price list
2. Add some product and set the next values: Unit Price=28.21 and List Price=29.92
3. Create a new purchase order
4. Add a new orderline and select the previosly used product. The discount value shown is incorrect and when you see the value of unit price, this is different from the unit price of the price list.

See attached video (tested also in version pi)
No tags attached.
? OB.mp4 (2,284,270) 2019-10-08 23:00
https://issues.openbravo.com/file_download.php?file_id=13355&type=bug
Issue History
2019-10-08 23:00lbressanNew Issue
2019-10-08 23:00lbressanAssigned To => Triage Finance
2019-10-08 23:00lbressanFile Added: OB.mp4
2019-10-08 23:00lbressanModules => Core
2019-10-08 23:00lbressanResolution time => 1571695200
2019-10-08 23:00lbressanTriggers an Emergency Pack => No
2019-10-09 08:02PracticsIssue Monitored: Practics
2019-10-09 08:17SandrahuguetAssigned ToTriage Finance => markmm82
2019-10-09 15:20markmm82Statusnew => scheduled
2019-10-11 03:27markmm82Note Added: 0115011
2019-10-11 03:27markmm82Note Edited: 0115011bug_revision_view_page.php?bugnote_id=0115011#r19469
2019-10-11 13:15hgbotCheckin
2019-10-11 13:15hgbotNote Added: 0115037
2019-10-11 13:15hgbotStatusscheduled => resolved
2019-10-11 13:15hgbotResolutionopen => fixed
2019-10-11 13:15hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/fc810b87d8a001217d9c3e0c7935a344bc7a05b1 [^]
2019-10-11 13:16SandrahuguetReview Assigned To => Sandrahuguet
2019-10-11 13:16SandrahuguetNote Added: 0115038
2019-10-11 13:16SandrahuguetStatusresolved => closed
2019-10-11 13:16SandrahuguetFixed in Version => 3.0PR20Q1
2019-10-11 13:29SandrahuguetSeveritycritical => major
2019-12-12 23:01hudsonbotCheckin
2019-12-12 23:01hudsonbotNote Added: 0116239

Notes
(0115011)
markmm82   
2019-10-11 03:27   
Test Plan:
1. Create a new purchase price list
2. Add some product and set the next values:
   Unit Price=28.21
   List Price=29.92
3. Create a new purchase order, select the created Price List
4. Add a new orderline and select the previously used product.
   Notice The discount value shown is correct = 5.72
   Notice the value of unit price and List Price are same than defined at Price List.

(0115037)
hgbot   
2019-10-11 13:15   
Repository: erp/devel/pi
Changeset: fc810b87d8a001217d9c3e0c7935a344bc7a05b1
Author: Mark Molina <mark.molina <at> doceleguas.com>
Date: Thu Oct 10 22:20:19 2019 -0300
URL: http://code.openbravo.com/erp/devel/pi/rev/fc810b87d8a001217d9c3e0c7935a344bc7a05b1 [^]

Fixes issue 41955: Calculate discount value homogeneously on different callouts

When creating a purchase order line, the discount value was calculated incorrectly,
so the unit price was charged with a different value than the value wich it was defined
in the purchase price list.

In the Purchase/Sales Order window, when the Product is selected, the prices are loaded
from the header's pricelist. When these prices are loaded the Discount field is calculated
and the field is updated with values returned by the SL_Order_Product callout.

Due to the Discount updation, the SL_Order_Amt callout is also called and it tries to recalculate
the prices again, but in this case it was doing the discount calculation in a different
way than the SL_Order_Product callout and the inverse operation makes an incorrect calculation
of the prices and discounts, and get differences because rounding.

To fix this issue, the discount calculation is made in the same way in all the evolved
callouts. In this case, the SL_Order_Amt callout was updated to get the discounts in the
same way than the SL_Order_Product callout.

---
M src/org/openbravo/erpCommon/ad_callouts/SL_Order_Amt.java
---
(0115038)
Sandrahuguet   
2019-10-11 13:16   
code review + testing ok
(0116239)
hudsonbot   
2019-12-12 23:01   
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/954d2b7a66fb [^]
Maturity status: Test