Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0034103Openbravo ERP02. Master data managementpublic2016-09-27 17:302016-09-29 00:02
markmm82 
markmm82 
urgentmajoralways
closedfixed 
5
 
3.0PR16Q4 
aferraz
Core
Production - QA Approved
2016-04-15
3.0PR16Q3
https://code.openbravo.com/erp/devel/pi/rev/168db990cb85 [^]
No
0034103: 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 34.28
        Line Net Amount is updated to 34.28
     Purchase Order Header:
    Total Gross Amount: 34.28
    Total Net Amount: 34.28
     
     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
        Line Net Amount 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.
related to defect 0033975 closed markmm82 Openbravo ERP Wrong Net Unit Price and pricestd in order and invoice lines when applying a discount of a percentage with decimals 
depends on backport 00341043.0PR16Q3.2 closed markmm82 Openbravo ERP Incorrect prices are calculated in Purchase Orders/Invoices when exists discounts or promotions related to products. 
caused by defect 0032544 closed shivum039 Retail Modules automatic discounts are applied in backoffice purchase flow 
Issue History
2016-09-27 17:30markmm82New Issue
2016-09-27 17:30markmm82Assigned To => markmm82
2016-09-27 17:30markmm82Modules => Core
2016-09-27 17:30markmm82Regression level => Production - Confirmed Stable
2016-09-27 17:30markmm82Regression date => 2016-06-17
2016-09-27 17:30markmm82Regression introduced in release => 3.0PR16Q3
2016-09-27 17:30markmm82Regression introduced by commit => https://code.openbravo.com/erp/devel/main/rev/0dc7be081b1c [^]
2016-09-27 17:30markmm82Triggers an Emergency Pack => No
2016-09-27 17:31markmm82Statusnew => scheduled
2016-09-27 17:37markmm82Relationship addedrelated to 0033975
2016-09-27 17:37markmm82Note Added: 0090308
2016-09-27 17:49aferrazRelationship addedcaused by 0032544
2016-09-27 17:50aferrazRegression levelProduction - Confirmed Stable => Production - QA Approved
2016-09-27 17:50aferrazRegression date2016-06-17 => 2016-04-15
2016-09-27 17:50aferrazRegression introduced by commithttps://code.openbravo.com/erp/devel/main/rev/0dc7be081b1c [^] => https://code.openbravo.com/erp/devel/pi/rev/168db990cb85 [^]
2016-09-28 09:34aferrazSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=13254#r13254
2016-09-28 09:53hgbotCheckin
2016-09-28 09:53hgbotNote Added: 0090329
2016-09-28 09:53hgbotStatusscheduled => resolved
2016-09-28 09:53hgbotResolutionopen => fixed
2016-09-28 09:53hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/c679132719ab56e00c5702079c419922b51d9e0d [^]
2016-09-28 09:58aferrazReview Assigned To => aferraz
2016-09-28 09:58aferrazNote Added: 0090332
2016-09-28 09:58aferrazStatusresolved => closed
2016-09-28 09:58aferrazFixed in Version => 3.0PR16Q4
2016-09-29 00:02hudsonbotCheckin
2016-09-29 00:02hudsonbotNote Added: 0090360

Notes
(0090308)
markmm82   
2016-09-27 17:37   
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-I
   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 Purchase Order header for Bebidas Alegres, S.L bp.
   Create a line to the purchase order:
     Add the previously created product (Test-I) and check the Net Unit Price is updated to 34.27.
   Set tax to Compras exentas, to not apply taxes.
   Remove discounts from Basic Discounts if exists.
   Book the order and check the following information is updated in header and line:
     Purchase Order Line:
        Net Unit Price is updated to 34.27
     Purchase Order Header:
    Total Gross Amount: 34.27
    Total Net Amount: 34.27
     It is correct because Discounts and Promotions only work for Sales flow and can not be applied.


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 Purchase Invoice header for Bebidas Alegres, S.L bp.
   Create a line to the invoice:
     Add the previously created product (Test-II) and check the Net Unit Price is updated to 34.27.
   Set tax to Compras exentas, to not apply taxes.
   Remove discounts from Basic Discounts if exists.
   Complete the invoice and check the following information is updated in header and line:
     Purchase Invoice Line:
        Net Unit Price is updated to 34.27
     Purchase Invoice Header:
    Total Gross Amount: 34.27
    Total Net Amount: 34.27
     It is correct because Discounts and Promotions only work for Sales flow and can not be applied.

Test Plan 3 (related issue 33975):
As group admin role:
   Set the Price Precision of the Currency EUR to 2 if necessary
   Create a new product
      Search key/ Name: Test-III
   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-III) 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 4 (related issue 33975):
As group admin role:
   Set the Price Precision of the Currency EUR to 2 if necessary
   Create a new product
      Search key/ Name: Test-IV
   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-IV) 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.
(0090329)
hgbot   
2016-09-28 09:53   
Repository: erp/devel/pi
Changeset: c679132719ab56e00c5702079c419922b51d9e0d
Author: Mark <markmm82 <at> gmail.com>
Date: Tue Sep 27 11:06:10 2016 -0400
URL: http://code.openbravo.com/erp/devel/pi/rev/c679132719ab56e00c5702079c419922b51d9e0d [^]

Fixes issue 34103: 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
---
(0090332)
aferraz   
2016-09-28 09:58   
Code review + Testing OK
(0090360)
hudsonbot   
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