Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0027023Openbravo ERP07. Sales managementpublic2014-07-07 10:282014-08-14 15:59
alostale 
vmromanos 
normalmajorhave not tried
closedfixed 
5
 
 
rafaroda
Core
No
0027023: Order line taxes are regenerated on all order line changes
Whenever there is any change in order line, all order line taxes are recreated.

This causes performance degradation.

Note when number of order lines is big (>400), booking an order takes long time due to this issue.
Using PG:
-Enable function statistics:
  -In postgresql.conf set track_functions = all
  -/etc/init.d/postgresql reload
-Create a sales order with one line
-Reset pg statistics: select pg_stat_reset();
-Book it
  * Check function calls: select funcname, calls, total_time, self_time from pg_stat_user_functions order by self_time desc
  * c_orderline_tax_trg is invoked 6 times
The problem is in c_orderline_trg2:

1. Do smarter logic to determine if taxes should be regenerated: instead of doing it always check if columns affecting them have been changed and do it only in this case
2. Instead of recreating them, modify existent ones in case of change.
Performance
related to defect 0027024 closed vmromanos Unneeded updates to c_order whenever c_orderline is modified 
related to defect 0027338 new dmiguelez Review deleting logic of tax lines in C_ORDERLINE_TRG2 
blocks defect 0027160 closed eduardo_Argal C_Order_Post poor performance 
Issue History
2014-07-07 10:28alostaleNew Issue
2014-07-07 10:28alostaleAssigned To => eduardo_Argal
2014-07-07 10:28alostaleModules => Core
2014-07-07 10:28alostaleTriggers an Emergency Pack => No
2014-07-07 10:29alostaleTag Attached: Performance
2014-07-07 10:31alostaleDescription Updatedbug_revision_view_page.php?rev_id=6009#r6009
2014-07-07 10:33alostaleProposed Solution updated
2014-07-07 10:37alostaleRelationship addedrelated to 0027024
2014-07-07 13:32jpcalventeIssue Monitored: jpcalvente
2014-07-21 16:36jonalegriaesarteResolution time => 1407362400
2014-07-21 16:55vmromanosStatusnew => scheduled
2014-07-21 16:55vmromanosAssigned Toeduardo_Argal => vmromanos
2014-07-21 16:55vmromanosfix_in_branch => pi
2014-07-22 15:12hgbotCheckin
2014-07-22 15:12hgbotNote Added: 0068808
2014-07-22 15:12hgbotStatusscheduled => resolved
2014-07-22 15:12hgbotResolutionopen => fixed
2014-07-22 15:12hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/085ea1fce739489f26d85c05d89b6e8ed7ec23e4 [^]
2014-07-23 08:26alostaleRelationship addedblocks 0027160
2014-08-04 16:35dmitry_mezentsevNote Added: 0069073
2014-08-08 18:53hudsonbotCheckin
2014-08-08 18:53hudsonbotNote Added: 0069211
2014-08-08 19:58eduardo_ArgalNote Added: 0069275
2014-08-14 15:56rafarodaRelationship addedrelated to 0027338
2014-08-14 15:59rafarodaReview Assigned To => rafaroda
2014-08-14 15:59rafarodaNote Added: 0069374
2014-08-14 15:59rafarodaStatusresolved => closed

Notes
(0068808)
hgbot   
2014-07-22 15:12   
Repository: erp/devel/pi
Changeset: 085ea1fce739489f26d85c05d89b6e8ed7ec23e4
Author: Víctor Martínez Romanos <victor.martinez <at> openbravo.com>
Date: Tue Jul 22 10:23:09 2014 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/085ea1fce739489f26d85c05d89b6e8ed7ec23e4 [^]

Fixed bug 27023 Fixed bug 27024: Performance improvements on C_ORDERLINE_TRG2

---
M src-db/database/model/triggers/C_ORDERLINE_TRG2.xml
---
(0069073)
dmitry_mezentsev   
2014-08-04 16:35   
The issues is not closed for 13 days now!!!
(0069211)
hudsonbot   
2014-08-08 18:53   
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/4450016dee64 [^]
Maturity status: Test
(0069275)
eduardo_Argal   
2014-08-08 19:58   
Code Review done. It seems point 2 from proposed solution has not yet been implemented, that drives to doing delete + insert instead of an update.
Should be discussed before closing.
Issue can be closed if a related issue is logged asking to review ponit 2.
(0069374)
rafaroda   
2014-08-14 15:59   
Reviewed execution of c_orderlinetax_trg: now called just 2 times when Booking Sales Order.

Related issue 0027338 has been opened to address point 2. Instead of recreating them, modify existent ones in case of change.