Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0035717Openbravo ERP07. Sales managementpublic2017-04-05 09:562017-04-11 10:10
ngarcia 
AtulOpenbravo 
immediatemajoralways
closedfixed 
5
 
3.0PR16Q4.43.0PR16Q4.4 
aferraz
Core
Production - Confirmed Stable
2015-07-16
3.0PR15Q4
https://code.openbravo.com/erp/devel/pi/rev/8860b648abb2 [^]
No
0035717: Wrong total gross amount when reactivating an order or a invoice which includes a basic discount of 100%
Wrong total gross amount when reactivating an order or a invoice which includes a basic discount of 100%
As group admin role:
   Create a Basic Discount of 100%
   Assign it to Hoteles Buenas Noches, S.A. business partner
   Create a sales invoice to it
   Check the discount is shown in the Basic Discounts tab
   Add a product to it with a tax rate different from 0 and check the Total Net Amount and Total Gross Amounts are correct (Total Gross Amount = Total Net Amount + Tax Amount
   Complete it and check both Total Gross Amount and Total Net Amount are 0 (discount is applied)
   Reactivate it and check the Total Gross Amount is wrong, it does not include the tax amount (Total Gross Amount = Total Net Amount)
   If you now remove the discount and complete the invoice again, the total gross amount will remain wrong
No tags attached.
blocks defect 0035699 closed AtulOpenbravo Wrong total gross amount when reactivating an order or a invoice which includes a basic discount of 100% 
Issue History
2017-04-06 16:59AtulOpenbravoTypedefect => backport
2017-04-06 16:59AtulOpenbravoTarget Version => 3.0PR16Q4.4
2017-04-06 17:05AtulOpenbravoRegression level => Production - Confirmed Stable
2017-04-06 17:05AtulOpenbravoRegression date => 2015-07-16
2017-04-06 17:05AtulOpenbravoRegression introduced in release => 3.0PR15Q4
2017-04-06 17:05AtulOpenbravoRegression introduced by commit => https://code.openbravo.com/erp/devel/pi/rev/8860b648abb2 [^]
2017-04-07 13:24AtulOpenbravoNote Added: 0095907
2017-04-07 13:32AtulOpenbravoNote Added: 0095908
2017-04-07 13:38AtulOpenbravoNote Added: 0095909
2017-04-10 18:57AtulOpenbravoNote Added: 0095949
2017-04-10 21:09hgbotCheckin
2017-04-10 21:09hgbotNote Added: 0095957
2017-04-10 21:09hgbotStatusscheduled => resolved
2017-04-10 21:09hgbotResolutionopen => fixed
2017-04-10 21:09hgbotFixed in SCM revision => http://code.openbravo.com/erp/backports/3.0PR16Q4.4/rev/30862d0a586cbd0dffe45f16f891f0d4df9e3039 [^]
2017-04-10 21:26AtulOpenbravoNote Deleted: 0095949
2017-04-11 10:10aferrazReview Assigned To => aferraz
2017-04-11 10:10aferrazNote Added: 0095967
2017-04-11 10:10aferrazStatusresolved => closed
2017-04-11 10:10aferrazFixed in Version => 3.0PR16Q4.4

Notes
(0095907)
AtulOpenbravo   
2017-04-07 13:24   
Test Plan:-
- Login as Group Admin role.
- Create a Basic Discount of 100%.
- Assign it to Hoteles Buenas Noches, S.A. business partner.
- Create a sales invoice for above business partner.
- Add the discount of 100% in the Basic Discounts tab.
- Add a product to it with a tax rate different from 0
  for eg: Entregas IVA 21%, Unit Price = 10, Ordered Qty =1000
- Check the Total Net Amount and Total Gross Amounts are correct. (Total Gross Amount = Total Net Amount + Tax Amount.
  Total Gross Amount = 12100, Total Net Amount = 10000, Tax Amount = 2100.
- Complete it and check both Total Gross Amount and Total Net Amount are 0 (as discount is applied).
- Reactivate it and check the Total Gross Amount is correct, it does include the tax amount (Total Gross Amount = Total Net Amount).
  Total Gross Amount = 12100, Total Net Amount = 10000, Tax Amount = 2100.
- Remove the discount and complete the invoice again, check that total gross amount is set properly.
  Total Gross Amount = 12100, Total Net Amount = 10000, Tax Amount = 2100.
(0095908)
AtulOpenbravo   
2017-04-07 13:32   
Test Plan

- Login as Group Admin role.
- Create a Sales Price List with price includes tax flag = Yes.
- Create a version for Sales Price List.
- Add Product Price for product "Agua sin Gas 1L" and Unit Price = List Price = 10.
- Create a Sales Invoice for business partner "Alimentos y Supermercados, S.A" with pricelist "Sales Price List".
- Add product "Agua sin Gas 1L", Ordered Qty = 1000, Tax = "Entregas IVA 21%".
- As Price List Includes Tax, Unit Price is set as 8.26.
- Add 10% Discount in Basic Discount Tab.
- Check Gross Amount = 10000, Total Net Amount = 8260, Tax Amount = 1740.
- Complete the Invoice.
- Check Gross Amount = 9000, Total Net Amount = 7433.55, Tax Amount = 1566.45
- Reactivate the Invoice.
- Check Gross Amount = 10000, Total Net Amount = 8260, Tax Amount = 1740.
- Delete the Basic Discount record.
- Complete the Invoice again.
- Check Gross Amount = 10000, Total Net Amount = 8260, Tax Amount = 1740.
(0095909)
AtulOpenbravo   
2017-04-07 13:38   
Test Plan

- Login as Group Admin role.
- Create a Purchase Order for business partner "La Fruta es la Vida, S.L." with pricelist "Tarifa La Fruta es la Vida".
- Add product "Zumo de Pera 0,5L", Ordered Qty = 1000, Unit Price = 0.75
- Add product "Zumo de Pera 0,5L", Ordered Qty = 1000, Unit Price = 0.75
- Add 5% Discount in Basic Discount Tab.
- Check Gross Amount = 1815, Total Net Amount = 1500.
- Complete the Order.
- Check Gross Amount = 1724.25, Total Net Amount = 1425.
- Reactivate the Order.
- Check Gross Amount = 1815, Total Net Amount = 1500.
- Delete the Basic Discount record.
- Complete the Order again.
- Check Gross Amount = 1815, Total Net Amount = 1500.

Repeat same test plan for Purchase Invoice.
(0095957)
hgbot   
2017-04-10 21:09   
Repository: erp/backports/3.0PR16Q4.4
Changeset: 30862d0a586cbd0dffe45f16f891f0d4df9e3039
Author: Atul Gaware <atul.gaware <at> openbravo.com>
Date: Fri Apr 07 00:50:19 2017 +0530
URL: http://code.openbravo.com/erp/backports/3.0PR16Q4.4/rev/30862d0a586cbd0dffe45f16f891f0d4df9e3039 [^]

Fixes Issue 35717:Wrong total gross amount when reactivating an order or a
invoice which includes a basic discount of 100%

In PostgreSQL instance to achieve trigger execution in order to update
c_invoicetax, c_ordertax properly before deleting discount invoice and
order lines, c_invoicelinetax and c_orderlinetax lines are deleted.

---
M src-db/database/model/functions/C_INVOICE_POST.xml
M src-db/database/model/functions/C_ORDER_POST1.xml
---
(0095967)
aferraz   
2017-04-11 10:10   
Code review + Testing OK