Openbravo Issue Tracking System - POS2
View Issue Details
0057455POS2POSpublic2024-12-16 10:402025-02-10 16:20
jayala 
javierRodriguez 
normalmajorhave not tried
closedfixed 
5
 
25Q1 
No
0057455: Suggestions Engine use initial form values to make suggestions
In POS, if Suggestion Engine should suggest something, it's using the initial form values to make suggestions, instead the updated values.
1. Select a customer an edit any address.
2. Change Postal Code.
3. Type something into Address Line 1 to get suggestions.

This suggestions will be related to initial Postal Code, and not to the changed. Once you save the form, and opened again, data is saved, and the suggestions will be correctly generated.

This is also easily noticeable by using the network debugger, watching the network requests done to "getPropertySuggestion" endpoint (this is automatically requested when a the POS is going to show suggestions). Inside the request, the sent entity will contain the old data.

HOW TO REPRODUCE WITH SAMPLEBPINTEGRATION:
Having org.openbravo.retail.samplebpintegration module installed, and the CRM Dataset of this module imported and having CRM without coding enabled (at client window)
1. Select Arturo Montoro as customer an edit "Calle Estafeta 25" address.
2. Change Postal Code: Delete the input and type "310" to view some suggest, select "31010 - Baranain"
3. WITHOUT SAVE OR EXIT THE FORM, change again the Postal Code: Delete the input and type again "310" to watch some suggest, choose "31013 - Berriozar"
4. In network debbuger, the request to getPropertySuggestions, at payload, has entity.postalCode set to 31001. This is not correct because at UI the Postal Code have changed.
5. The infrastructure is using the old postalCode, and this is because the entity which is send to the server is not updated when is sent.
At CustomerFormHandlerUtils.js:
 1. Inside function "setFieldProperties", probably in payload.properties, another property is necessary >> valueChanged: true
 2. Inside function "propertyFormSuggestionSelected":
  2.1. Inside if "useSuggestionEngine" and "field.obAutoResolveSelection", the function "setFieldProperties" is executed with some arguments. Probably one of them is incorrect (probably field.data). If not, the call to this function is incorrect and some code will need to be developed inside these two if's.
  2.2. The variable "entityForSuggestions" is created using objectToValidate.getPlainObject(), which probably is not correct because this is using the old entity (not with the updated data). Probably this is not necessarily a bug and this code it's ok, because the real bug is in first point, and if it's solved, all be ok.

Take into account that this is some developer research after a debugging session, so this solutions/conclusions are not necessary correct.

HOW TO REPRODUCE WITH SAMPLEBPINTEGRATION:
Having org.openbravo.retail.samplebpintegration module installed, and the CRM Dataset of this module imported and having CRM without coding enabled (at client window)
1. Select Arturo Montoro as customer an edit "Calle Estafeta 25" address.
2. Change Postal Code: Delete the input and type "310" to view some suggest, select "31010 - Baranain"
3. WITHOUT SAVE OR EXIT THE FORM, change again the Postal Code: Delete the input and type again "310" to watch some suggest, choose "31013 - Berriozar"
4. In network debbuger, the request to getPropertySuggestions, at payload, has entity.postalCode set to 31001. This is not correct because at UI the Postal Code have changed.
5. The infrastructure is using the old postalCode, and this is because the entity which is send to the server is not updated when is sent.

* A video have been attached to clarify how to reproduce the error.
* The problem (probably) is not from suggest, it's because the infrastructure doesn't update internally the state of the form and later the entity is not correctly sent.

