Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0042051Openbravo ERP07. Sales managementpublic2019-10-17 11:322019-12-12 23:01
gorkaion 
markmm82 
normalminoralways
closedfixed 
5
 
3.0PR20Q2 
Sandrahuguet
Core
No
0042051: cancel and replace sets messagebar as keepOnAutomaticRefresh even if no message is shown
The cancel and replace functionality adds 2 client event handlers on preSave and preDelete events. On these event handlers the messageBar.keepOnAutomaticRefresh is set to true even if no message is shown.

This flag is used to avoid a message to be automatically removed.

As the flag is enabled the next message shown, even if it is not related to the Cancel and Replace, it is fixed and is not automatically removed.
1. Open developer tools and the generated js file.
2. Search for "ClientSideEventHandlersPreSaveUpdate" and put a breakpoint on the line setting the keepOnAutomaticRefresh true.
3. Search for "ClientSideEventHandlersPreDelete" and put a breakpoint on the line setting the keepOnAutomaticRefresh true.
4. Search for "OBMessageBar.addProperties" and then the hide function that it defines and set a breakpoint on "if (force || !this.keepOnAutomaticRefresh) {" line.
5. Now disable the breakpoints to be able to create a sales order header and line in draft status.
6. Leave the order line tab in grid mode.
7. Enable the breakpoints and edit the line changing the quantity.
8. Notice that it executes several times the hide() function and keepOnAutomaticRefresh is undefined until the cancel and replace event handler is executed and sets it to true. Later new executions of hide() function on the sales order line tab the flag is set as true.
9. Open form view and note that the flag is still set to true in the hide() method.


Alternative steps:
1. Create a Process Definition on Sales Order Line tab that can be executed in draft status and that shows the success message in the lines tab using:
        showMessage.put("showMsgInView", msg);
        responseActions.put(showMessage);
        result.put("responseActions", responseActions);
2. Create a Sales Order and Sales Order Line in draft status.
3. Modify the line in the grid mode.
4. Execute the process definition to show the message.
5. Open the line in form view and check the message is not removed.
6. Close the Sales Order window and open it again.
7. Load in grid view the same Sales Order Line.
8. Without editing the line execute the Process Definition to show the message.
9. Open the line in form view and check that the message is removed.
The keepOnAutomaticRefresh should be set to true only in case the cancelAndReplace EventHandler shows a message.

It is even arguable if the flag needs to be set at all as it is changing the default behavior of any message shown in the application.
No tags attached.
Issue History
2019-10-17 11:32gorkaionNew Issue
2019-10-17 11:32gorkaionAssigned To => Triage Finance
2019-10-17 11:32gorkaionModules => Core
2019-10-17 11:32gorkaionTriggers an Emergency Pack => No
2019-10-17 11:41gorkaionSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=19514#r19514
2019-10-17 12:03SandrahuguetAssigned ToTriage Finance => markmm82
2019-10-21 04:26markmm82Statusnew => scheduled
2019-10-23 02:27markmm82Note Added: 0115237
2019-10-25 14:06hgbotCheckin
2019-10-25 14:06hgbotNote Added: 0115281
2019-10-25 14:06hgbotStatusscheduled => resolved
2019-10-25 14:06hgbotResolutionopen => fixed
2019-10-25 14:06hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/be648b321403252f2ff9327bc7c2c8fbd0c4b55d [^]
2019-10-25 14:07SandrahuguetReview Assigned To => Sandrahuguet
2019-10-25 14:07SandrahuguetNote Added: 0115282
2019-10-25 14:07SandrahuguetStatusresolved => closed
2019-10-25 14:07SandrahuguetFixed in Version => 3.0PR20Q2
2019-12-12 23:01hudsonbotCheckin
2019-12-12 23:01hudsonbotNote Added: 0116267

Notes
(0115237)
markmm82   
2019-10-23 02:27   
Test Plan:
As System Admin set enabled the "Enable Cancel and Replace" preference.
As Group Admin:
  Create a new Sales Order.
  Add a line and complete it.

  Executes Cancel and Replace and Done.
  Notice a success message is shown:
     Process completed successfully
     Order in Temporal Status

  Do any change in lines and execute Confirm Cancel and Replace
  Notice a success message is shown:
     Process completed successfully
(0115281)
hgbot   
2019-10-25 14:06   
Repository: erp/devel/pi
Changeset: be648b321403252f2ff9327bc7c2c8fbd0c4b55d
Author: Mark Molina <mark.molina <at> doceleguas.com>
Date: Tue Oct 22 20:40:21 2019 -0300
URL: http://code.openbravo.com/erp/devel/pi/rev/be648b321403252f2ff9327bc7c2c8fbd0c4b55d [^]

Fixes issue 42051: Removed all the keepOnAutomaticRefresh flag activation as it
is not necessary and it is changing the default behavior of any message shown in
the application.

The keepOnAutomaticRefresh was set to true in all the cases inside the cancelAndReplace
EventHandlers, no matter if a message was shown or not, and this causes that next message shown,
even if it is not related to the Cancel and Replace, it is fixed and is not automatically removed.

The keepOnAutomaticRefresh flag is used to avoid a message to be automatically removed but it is
not needed on this functionality and it was removed.

---
M web/js/cancelAndReplace.js
---
(0115282)
Sandrahuguet   
2019-10-25 14:07   
code review + testing ok
(0116267)
hudsonbot   
2019-12-12 23:01   
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/954d2b7a66fb [^]
Maturity status: Test