details: /erp/devel/pi/rev/843513568c69
changeset: 12172:843513568c69
user: Antonio Moreno <antonio.moreno <at> openbravo.com>
date: Mon May 16 10:55:02 2011 +0200
summary: Fixed issue 17165. Attachments cannot be added when the record is
new and hasn't been saved.
diffstat:
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-form-attachments.js
| 3 +
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-form.js
| 21 +++++++--
2 files changed, 19 insertions(+), 5 deletions(-)
diffs (73 lines):
diff -r ff8c522e1316 -r 843513568c69
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-form-attachments.js
---
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-form-attachments.js
Fri May 13 18:43:49 2011 +0200
+++
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-form-attachments.js
Mon May 16 10:55:02 2011 +0200
@@ -197,6 +197,9 @@
this.savedAttachments = attachments;
this.removeMembers(this.getMembers());
var hLayout = isc.HLayout.create();
+ if(this.getForm().isNew){
+ return;
+ }
this.addMember(hLayout);
var me = this;
var addButton = isc.OBSectionItemControlLink.create({
diff -r ff8c522e1316 -r 843513568c69
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-form.js
---
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-form.js
Fri May 13 18:43:49 2011 +0200
+++
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-form.js
Mon May 16 10:55:02 2011 +0200
@@ -250,13 +250,17 @@
}
},
- enableAttachmentsSection: function(){
+ enableAttachmentsSection: function(enable){
if (!this.attachmentsSection) {
return;
}
- this.attachmentsSection.collapseSection();
- this.attachmentsSection.setRecordInfo(this.view.entity,
this.getValue(OB.Constants.ID), this.view.tabId);
- this.attachmentsSection.show();
+ if(enable){
+ this.attachmentsSection.collapseSection();
+ this.attachmentsSection.setRecordInfo(this.view.entity,
this.getValue(OB.Constants.ID), this.view.tabId);
+ this.attachmentsSection.show();
+ }else{
+ this.attachmentsSection.hide();
+ }
},
// add the undo buttons to the clickmask so that no save happens when
@@ -289,7 +293,7 @@
this.view.updateTabTitle();
this.enableNoteSection(!isNew);
this.enableLinkedItemSection(!isNew);
- this.enableAttachmentsSection();
+ this.enableAttachmentsSection(!isNew);
if (isNew) {
this.view.statusBar.newIcon.prompt =
OB.I18N.getLabel('OBUIAPP_NewIconPrompt');
@@ -992,11 +996,13 @@
// there the save call is done through the grid saveEditedValues
// function
saveRow: function(){
+ var savingNewRecord = this.isNew;
// store the value of the current focus item
if (this.getFocusItem()) {
this.getFocusItem().updateValue();
this.handleItemChange(this.getFocusItem());
}
+
var i, length, flds, form = this, ficCallDone;
var record = form.view.viewGrid.getSelectedRecord(),
@@ -1088,6 +1094,11 @@
view.refreshParentRecord();
+ // We fill attachments in case the record is new, so that components
+ // of the attachments section are created
+ if(savingNewRecord){
+ this.attachmentsSection.fillAttachments(null);
+ }
} else if (status === isc.RPCResponse.STATUS_VALIDATION_ERROR &&
resp.errors) {
form.handleFieldErrors(resp.errors);
view.standardWindow.autoSaveDone(view, false);
------------------------------------------------------------------------------
Achieve unprecedented app performance and reliability
What every C/C++ and Fortran developer should know.
Learn how Intel has extended the reach of its next-generation tools
to help boost performance applications - inlcuding clusters.
http://p.sf.net/sfu/intel-dev2devmay
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits