Anonymous | Login
Project:
RSS
  
News | My View | View Issues | Roadmap | Summary

View Issue DetailsJump to Notes ] Issue History ] Print ]
ID
0016845
TypeCategorySeverityReproducibilityDate SubmittedLast Update
backport[Openbravo ERP] 07. Sales managementmajorhave not tried2011-04-19 10:282011-05-31 16:13
ReporterAinhoaPagolaView Statuspublic 
Assigned Tojonalegriaesarte 
PriorityurgentResolutionfixedFixed in Version2.50MP31
StatusclosedFix in branchFixed in SCM revisione4fade7cc09c
ProjectionnoneETAnoneTarget Version2.50MP31
OSAnyDatabasePostgreSQLJava version
OS VersionDatabase versionAnt version
Product Version2.50MP28SCM revision 
Review Assigned To
Web browser
ModulesCore
Regression level
Regression date
Regression introduced in release
Regression introduced by commit
Triggers an Emergency PackNo
Summary

0016845: Invoice Total Amount not properly updated when lines are deleted

DescriptionThe invoice total amount is not properly updated when a line is deleted.
In an invoice with more than one line with the same tax amount, when a line is deleted the Total Amount of the header is not properly updated.
Steps To ReproduceWith sampledata in Openbravo 2.50:
- Create a new header.
- Create a new line for a product. Set unit price to 100 and taxes 16%.
The header has total amount 116 (correct) and a line is created in the tax tab.
- Create a second line for a product. Set unit price to 100 and taxes to 16.
The header has total amount 232 (correct) and the line in the tax tab is updated to 32
- Delete a line.
The tax tab is properly updated. The header has a total amount of 132, instead of 116. That is, the line net amount is decreased from the total amount, but the taxes are not.
Proposed SolutionThis Bug only reproduces in Openbravo 2.50 PostgreSQL database.

The problem seem to be the order in which two triggers execute:

- C_invoiceline_trg2()
- C_invoicelinestax_trg() (this one should execute first).

TagsNo tags attached.
Attached Files

- Relationships Relation Graph ] Dependency Graph ]
depends on defect 0017016 closedjonalegriaesarte Invoice Total Amount not properly updated when lines are deleted 
has duplicate defect 0012296 closedadrianromero When removing a line for an Invoice, Total Net Amount and Total Gross Amount keep the old value 
has duplicate defect 00171172.50MP30 closedadrianromero When leaving an invoice without lines tax amount still appears in invoice header 

-  Notes
(0037437)
adrianromero (manager)
2011-05-25 16:44

This issue can be reproduced in Orders and Invoices, for both types: Purchases and Sales

This issue can be reproduced only in PosgreSQL and not in Oracle because in posgresql the trigger in line taxes is executed after the trigger in lines when line taxes are deleted because of the ON DELETE CASCADE option on the line taxes table.

In Oracle the behavior is exactly the opposite and makes the logic work as expected.

The proposed solution is to remove the ON DELETE CASCADE option on the line taxes table and simulate this option in an ON BEFORE trigger in the table lines.
(0037723)
hgbot (developer)
2011-05-30 13:21

Repository: erp/stable/2.50
Changeset: 255e4e40f94f3a9da49bed0eda2f75a5c1447684
Author: Adrián Romero <adrianromero <at> openbravo.com>
Date: Wed May 25 17:34:14 2011 +0200
URL: http://code.openbravo.com/erp/stable/2.50/rev/255e4e40f94f3a9da49bed0eda2f75a5c1447684 [^]

Fixes issue 0016845: Invoice Total Amount not properly updated when lines are deleted
To execute the triggers in the correct order in postgresql it has been removed the ON DELETE CASCADE option and has been replaced simulating exactly the same logic in the related trigger

---
M src-db/database/model/tables/C_INVOICELINETAX.xml
M src-db/database/model/tables/C_ORDERLINETAX.xml
M src-db/database/model/triggers/C_INVLINE_CHK_RESTRICTIONS_TRG.xml
M src-db/database/model/triggers/C_ORDLINE_CHK_RESTRICTIONS_TRG.xml
---
(0037726)
hgbot (developer)
2011-05-30 13:21

Repository: erp/stable/2.50
Changeset: e4fade7cc09c96f53f5b1c78e04bd70e5b76a861
Author: Adrián Romero <adrianromero <at> openbravo.com>
Date: Mon May 30 13:11:43 2011 +0200
URL: http://code.openbravo.com/erp/stable/2.50/rev/e4fade7cc09c96f53f5b1c78e04bd70e5b76a861 [^]

