Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0043581Openbravo ERP03. Procurement managementpublic2020-03-25 21:292020-04-06 15:51
lbressan 
vmromanos 
normalmajoralways
closedfixed 
5
 
PR20Q43.0PR20Q2 
dmiguelez
Core
No
0043581: selector "Create lines from Order" in "Purchase Invoice" does not show trigger's errors.
When throwing an exception from a trigger (Example: RAISE EXCEPTION '%', '@ErrorMessage@'; --OBTG:-20000--) the error message is not shown in the selector.
1 - Create a trigger in the invoice line table with a single line where an exception is thrown, example RAISE EXCEPTION '%', '@SomeErrorMessage@'; --OBTG:-20000--
2 - Create a Purchase Invoice header.
3 - Create lines using the selector "Create lines from Order"

Error message is not displayed on selector (see attached image)
No tags attached.
related to defect 0043608 closed alostale failed process definition execution not shown in UI 
png CreateLinesFromOrder.PNG (15,400) 2020-03-25 21:29
https://issues.openbravo.com/file_download.php?file_id=14216&type=bug
png

diff 43581_proposal.diff (1,726) 2020-03-30 14:07
https://issues.openbravo.com/file_download.php?file_id=14229&type=bug
diff patch_to_force_trigger_exception.diff (597) 2020-03-31 13:05
https://issues.openbravo.com/file_download.php?file_id=14238&type=bug
Issue History
2020-03-25 21:29lbressanNew Issue
2020-03-25 21:29lbressanAssigned To => Triage Finance
2020-03-25 21:29lbressanFile Added: CreateLinesFromOrder.PNG
2020-03-25 21:29lbressanModules => Core
2020-03-25 21:29lbressanResolution time => 1586901600
2020-03-25 21:29lbressanTriggers an Emergency Pack => No
2020-03-25 22:04PracticsIssue Monitored: Practics
2020-03-27 08:49inigo_lergaAssigned ToTriage Finance => inigo_lerga
2020-03-27 08:49inigo_lergaStatusnew => scheduled
2020-03-30 13:34vmromanosIssue cloned0043608
2020-03-30 13:34vmromanosRelationship addedrelated to 0043608
2020-03-30 13:51vmromanosRelationship replaceddepends on 0043608
2020-03-30 14:02vmromanosNote Added: 0118875
2020-03-30 14:07vmromanosFile Added: 43581_proposal.diff
2020-03-31 12:55vmromanosRelationship replacedrelated to 0043608
2020-03-31 12:55vmromanosAssigned Toinigo_lerga => vmromanos
2020-03-31 13:00vmromanosNote Edited: 0118875bug_revision_view_page.php?bugnote_id=0118875#r20647
2020-03-31 13:04vmromanosNote Added: 0118890
2020-03-31 13:04vmromanosNote Edited: 0118890bug_revision_view_page.php?bugnote_id=0118890#r20649
2020-03-31 13:05vmromanosFile Added: patch_to_force_trigger_exception.diff
2020-03-31 13:10hgbotCheckin
2020-03-31 13:10hgbotNote Added: 0118892
2020-03-31 13:10hgbotStatusscheduled => resolved
2020-03-31 13:10hgbotResolutionopen => fixed
2020-03-31 13:10hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/ca7ef98a3db96f7ed94083b57a9efbcb31fdbfae [^]
2020-03-31 13:14vmromanosReview Assigned To => dmiguelez
2020-04-02 15:40dmiguelezNote Added: 0118925
2020-04-02 15:40dmiguelezStatusresolved => closed
2020-04-02 15:40dmiguelezFixed in Version => 3.0PR20Q2
2020-04-06 09:25hgbotCheckin
2020-04-06 09:25hgbotNote Added: 0118940
2020-04-06 09:25hgbotCheckin
2020-04-06 09:25hgbotNote Added: 0118941
2020-04-06 11:54hgbotCheckin
2020-04-06 11:54hgbotNote Added: 0118980
2020-04-06 11:54hgbotStatusclosed => resolved
2020-04-06 11:54hgbotFixed in SCM revisionhttp://code.openbravo.com/erp/devel/pi/rev/ca7ef98a3db96f7ed94083b57a9efbcb31fdbfae [^] => http://code.openbravo.com/erp/devel/pi/rev/9586c212a90a00eecfa52f9fe5d84cbc6c593496 [^]
2020-04-06 15:51cbernerNote Added: 0118997
2020-04-06 15:51cbernerStatusresolved => closed

Notes
(0118875)
vmromanos   
2020-03-30 14:02   
(edited on: 2020-03-31 13:00)
Cloned to 0043608 and assigned to Platform as I think it is a generic problem.

However, I keep opened this issue to allow the Create Lines From to properly show the exception's message raised from the trigger, as right now it won't work.

