Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0021688Openbravo ERPA. Platformpublic2012-09-19 13:342012-09-19 15:20
dbaz 
AugustoMauch 
highminoralways
newopen 
5
 
 
Core
No
0021688: Access to backend ID from the frontend (javascript)
Here:

https://code.openbravo.com/erp/devel/pi/file/35a4bff5296e/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form.js#l1890 [^]

There is a reference to a SimpleType (_id_13) that is returned from the backend via:

isc.SimpleType.create({inheritsFrom:'text',name:'_id_13',editorType:'OBTextItem',gridEditorType:'OBTextItem',filterEditorType:'OBTextItem',referenceName:'ID'}

this is code generated in smartclient_types_js.ftl
See Description
Create something like:

OB.Constants.References = {
  ID: {
    id: '13',
    name: '_id_13'
  }
};

(This object could have all references inside, but I think just with the ID one is enough, at least for now)

where this '_id_13' will be returned from the server in a ftl.

Then in the code, change

isID: function (item) {
  return item.type === '_id_13';
}

by

isID: function (item) {
  return item.type === OB.Constants.References.ID.name;
}

No tags attached.
related to defect 00216573.0MP16 closed AugustoMauch The windows were the id field is checked as show in grid does not work 
Issue History
2012-09-19 13:34dbazNew Issue
2012-09-19 13:34dbazAssigned To => AugustoMauch
2012-09-19 13:34dbazModules => Core
2012-09-19 13:38dbazNote Added: 0052225
2012-09-19 15:20dbazRelationship addedrelated to 0021657

Notes
(0052225)
dbaz   
2012-09-19 13:38   
A second proposed solution is change the generated "isc.SimpleType.create" creation for each type, in just an array like

OB.Constants.References = {
  ID: {
    inheritsFrom:'text',
    name:'_id_13',
    editorType:'OBTextItem',
    gridEditorType:'OBTextItem',
    filterEditorType:'OBTextItem',
    referenceName:'ID'
  },
  ....
};

and of course, include in "OB.Constants.References" all the references information. Then, in another place (out of the ftl), use this generated OB.Constants.References to build the isc.SimpleType