Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0025683Openbravo ERPI. Performancepublic2014-02-07 07:492014-02-19 11:59
shuehner 
dmiguelez 
normalminorhave not tried
closedfixed 
5
3.0MP22.2 
3.0PR14Q2 
shuehner
Core
No
0025683: c_order_trg is doing updates to c_invoice when not needed
The logic in c_order_trg is executing the updates to the c_invoice table when it is not needed.

The trigger has some code for checking that some fields changed, but they seem to be too wide.

Example, not processed order, if c_bpartner_id (only this) changes we do update c_invoice even if that update does not use that columns.
Read trigger code
Change logic in trigger:
Put the if.processed='Y' first as top level if

Then put 2nd top-level if with just checking if description or poreference change as check if to update c_invoice or not.

NOTE: this assume that we only want to update the c_invoice if one of the fields mentioned in the update statement are changed.
Performance
related to defect 0025682 closed shuehner Missing index for c_invoice table c_order_id column makes at least c_order_trg + c_order_trg2 slow 
Issue History
2014-02-07 07:49shuehnerNew Issue
2014-02-07 07:49shuehnerAssigned To => AugustoMauch
2014-02-07 07:49shuehnerModules => Core
2014-02-07 07:49shuehnerTriggers an Emergency Pack => No
2014-02-07 07:49shuehnerRelationship addedrelated to 0025682
2014-02-07 08:02alostaleTag Attached: Performance
2014-02-07 08:03alostaleAssigned ToAugustoMauch => dmiguelez
2014-02-07 12:31eduardo_ArgalStatusnew => scheduled
2014-02-07 12:31eduardo_Argalfix_in_branch => pi
2014-02-07 12:32hgbotCheckin
2014-02-07 12:32hgbotNote Added: 0064014
2014-02-07 12:32hgbotStatusscheduled => resolved
2014-02-07 12:32hgbotResolutionopen => fixed
2014-02-07 12:32hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/b4367a3c856cf6ae8d2c7f2d4c58ce2cd0ecdef6 [^]
2014-02-07 12:54hgbotCheckin
2014-02-07 12:54hgbotNote Added: 0064015
2014-02-07 12:54hgbotFixed in SCM revisionhttp://code.openbravo.com/erp/devel/pi/rev/b4367a3c856cf6ae8d2c7f2d4c58ce2cd0ecdef6 [^] => http://code.openbravo.com/erp/devel/pi/rev/4ddcfa6e2e4c33124ef23c3b47c22eddf592bdf9 [^]
2014-02-12 18:30hudsonbotCheckin
2014-02-12 18:30hudsonbotNote Added: 0064172
2014-02-12 18:30hudsonbotCheckin
2014-02-12 18:30hudsonbotNote Added: 0064173
2014-02-19 11:59shuehnerReview Assigned To => shuehner
2014-02-19 11:59shuehnerNote Added: 0064349
2014-02-19 11:59shuehnerStatusresolved => closed
2014-02-19 11:59shuehnerFixed in Version => 3.0MP32

Notes
(0064014)
hgbot   
2014-02-07 12:32   
Repository: erp/devel/pi
Changeset: b4367a3c856cf6ae8d2c7f2d4c58ce2cd0ecdef6
Author: Eduardo Argal Guibert <eduardo.argal <at> openbravo.com>
Date: Fri Feb 07 12:31:59 2014 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/b4367a3c856cf6ae8d2c7f2d4c58ce2cd0ecdef6 [^]

Fixes bug 25683: trigger performance improvement

---
M modules/org.openbravo.advpaymentmngt/src-db/database/model/modifiedTables/FIN_BANKSTATEMENT.xml
M modules/org.openbravo.advpaymentmngt/src-db/database/model/modifiedTables/FIN_FINANCIAL_ACCOUNT.xml
M modules/org.openbravo.advpaymentmngt/src-db/database/model/triggers/APRM_FIN_BNKSTM_LINE_CHECK_TRG.xml
M modules/org.openbravo.advpaymentmngt/src-db/database/model/triggers/APRM_FIN_RECON_CHECK_TRG.xml
M modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_AUXILIARINPUT.xml
M modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_COLUMN.xml
M modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_ELEMENT.xml
M modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_FIELD.xml
M modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_MENU.xml
M modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_MESSAGE.xml
M modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_MODEL_OBJECT.xml
M modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_MODEL_OBJECT_MAPPING.xml
M modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_PROCESS.xml
M modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_PROCESS_PARA.xml
M modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_TREENODE.xml
M modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/MatchTransaction.java
M modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/dao/MatchTransactionDao.java
M modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/process/FIN_BankStatementProcess.java
M modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/process/FIN_ReconciliationProcess.java
M modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/utility/FIN_BankStatementImport.java
M modules/org.openbravo.client.application/web/org.openbravo.client.application/js/toolbar/ob-action-button.js
M src-db/database/model/tables/FACT_ACCT.xml
M src-db/database/model/triggers/C_ORDER_TRG.xml
M src-db/database/sourcedata/AD_AUXILIARINPUT.xml
M src-db/database/sourcedata/AD_COLUMN.xml
M src-db/database/sourcedata/AD_ELEMENT.xml
---
(0064015)
hgbot   
2014-02-07 12:54   
Repository: erp/devel/pi
Changeset: 4ddcfa6e2e4c33124ef23c3b47c22eddf592bdf9
Author: Eduardo Argal Guibert <eduardo.argal <at> openbravo.com>
Date: Fri Feb 07 12:53:48 2014 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/4ddcfa6e2e4c33124ef23c3b47c22eddf592bdf9 [^]

Fixes bug 25683: c_order_trg is doing updates to c_invoice when not needed

---
M src-db/database/model/triggers/C_ORDER_TRG.xml
---
(0064172)
hudsonbot   
2014-02-12 18:30   
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/d1a5bb862230 [^]
Maturity status: Test
(0064173)
hudsonbot   
2014-02-12 18:30   
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/d1a5bb862230 [^]
Maturity status: Test
(0064349)
shuehner   
2014-02-19 11:59   
Reviewed and test on oracle/pgsql.
If changing either poreference or description columns of an c_order the attached c_invoice (if there is one) will get those two fields updates.

However small behavior change:
Before those columns were updated in invoice on any change to attached order.

Now they will only be updated if they have been modified.

So in following case behavior is different
- Have c_order with attached c_invoice
- edit order description, it will get sync to invoice.
- edit invoice description to be different
- edit order payment term -> now description in invoice will not be reverted back to be order description.

After discussing change with EAR deemed reasonable.