Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0019740Openbravo ERP02. Master data managementpublic2012-02-13 13:142012-03-02 15:37
VictorVillar 
AugustoMauch 
urgentmajoralways
closedfixed 
5
3.0MP7.1 
3.0MP93.0MP9 
Core
No
0019740: Error message appears when you try to modify the Business information
You create a Business Partner, it is not a problem, you switch to any tab, modify any data, you can save.
But if the user switchs between tab and header and modifies data in both, and save first the header and then save the data of the tab an error appears:
"The record you are saving has already been changed by
another user or process. Refresh the data by clicking the refresh button, you will loose your current changes."
As group admin role,
Navigate to Business partner,
Select Bebidas Alegres, S.L. business partner

Go to customer tab:
  - Modify Credit line limit: 2
Save it.

Switch to header:
 -modify the Search key.
Save it.

Again, go to customer tab:
  - modify the Credit line limit: 4
save it. An error message appears:
"Saving failed. The record you are saving has already been changed by another user or process. Refresh the data by clicking the refresh button, you will loose your current changes."
No tags attached.
related to defect 0020023 closed AugustoMauch Autosave is throwing a wrong error message 
Issue History
2012-02-13 13:14VictorVillarNew Issue
2012-02-13 13:14VictorVillarAssigned To => jonalegriaesarte
2012-02-13 13:14VictorVillarModules => Core
2012-02-13 13:14VictorVillarResolution time => 1335477600
2012-02-13 13:14VictorVillarIssue Monitored: networkb
2012-02-13 13:23VictorVillarResolution time1335477600 => 1331766000
2012-02-13 13:23VictorVillarPriorityhigh => urgent
2012-02-13 13:23VictorVillarSeverityminor => major
2012-02-13 13:23VictorVillarTarget Version3.0MP10 => 3.0MP9
2012-02-13 17:56jonalegriaesarteAssigned Tojonalegriaesarte => alostale
2012-02-16 10:30alostaleAssigned Toalostale => AugustoMauch
2012-02-17 10:48AugustoMauchNote Added: 0045226
2012-02-17 10:49AugustoMauchNote Edited: 0045226bug_revision_view_page.php?bugnote_id=0045226#r3178
2012-02-17 11:12hgbotCheckin
2012-02-17 11:12hgbotNote Added: 0045227
2012-02-17 11:12hgbotStatusnew => resolved
2012-02-17 11:12hgbotResolutionopen => fixed
2012-02-17 11:12hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/74e62c9cbec53578364f9b8758d263318d60a433 [^]
2012-02-17 11:27AugustoMauchNote Added: 0045228
2012-02-17 11:34AugustoMauchNote Added: 0045229
2012-02-17 11:35AugustoMauchNote Added: 0045230
2012-02-21 10:30alostaleNote Added: 0045298
2012-02-21 10:30alostaleStatusresolved => closed
2012-02-21 10:30alostaleFixed in Version => 3.0MP9
2012-03-02 15:37hudsonbotCheckin
2012-03-02 15:37hudsonbotNote Added: 0045879
2012-03-14 16:37alostaleRelationship addedrelated to 0020023

Notes
(0045226)
AugustoMauch   
2012-02-17 10:48   
(edited on: 2012-02-17 10:49)
This problem happens in the following scenario:
- A view is saved
- A child view is active and belong to the same entity as the parent view
- If that child view is modified without being refreshed previously, it can not be saved.

This happens because of a mechanism to prevent concurrent writes to the same database table. When a record is opened, the timestamp of the last time the table it belongs to was modified is saved. When saving that record, this saved timestamp is compared with the current timestamp of the table. If they differ the changes can not be saved because someone has modified the table after the register was loaded.

In this case, both the header tab and the customer tab belong to the same database table: c_bpartner. When the header tab is saved, the timestamp of the table is updated. In that moment the timestamp of the customer tab expires, so it will not be table to be saved until it is refreshed.

(0045227)
hgbot   
2012-02-17 11:12   
Repository: erp/devel/pi
Changeset: 74e62c9cbec53578364f9b8758d263318d60a433
Author: Augusto Mauch <augusto.mauch <at> openbravo.com>
Date: Fri Feb 17 11:10:34 2012 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/74e62c9cbec53578364f9b8758d263318d60a433 [^]

Fixes issue 19740: Tabs sharing entity with saved parent are refreshed

---
M modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form.js
M modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-view.js
---
(0045228)
AugustoMauch   
2012-02-17 11:27   
A new function has been created in ob-standard-view.js: refreshChildViewsWithEntity(entity). This function refreshes all the child views that belong to the same entity to the view that is being saved.

This function is called from the callback of ob-view-from.saveRow, and only if the saving process has been successful.
(0045229)
AugustoMauch   
2012-02-17 11:34   
If the steps described in the Steps To Reproduce section are followed, the error message should not appear, and the register should be saved.

Further tests:
- Open the Business Partner window
- Open a register (i.e. Sleep Well Hotels, Co.). The header tab belongs to the BusinessPartner entity.
- Some data is loaded in the Customer tab. This tab also belongs to the BusinessPartner entity.
- Move to the subtab Bank Account. It belongs to the BusibnessPartnerBankAccount entity.
- Move back to the header tab, make a change (i.e. change the Search Key) and save the changes.
- The Bank Account tab should not have been refreshed, but the Customer tab should have.
(0045230)
AugustoMauch   
2012-02-17 11:35   
The effect of this change is to refresh some views after a parent view is saved. I think it should not have any side effects, so the fix is not risky.
(0045298)
alostale   
2012-02-21 10:30   
Code reviewed and tested on pi@8e3bca6e8153
(0045879)
hudsonbot   
2012-03-02 15:37   
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/544d64e0c159 [^]

Maturity status: Test