Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0047309Openbravo ERP03. Procurement managementpublic2021-06-30 22:192021-07-12 08:23
lbressan 
AugustoMauch 
normalmajoralways
closedfixed 
5
 
PR21Q4 
Core
No
0047309: Creation of invoices from the grid, loss of Focus
The error was detected because several clients reported the error to the partner after updating the Openbravo.
When creating an invoice and its lines from the Grid view, you are losing focus, so after creating an invoice you must exit and refresh the window.

This is playable in livebuild 21Q2
IMG-01

NOTE: Indicate that this problem also occurs when you create a new table or window, it has happened to us more than once to be creating a new field thinking that we have the focus on the correct window and then not finding the field because it has been saved in another window.
That is, it does not seem to be only exclusive to the invoice window, but it extends to all windows.
1. Open Purchase Invoice window (if already open, close it and open it again)
2. Create a new invoice in form mode and save
3. Create a new line in lines tab in grid mode
(Line is created without allowing editing it, actually it is saved automatically with the default data, which is wrong)
This is more visible if reproduced using Sales Order, repeat the steps with sales order, the line in lines will appear red with an error.


Previous Steps:
- Open customer invoice window and create an invoice
- Create lines in grid mode
- Open purchase invoice window
- Remove message in blue and clean filters
- Create header in form
- Create grid lines
No tags attached.
has duplicate defect 0047581 closed platform The Add Details button on Payment In/Out window is missing after sorting records 
related to defect 0047571 closed Sergio_Gomez Sales Order Line is not rendered after clearing the filter and creating a Sale Order 
jpg IMG-01.JPG (159,996) 2021-06-30 22:19
https://issues.openbravo.com/file_download.php?file_id=15980&type=bug
jpg

png SalesInvoiceError.png (87,907) 2021-07-01 11:01
https://issues.openbravo.com/file_download.php?file_id=15982&type=bug
png
Issue History
2021-06-30 22:19lbressanNew Issue
2021-06-30 22:19lbressanAssigned To => Triage Finance
2021-06-30 22:19lbressanFile Added: IMG-01.JPG
2021-06-30 22:19lbressanModules => Core
2021-06-30 22:19lbressanResolution time => 1627423200
2021-06-30 22:19lbressanTriggers an Emergency Pack => No
2021-07-01 07:56PracticsIssue Monitored: Practics
2021-07-01 09:23vmromanosAssigned ToTriage Finance => platform
2021-07-01 10:05cbernerSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=22826#r22826
2021-07-01 10:30cbernerSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=22827#r22827
2021-07-01 11:00lorenzofidalgoNote Added: 0130051
2021-07-01 11:00lorenzofidalgoNote Edited: 0130051bug_revision_view_page.php?bugnote_id=0130051#r22829
2021-07-01 11:01lorenzofidalgoFile Added: SalesInvoiceError.png
2021-07-01 23:56lbressanDescription Updatedbug_revision_view_page.php?rev_id=22845#r22845
2021-07-08 19:31AugustoMauchAssigned Toplatform => AugustoMauch
2021-07-08 19:31AugustoMauchStatusnew => scheduled
2021-07-09 10:22hgbotNote Added: 0130345
2021-07-12 08:23hgbotNote Added: 0130363
2021-07-12 08:23hgbotResolutionopen => fixed
2021-07-12 08:23hgbotStatusscheduled => closed
2021-07-12 08:23hgbotFixed in Version => PR21Q4
2021-07-12 08:23hgbotNote Added: 0130364
2021-09-06 07:53alostaleRelationship addedhas duplicate 0047581
2021-10-27 13:24AugustoMauchRelationship addedrelated to 0047571

Notes
(0130051)
lorenzofidalgo   
2021-07-01 11:00   
I have been able to reproduce it in https://livebuilds.openbravo.com/erp_mp_3.0PR21Q2/ [^] following these steps:

1-Login as Openbravo in https://livebuilds.openbravo.com/erp_mp_3.0PR21Q2/ [^]
2-Go to Sales Invoice window
3-Click in "Create new record in a form" button and fill "Business Partner" with "Restaurantes Luna Llena, S.A."
4-Click Lines tab
5-Click "Create One" to add a new grid row
6-Click the Arrow selector of Product field and add "Bebida Energética 0,5L"
7-Click grid save button
(I attach image with the error)

(0130345)
hgbot   
2021-07-09 10:22   
Merge Request created: https://gitlab.com/openbravo/product/openbravo/-/merge_requests/411 [^]
(0130363)
hgbot   
2021-07-12 08:23   
Merge request merged: https://gitlab.com/openbravo/product/openbravo/-/merge_requests/411 [^]
(0130364)
hgbot   
2021-07-12 08:23   
Directly closing issue as related merge request is already approved.

Repository: https://gitlab.com/openbravo/product/openbravo [^]
Changeset: b3cc188d9a7a312d83ae5f0ef831e41dd8c94f7d
Author: Augusto Mauch <augusto.mauch@openbravo.com>
Date: 2021-07-09T13:29:10+02:00
URL: https://gitlab.com/openbravo/product/openbravo/-/commit/b3cc188d9a7a312d83ae5f0ef831e41dd8c94f7d [^]

Fixes ISSUE-47309: Saving record from form view sometimes fails if grid does not have all data in cache

The problem was the following:
- Start with a grid where not all data is cached (i.e. Sales Order after cleaning the filter)
- Use a grid sort so that the new record would end up after the last one shown in the grid (i.e. documentno asc)
- Add a record in form view. The record is initially added to the grid in the first row, but the filter is applied right after
- Because the new record would not be in the first page, the grid would move the viewport to display it and do datasource requests to obtain the proper page
- These unexpected datasource requests result in grid selections not storing the new data properly

To fix this we follow a similar approach to what is done when adding a new row to the grid while not having all the data cached [1]. The new row is stored in the first
position, regardless of the filter. Now when storing a new record in form view, the grid filter is removed if not all the data is cached, and as a result the new record
will be stored in the first position, and the grid selection will work as expected.

[1] https://gitlab.com/openbravo/product/openbravo/-/blob/master/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js#L3663 [^]

---
M modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form.js
---