(0118890)
vmromanos   
2020-03-31 13:04   
Test plan I:
Login as F&B group admin
Go to Purchase Invoice window and create a new record for "Norte" organization and "Bebidas Alegres" business partner.
Press Create Lines From Order.
Select any line. Press Done.
Verify the process is completed successfully and the line has been inserted in the invoice Lines tab.


Test plan II:
Login as F&B group admin
Go to Purchase Invoice window and create a new record for "Norte" organization and "Bebidas Alegres" business partner.
Press Create Lines From Order.
Do not select any line. Press Done
Verify the error is shown in the message bar: "There are not lines selected."


Test plan III:
Apply the attached patch.
Login as F&B group admin
Go to Purchase Invoice window and create a new record for "Norte" organization and "Bebidas Alegres" business partner.
Press Create Lines From Order.
Select any line. Press Done.
Verify the error is shown in the message bar: "ERROR: The invoice line of a re-activated invoice that is linked to a Landed Cost cannot be modified. Where: función PL/pgSQL c_invoiceline_trg() en la línea 34 en RAISE"

(0118892)
hgbot   
2020-03-31 13:10   
Repository: erp/devel/pi
Changeset: ca7ef98a3db96f7ed94083b57a9efbcb31fdbfae
Author: Víctor Martínez Romanos <victor.martinez <at> openbravo.com>
Date: Tue Mar 31 12:58:39 2020 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/ca7ef98a3db96f7ed94083b57a9efbcb31fdbfae [^]

fixed BUG-43581: Create Lines From support for trigger exceptions

In case of errors during the process we rollback and close the current transaction. This is a general improvement that makes sense to the process.

In the JSONObject returned to the UI in case of exceptions, we try to get the message text to display to the end user. This is only possible because the previous locked transaction is closed, so DAL opens a new one to retrieve the error message.

Note that this code works for both db and java exceptions

---
M src/org/openbravo/common/actionhandler/createlinesfromprocess/CreateInvoiceLinesFromHandler.java
M src/org/openbravo/common/actionhandler/createlinesfromprocess/CreateInvoiceLinesFromProcess.java
---
(0118925)
dmiguelez   
2020-04-02 15:40   
Code Review + Testing Ok
(0118940)
hgbot   
2020-04-06 09:25   
Repository: erp/devel/pi
Changeset: 67445d6d353d73d35a60b50303d4840ee4fd7ceb
Author: Víctor Martínez Romanos <victor.martinez <at> openbravo.com>
Date: Mon Apr 06 09:11:11 2020 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/67445d6d353d73d35a60b50303d4840ee4fd7ceb [^]

Related to BUG-43581: Use OBMessageUtils.translateError()
This method provides better support for db related exceptions, so the error message is nicer

---
M src/org/openbravo/common/actionhandler/createlinesfromprocess/CreateInvoiceLinesFromHandler.java
---
(0118941)
hgbot   
2020-04-06 09:25   
Repository: erp/backports/3.0PR20Q2
Changeset: 9dc2aada8f02e43f975abea330de77c01c43c9f1
Author: Víctor Martínez Romanos <victor.martinez <at> openbravo.com>
Date: Mon Apr 06 09:11:11 2020 +0200
URL: http://code.openbravo.com/erp/backports/3.0PR20Q2/rev/9dc2aada8f02e43f975abea330de77c01c43c9f1 [^]

Related to BUG-43581: Use OBMessageUtils.translateError()
This method provides better support for db related exceptions, so the error message is nicer

---
M src/org/openbravo/common/actionhandler/createlinesfromprocess/CreateInvoiceLinesFromHandler.java
---
(0118980)
hgbot   
2020-04-06 11:54   
Repository: erp/devel/pi
Changeset: 9586c212a90a00eecfa52f9fe5d84cbc6c593496
Author: Víctor Martínez Romanos <victor.martinez <at> openbravo.com>
Date: Tue Mar 31 12:58:39 2020 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/9586c212a90a00eecfa52f9fe5d84cbc6c593496 [^]

fixed BUG-43581: Create Lines From support for trigger exceptions

In case of errors during the process we rollback and close the current transaction. This is a general improvement that makes sense to the process.

In the JSONObject returned to the UI in case of exceptions, we try to get the message text to display to the end user. This is only possible because the previous locked transaction is closed, so DAL opens a new one to retrieve the error message.

Note that this code works for both db and java exceptions

---
M src/org/openbravo/common/actionhandler/createlinesfromprocess/CreateInvoiceLinesFromHandler.java
M src/org/openbravo/common/actionhandler/createlinesfromprocess/CreateInvoiceLinesFromProcess.java
---
(0118997)
cberner   
2020-04-06 15:51   
closed: wrongly reopened