Have fun!
¯\_( ͡❛ ͜ʖ ͡❛)_/¯
No tags attached.
depends on backport 005785025Q1 closed javierRodriguez Suggestions Engine use initial form values to make suggestions 
depends on backport 005785124Q4.2 closed javierRodriguez Suggestions Engine use initial form values to make suggestions 
? Screencast from 2024-12-27 13-14-19.webm (2,256,425) 2024-12-27 13:15
https://issues.openbravo.com/file_download.php?file_id=20692&type=bug
Issue History
2024-12-16 10:40jayalaNew Issue
2024-12-16 10:40jayalaAssigned To => Retail
2024-12-16 10:40jayalaTriggers an Emergency Pack => No
2024-12-16 10:40jayalaAssigned ToRetail => guilleaer
2024-12-16 10:42jayalaProposed Solution updated
2024-12-16 12:12jayalaSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=28929#r28929
2024-12-16 13:16guilleaerSeveritytrivial => minor
2024-12-20 09:03guilleaerStatusnew => scheduled
2024-12-27 13:13jayalaProposed Solution updated
2024-12-27 13:15jayalaFile Added: Screencast from 2024-12-27 13-14-19.webm
2024-12-27 13:17jayalaProposed Solution updated
2025-01-08 11:17guilleaerSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=29013#r29013
2025-01-08 11:17guilleaerProposed Solution updated
2025-01-16 16:30hgbotNote Added: 0174244
2025-01-24 12:54javierRodriguezAssigned Toguilleaer => javierRodriguez
2025-02-04 09:11guilleaerStatusscheduled => acknowledged
2025-02-04 09:11guilleaerStatusacknowledged => scheduled
2025-02-05 17:10hgbotResolutionopen => fixed
2025-02-05 17:10hgbotStatusscheduled => closed
2025-02-05 17:10hgbotFixed in Version => 25Q2
2025-02-05 17:10hgbotNote Added: 0175177
2025-02-05 17:10hgbotNote Added: 0175178
2025-02-06 12:40guilleaerSeverityminor => major
2025-02-10 16:20hgbotFixed in Version25Q2 => 25Q1
2025-02-10 16:20hgbotNote Added: 0175423

Notes
(0174244)
hgbot   
2025-01-16 16:30   
Merge Request created: https://gitlab.com/openbravo/product/pmods/org.openbravo.core2/-/merge_requests/1720 [^]
(0175177)
hgbot   
2025-02-05 17:10   
Directly closing issue as related merge request is already approved.

Repository: https://gitlab.com/orisha-group/bu-commerce/openbravo/product/pmods/org.openbravo.core2 [^]
Changeset: e77a20775e7147655ac29ad229fdff79e9adbbb4
Author: Javier Rodriguez Regueiro <j.rodriguez@orisha.com>
Date: 04-02-2025 15:33:56
URL: https://gitlab.com/orisha-group/bu-commerce/openbravo/product/pmods/org.openbravo.core2/-/commit/e77a20775e7147655ac29ad229fdff79e9adbbb4 [^]

Fixes ISSUE-57455: get form state from the reference in BaseForm

---
M web-jspack/org.openbravo.core2/src/components/Form/BaseForm.jsx
---
(0175178)
hgbot   
2025-02-05 17:10   
Merge request merged: https://gitlab.com/orisha-group/bu-commerce/openbravo/product/pmods/org.openbravo.core2/-/merge_requests/1720 [^]
(0175423)
hgbot   
2025-02-10 16:20   
Directly closing issue as related merge request is already approved.

Repository: https://gitlab.com/orisha-group/bu-commerce/openbravo/product/pmods/org.openbravo.core2 [^]
Changeset: 4363921a5f802b15a0dd10f6b9ccb272c5b3fefa
Author: Javier Rodríguez Regueiro <j.rodriguez@orisha.com>
Date: 10-02-2025 15:20:31
URL: https://gitlab.com/orisha-group/bu-commerce/openbravo/product/pmods/org.openbravo.core2/-/commit/4363921a5f802b15a0dd10f6b9ccb272c5b3fefa [^]

Fixes ISSUE-57455: get form state from the reference in BaseForm


(cherry-picked from commit e77a20775e7147655ac29ad229fdff79e9adbbb4)

Co-authored-by: Javier Rodriguez Regueiro <j.rodriguez@orisha.com>
---
M web-jspack/org.openbravo.core2/src/components/Form/BaseForm.jsx
---