Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0034104Openbravo ERP02. Master data managementpublic2016-09-27 17:302016-09-28 11:49
markmm82 
markmm82 
urgentmajoralways
closedfixed 
5
 
3.0PR16Q3.23.0PR16Q3.2 
aferraz
Core
Production - QA Approved
2016-04-15
3.0PR16Q3
https://code.openbravo.com/erp/devel/pi/rev/168db990cb85 [^]
No
0034104: Incorrect prices are calculated in Purchase Orders/Invoices when exists discounts or promotions related to products.
When a Promotion or Discount is created for an specific product, and it is added to a purchase order/invoice prices for the product should not be recalculated as discounts and promotions not applies to Purchases, it applies only for the Sales flows. At moment of product selection, discounts are applied and when the purchase order/invoice is processed it is ignored. As it will be not applied, should be avoided recalculation of prices at product selection time.
As group admin role:
   1. Set the Price Precision of the Currency EUR to 2 if necessary
   2. Create a new product
      Search key/ Name: Test
   3. Add two prices of 34.27 to it. For instance for Tarifa Bebidas Alegres and Tarifa de Ventas price lists versions.
   4. 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
   5. Add the new product in tab Products
   6. Create a Purchase Order header for Bebidas Alegres, S.L bp.
   7. Create a line to the purchase order:
     Add the previously created product (Test) and check the Net Unit Price is updated to 12.34. IT IS NOT CORRECT
   8. Set tax to Compras exentas, to not apply taxes.
   9. Remove discounts from Basic Discounts if exists.
   10. Book the order and check the following information is updated in header and line:
     Purchase Order Line:
        Net Unit Price is updated to 12.24
     Purchase Order Header:
    Total Gross Amount: 12.24
    Total Net Amount: 12.24
     
     IT IS NOT CORRECT because Discounts and Promotions only work for Sales flow and can not be applied.
     In step 7, the price should not be updated because discounts are not applicable to purchases.
     So, when the order is processed the correct values should be:
     Purchase Order Line:
        Net Unit Price is updated to 34.27
     Purchase Order Header:
    Total Gross Amount: 34.27
    Total Net Amount: 34.27

Verify, this issue is also reproducible to Purchases Invoices.
No tags attached.
blocks defect 0034103 closed markmm82 Incorrect prices are calculated in Purchase Orders/Invoices when exists discounts or promotions related to products. 
Issue History
2016-09-27 17:31markmm82Typedefect => backport
2016-09-27 17:31markmm82Target Version => 3.0PR16Q3.3
2016-09-27 18:03aferrazRegression levelProduction - Confirmed Stable => Production - QA Approved
2016-09-27 18:03aferrazRegression date2016-06-17 => 2016-04-15
2016-09-27 18:03aferrazRegression introduced by commithttps://code.openbravo.com/erp/devel/main/rev/0dc7be081b1c [^] => https://code.openbravo.com/erp/devel/pi/rev/168db990cb85 [^]
2016-09-28 11:47aferrazTarget Version3.0PR16Q3.3 => 3.0PR16Q3.2
2016-09-28 11:47hgbotCheckin
2016-09-28 11:47hgbotNote Added: 0090341
2016-09-28 11:47hgbotStatusscheduled => resolved
2016-09-28 11:47hgbotResolutionopen => fixed
2016-09-28 11:47hgbotFixed in SCM revision => http://code.openbravo.com/erp/backports/3.0PR16Q3.2/rev/4f62913933cd5faf99fa2181231de93a657a5c13 [^]
2016-09-28 11:49aferrazReview Assigned To => aferraz
2016-09-28 11:49aferrazNote Added: 0090342
2016-09-28 11:49aferrazStatusresolved => closed
2016-09-28 11:49aferrazFixed in Version => 3.0PR16Q3.2

Notes
(0090341)
hgbot   
2016-09-28 11:47   
Repository: erp/backports/3.0PR16Q3.2
Changeset: 4f62913933cd5faf99fa2181231de93a657a5c13
Author: Mark <markmm82 <at> gmail.com>
Date: Tue Sep 27 11:06:10 2016 -0400
URL: http://code.openbravo.com/erp/backports/3.0PR16Q3.2/rev/4f62913933cd5faf99fa2181231de93a657a5c13 [^]

Fixes issue 34104: No discounts are applied to product prices in Purchase flows

Price adjustments are not executed if is processing a Purchase Order/Invoice using a product with a promotion or discount, because this functionality should be only available for Sales flows.

---
M src-db/database/model/functions/M_PROMOTION_ADJUSTMENT.xml
M src/org/openbravo/erpCommon/businessUtility/PriceAdjustment.java
---
(0090342)
aferraz   
2016-09-28 11:49   
Code review + Testing OK