Fixes issue 0016845: Invoice Total Amount not properly updated when lines are deleted
Adding comments in triggers code

---
M src-db/database/model/triggers/C_INVLINE_CHK_RESTRICTIONS_TRG.xml
M src-db/database/model/triggers/C_ORDLINE_CHK_RESTRICTIONS_TRG.xml
---
(0037727)
hgbot (developer)
2011-05-30 13:22

Repository: erp/stable/api-checks-2.50
Changeset: 9e20363c3c8e470ef43936be77eba563c8f57e0b
Author: Adrián Romero <adrianromero <at> openbravo.com>
Date: Mon May 30 13:19:33 2011 +0200
URL: http://code.openbravo.com/erp/stable/api-checks-2.50/rev/9e20363c3c8e470ef43936be77eba563c8f57e0b [^]

False positive. The delete is done in triggers instead of foreign key to force trigger execution. It is changed in issue 0016845: Invoice Total Amount not properly updated when lines are deleted

---
M model/model/tables/C_INVOICELINETAX.xml
M model/model/tables/C_ORDERLINETAX.xml
---
(0037729)
adrianromero (manager)
2011-05-30 13:32

* Testing the issue

Kindly follow the steps to test and verify that now the total amount in the header shows the correct value after deleting a line. This must be verified in Orders and Invoices and in Purchases and Sales

Verify also that duplicated issues 12296 and 17117 are also fixed

Because of the changes in triggers, it must also be verified that records can be deleted in invoices and order lines without any issue.

* Other areas affected

No other areas affected appart from the tables involved
(0037832)
maite (developer)
2011-05-31 16:13

verified.

- Issue History
Date Modified Username Field Change
2011-04-19 10:28 AinhoaPagola New Issue
2011-04-19 10:28 AinhoaPagola Assigned To => AinhoaPagola
2011-04-19 10:28 AinhoaPagola Modules => Core
2011-04-19 10:45 AinhoaPagola Relationship added related to 0012296
2011-04-26 16:18 dalsasua Issue Monitored: networkb
2011-05-05 08:43 AinhoaPagola Status new => scheduled
2011-05-05 08:43 AinhoaPagola fix_in_branch => pi
2011-05-12 14:12 AinhoaPagola Relationship added depends on 0017117
2011-05-12 14:12 AinhoaPagola Assigned To AinhoaPagola => jonalegriaesarte
2011-05-12 14:16 AinhoaPagola fix_in_branch pi =>
2011-05-12 14:16 AinhoaPagola Proposed Solution updated
2011-05-25 11:42 adrianromero version 2.50MP28 => 3.0RC7
2011-05-25 11:42 adrianromero Target Version 2.50MP30 =>
2011-05-25 11:43 adrianromero version 3.0RC7 => 2.50MP28
2011-05-25 11:43 adrianromero Target Version => 2.50MP30
2011-05-25 11:43 adrianromero Type defect => backport
2011-05-25 16:44 adrianromero Note Added: 0037437
2011-05-25 17:42 adrianromero Relationship replaced has duplicate 0017117
2011-05-25 17:44 adrianromero Relationship replaced has duplicate 0012296
2011-05-26 09:20 adrianromero Target Version 2.50MP30 => 2.50MP31
2011-05-30 13:21 hgbot Checkin
2011-05-30 13:21 hgbot Note Added: 0037723
2011-05-30 13:21 hgbot Status scheduled => resolved
2011-05-30 13:21 hgbot Resolution open => fixed
2011-05-30 13:21 hgbot Fixed in SCM revision => http://code.openbravo.com/erp/stable/2.50/rev/255e4e40f94f3a9da49bed0eda2f75a5c1447684 [^]
2011-05-30 13:21 hgbot Checkin
2011-05-30 13:21 hgbot Note Added: 0037726
2011-05-30 13:21 hgbot Fixed in SCM revision http://code.openbravo.com/erp/stable/2.50/rev/255e4e40f94f3a9da49bed0eda2f75a5c1447684 [^] => http://code.openbravo.com/erp/stable/2.50/rev/e4fade7cc09c96f53f5b1c78e04bd70e5b76a861 [^]
2011-05-30 13:22 hgbot Checkin
2011-05-30 13:22 hgbot Note Added: 0037727
2011-05-30 13:32 adrianromero Note Added: 0037729
2011-05-31 16:13 maite Note Added: 0037832
2011-05-31 16:13 maite Status resolved => closed
2011-05-31 16:13 maite Fixed in Version => 2.50MP31


Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker