Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0033859Openbravo ERP07. Sales managementpublic2016-08-31 09:322016-09-19 16:27
ngarcia 
AtulOpenbravo 
immediatemajoralways
closedfixed 
5
 
3.0PR16Q4 
aferraz
Core
Production - Confirmed Stable
2015-07-16
3.0PR15Q4
https://code.openbravo.com/erp/devel/pi/rev/8860b648abb2 [^]
No
0033859: Wrong Total Gross Amount in orders and invoices as the changes made in tax tab records do not recalculate it
Wrong Total Gross Amount in orders and invoices as the changes made in tax tab records do not recalculate it

Should the user be able to edit or remove the records in tax tab with recalculate = 'Y'?
As group admin role:
   Create a Sales Invoice
   Add a line with a product and a tax rate different from 0
   Go to Tax tab and modify the tax amount. Check the recalculate checkbox is selected
   The total gross amount is not updated
   Complete it and check the total gross amount is not the total net amount plus tax amount
   Repeat the process with purchase invoice
   Repeat the process also by deleting the record in Tax tab instead of editing it
   In this case the problem is also reproducible in orders
   If you post the invoice the difference is posted in the Suspence Balancing Account
It should not be posible to either modify or delete "Tax" set as "Recalculate" = Yes (the ones created automatically by Openbravo).

For Purchase Order/Sales Order, Tax Tab should have UI Pattern as "Read Only". No insert/update/delete action allowed.

Delete action for Tax tab of Sales Invoice/Purchase Invoice should be restricted by event handler in case record has Recalculate flag = Yes. Error message should be shown as "It is not possible to delete an invoice tax record with recalculate flag checked.".

Invoice Tax Tab Fields: Tax Amount, Tax Base Amount and Tax should have read only logic in case of recalculate flag= yes. In this way user cannot edit the values for these fields.

New invoice tax records should be created manually in case a given adjustment is required. This records will have recalculate flag=No hence update and delete action are allowed for this records.
No tags attached.
depends on backport 00338633.0PR16Q3.2 closed AtulOpenbravo Wrong Total Gross Amount in orders and invoices as the changes made in tax tab records do not recalculate it 
depends on backport 00338643.0PR16Q2.3 closed AtulOpenbravo Wrong Total Gross Amount in orders and invoices as the changes made in tax tab records do not recalculate it 
caused by feature request 0028366 closed adrianromero Add new functionality to calculate taxes per product BOM 
Issue History
2016-08-31 09:32ngarciaNew Issue
2016-08-31 09:32ngarciaAssigned To => Triage Finance
2016-08-31 09:32ngarciaModules => Core
2016-08-31 09:32ngarciaResolution time => 1505944800
2016-08-31 09:32ngarciaTriggers an Emergency Pack => No
2016-08-31 09:33ngarciaIssue Monitored: networkb
2016-08-31 09:33ngarciaRelationship addedcaused by 0028366
2016-08-31 09:34ngarciaSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=12989#r12989
2016-08-31 09:43ngarciaSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=12990#r12990
2016-08-31 10:30psanjuanNote Added: 0089582
2016-08-31 10:31psanjuanProposed Solution updated
2016-08-31 10:31psanjuanNote Edited: 0089582bug_revision_view_page.php?bugnote_id=0089582#r12992
2016-08-31 10:37psanjuanNote Added: 0089585
2016-08-31 10:37psanjuanNote Edited: 0089585bug_revision_view_page.php?bugnote_id=0089585#r12994
2016-08-31 12:15aferrazProposed Solution updated
2016-08-31 12:20aferrazProposed Solution updated
2016-08-31 12:21aferrazAssigned ToTriage Finance => AtulOpenbravo
2016-08-31 12:22aferrazStatusnew => scheduled
2016-08-31 14:24ngarciaResolution time1505944800 => 1474408800
2016-09-13 10:52aferrazRegression level => Production - Confirmed Stable
2016-09-13 10:52aferrazRegression date => 2015-07-16
2016-09-13 10:52aferrazRegression introduced in release => 3.0PR15Q4
2016-09-13 10:52aferrazRegression introduced by commit => https://code.openbravo.com/erp/devel/pi/rev/8860b648abb2 [^]
2016-09-13 17:56AtulOpenbravoProposed Solution updated
2016-09-13 18:00AtulOpenbravoProposed Solution updated
2016-09-13 20:05AtulOpenbravoProposed Solution updated
2016-09-14 13:06AtulOpenbravoNote Added: 0089951
2016-09-14 17:51aferrazProposed Solution updated
2016-09-16 09:24hgbotCheckin
2016-09-16 09:24hgbotNote Added: 0090020
2016-09-16 09:24hgbotStatusscheduled => resolved
2016-09-16 09:24hgbotResolutionopen => fixed
2016-09-16 09:24hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/e5fb94b24cfcc0bc4aebf2c53db4c6e51007ae82 [^]
2016-09-16 09:26aferrazReview Assigned To => aferraz
2016-09-16 09:26aferrazNote Added: 0090023
2016-09-16 09:26aferrazStatusresolved => closed
2016-09-16 09:26aferrazFixed in Version => 3.0PR16Q4
2016-09-19 16:27hudsonbotCheckin
2016-09-19 16:27hudsonbotNote Added: 0090068

Notes
(0089582)
psanjuan   
2016-08-31 10:30   
(edited on: 2016-08-31 10:31)
- sales order with only one unit of a product included at a net unit price of 100.00. VAT 21%.
In that case what Openbravo first calculates is this:
Line Net Amount = 100.00, that is equal to Taxable Amount = 100.00. Tax Amount = 21.00

- according to the issue now, "we go to the tax tab and modify the tax amount for instance to 22.50". We check that "recalculate" checkbox is selected.

- In that case we are going to end up with below data:
Line Net Amount = 100.00 that is Not equal to new Taxable Amount = 107.14. Tax Amount = 22.50

- Total gross amount is not longer 121.00 but 129.64, right. However Openbravo still shows a Total Gross Amount = 121.00 and a Total Net Amount = 100.00.
It does not match.

Posting would look like:
121.00 Clientes (Debit)
1.50 cuenta de cuadre (Debit)
Ventas 100.00 (Credit)
Iva 22.50 (Credit)

This is not correct.

However if instead of modifying that line a new line in tax tab is created with the difference (in our example 1.5), that makes total gross amount changes to 122.50
Therefore final figures are:
Line Net Amont = 100.00 = Taxable Amount
Tax Amount 22.50
and Total Gross Amount = 122.50

Posting:
122.50 Clientes (Debit)
100.00 Ventas (Credit)
22.50 Iva (Credit)

This is correct.

Proposed solution:

It should not be posible to either modify or delete "Tax Lines" set as "Recalculate" = Yes (the ones created automatically by Openbravo)

New lines should be created manually in case a given adjustment is required.

(0089585)
psanjuan   
2016-08-31 10:37   
This issue is a regression because it did correctly work for instance in 15Q2 before calculate taxes per product BOM feature was implemented.

(0089951)
AtulOpenbravo   
2016-09-14 13:06   
Test Plan
- Create a Sales Invoice for "Moon Light Restaurants, Co." in F&B US Inc Org.
- Create Line with Product "Ale Beer", Quantity = 1, Unit Price 100, Tax = CA Sales Tax.
- Check Header info: Total Gross Amount = 108.25, Total Net Amount = 100.
- Go to Tax Tab: Select record with CA Sales Tax.
- Check Tax, Tax Amount, Taxable Amount fields are not editable, Recalculate flag = Yes.
- Try to delete above record: Error message is shown:"Cannot delete invoice tax record with recalculate flag = yes."
- Add new record in Invoice Tax Tab with Tax "FL Sales Tax",Taxable amount=100.
- Check Tax, Tax Amount, Taxable Amount fields are editable, Recalculate flag = No. Tax Amount = 6.
- Check Header info: Total Gross Amount = 114.25, Total Net Amount = 100.
- Try to delete above record. Record is deleted successfully.
- Check Header info: Total Gross Amount = 108.25, Total Net Amount = 100.
- Try to delete Invoice Header. Record is deleted successfully.
(0090020)
hgbot   
2016-09-16 09:24   
Repository: erp/devel/pi
Changeset: e5fb94b24cfcc0bc4aebf2c53db4c6e51007ae82
Author: Atul Gaware <atul.gaware <at> openbravo.com>
Date: Wed Sep 14 15:36:20 2016 +0530
URL: http://code.openbravo.com/erp/devel/pi/rev/e5fb94b24cfcc0bc4aebf2c53db4c6e51007ae82 [^]

Fixes issue 33859: Wrong Total Gross Amount in orders and invoices

Wrong Total Gross Amount in orders and invoices as the changes made in tax tab records do not recalculate it.

For Purchase Order and Sales Order, Tax tab is made read only so only record are created, modified and deleted only through order lines.
Manual insertion, updation and deletion is not possible.

In case of Sales Invoice and Purchase Invoices, records created by invoice line are marked with recalculate flag = Yes.
Read Only logic based on this flag does not allow user to modify fields tax, tax amount and taxable amount of invoice tax records.
Event handler restricts user to delete invoice tax records with recalculate flag = Yes.
To avoid event handlers interference with ReorderCascadingChildDeletionsHandler.java, on Invoice deletetion, before deleting invoice tax records, flag recalculate is set = No

---
M modules/org.openbravo.client.application/src/org/openbravo/client/application/event/ReorderCascadingChildDeletionsHandler.java
M src-db/database/sourcedata/AD_COLUMN.xml
M src-db/database/sourcedata/AD_MESSAGE.xml
M src-db/database/sourcedata/AD_TAB.xml
A src/org/openbravo/event/InvoiceTaxEventHandler.java
---
(0090023)
aferraz   
2016-09-16 09:26   
Code review + Testing OK
(0090068)
hudsonbot   
2016-09-19 16:27   
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/17da7ad0ad62 [^]
Maturity status: Test