Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0050242Openbravo ERPA. Platformpublic2022-09-13 17:042022-10-10 13:34
migueldejuana 
AugustoMauch 
normaltrivialalways
closedfixed 
5
pi 
PR23Q1 
Core
No
0050242: Setting the value of a field in the Status Bar with an EventObserver need a refresh
Using an EntityPersistenceEventObserver, if we modify a column (in onSave method) shown in the window Status Bar, the Status Bar do not show the change done in the Event Observer.

It is not working in Form mode but it is working fine in Grid mode.
- Create this Event Observer:

public class TestOrderStatusEventObserver extends EntityPersistenceEventObserver {
  private static final Entity[] ENTITIES = {
      ModelProvider.getInstance().getEntity(Order.ENTITY_NAME) };
  private static final Property DOCSTATUS_PROPERTY = ENTITIES[0]
      .getProperty(Order.PROPERTY_DOCUMENTSTATUS);

  @Override
  protected Entity[] getObservedEntities() {
    return ENTITIES;
  }

  public void onSave(@Observes final EntityNewEvent event) {
    if (!isValidEvent(event)) {
      return;
    }
    event.setCurrentState(DOCSTATUS_PROPERTY, "CO");
  }
}

- Open Sales Order window in the ERP
- Create new Sales Order in Form Mode and Save.
- ERROR! In the Status Bar, Document Status is "Draft" and it should be "Booked"
- If we refresh the Sales Order, the Status Bar is updated and we see Document Status: Booked
No tags attached.
Issue History
2022-09-13 17:04migueldejuanaNew Issue
2022-09-13 17:04migueldejuanaAssigned To => Triage Platform Base
2022-09-13 17:04migueldejuanaModules => Core
2022-09-13 17:04migueldejuanaTriggers an Emergency Pack => No
2022-09-13 17:05migueldejuanaSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=24763#r24763
2022-09-13 17:06migueldejuanaSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=24764#r24764
2022-09-26 08:22AugustoMauchStatusnew => scheduled
2022-09-26 08:22AugustoMauchAssigned ToTriage Platform Base => meriem_azaf
2022-10-02 23:53hgbotNote Added: 0141541
2022-10-03 00:09AugustoMauchAssigned Tomeriem_azaf => AugustoMauch
2022-10-10 13:34hgbotResolutionopen => fixed
2022-10-10 13:34hgbotStatusscheduled => closed
2022-10-10 13:34hgbotFixed in Version => PR23Q1
2022-10-10 13:34hgbotNote Added: 0141905
2022-10-10 13:34hgbotNote Added: 0141906

Notes
(0141541)
hgbot   
2022-10-02 23:53   
Merge Request created: https://gitlab.com/openbravo/product/openbravo/-/merge_requests/721 [^]
(0141905)
hgbot   
2022-10-10 13:34   
Directly closing issue as related merge request is already approved.

Repository: https://gitlab.com/openbravo/product/openbravo [^]
Changeset: f1507ec30749237f520e48f3e92a29de7e0e383e
Author: Augusto Mauch <augusto.mauch@openbravo.com>
Date: 10-10-2022 09:56:22
URL: https://gitlab.com/openbravo/product/openbravo/-/commit/f1507ec30749237f520e48f3e92a29de7e0e383e [^]

Fixes ISSUE-50242: List property is properly updated in the status bar of the standard form

When a list formitem was updated by an event handler, its display value in a status bar was not being updated properly. The problem was that
the value used to determine what should be displayed was initially properly obtained using formItem.getDisplayValue, but then was incorrectly
overwritten by its identifier, that for this type of items is not relevant because the valueMap value should take precedence.

The change has been done in the getStatusBarFields that determines how the field is rendered in a status bar, the scope of the change is very
limited so the change should not be risky

---
M modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form.js
---
(0141906)
hgbot   
2022-10-10 13:34   
Merge request merged: https://gitlab.com/openbravo/product/openbravo/-/merge_requests/721 [^]