details: /erp/devel/pi/rev/ab02e94cd6ee
changeset: 12492:ab02e94cd6ee
user: Martin Taal <martin.taal <at> openbravo.com>
date: Thu May 26 14:04:15 2011 +0200
summary: Fixes issue 17377: It is not possible to fill Purchase Invoice lines
in grid mode
diffstat:
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js
| 38 +++++++--
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/toolbar/ob-toolbar.js
| 3 +-
2 files changed, 29 insertions(+), 12 deletions(-)
diffs (97 lines):
diff -r da316648a704 -r ab02e94cd6ee
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js
---
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js
Thu May 26 13:23:48 2011 +0200
+++
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js
Thu May 26 14:04:15 2011 +0200
@@ -1425,12 +1425,20 @@
},
startEditingNew: function(rowNum){
- var insertRow;
- if (rowNum || rowNum === 0) {
+ // several cases:
+ // - no current rows, add at position 0
+ // - row selected, add row after selected row
+ // - no row selected, add in the bottom
+ var undef, insertRow;
+ if (rowNum === undef) {
+ // nothing selected
+ if (!this.getSelectedRecord()) {
+ insertRow = this.getTotalRows();
+ } else {
+ insertRow = 1 + this.getRecordIndex(this.getSelectedRecord());
+ }
+ } else {
insertRow = rowNum + 1;
- } else {
-
- insertRow = this.getDrawArea()[0];
}
this.createNewRecordForEditing(insertRow);
this.startEditing(insertRow);
@@ -1467,10 +1475,12 @@
// set the default error message,
// is possibly overridden in the next call
- if (!record[isc.OBViewGrid.ERROR_MESSAGE_PROP]) {
- this.setRecordErrorMessage(rowNum,
OB.I18N.getLabel('OBUIAPP_ErrorInFields'));
- } else {
- record[this.recordBaseStyleProperty] = this.recordStyleError;
+ if (record) {
+ if (!record[isc.OBViewGrid.ERROR_MESSAGE_PROP]) {
+ this.setRecordErrorMessage(rowNum,
OB.I18N.getLabel('OBUIAPP_ErrorInFields'));
+ } else {
+ record[this.recordBaseStyleProperty] = this.recordStyleError;
+ }
}
if (!this.isVisible()) {
@@ -1484,7 +1494,7 @@
view.toolBar.updateButtonState(true);
// if nothing else got selected, select ourselves then
- if (!this.getSelectedRecord()) {
+ if (record && !this.getSelectedRecord()) {
this.selectRecord(record);
}
},
@@ -1784,7 +1794,7 @@
var rowNum = this.getEditRow(), record = this.getRecord(rowNum);
this._hidingInlineEditor = true;
- if (rowNum === 0 || rowNum) {
+ if (record && (rowNum === 0 || rowNum)) {
if (!this.rowHasErrors(rowNum)) {
record[this.recordBaseStyleProperty] = null;
}
@@ -1990,6 +2000,9 @@
if (this.Super('rowHasErrors', arguments)) {
return true;
}
+ if (!this.getEditForm()) {
+ return false;
+ }
if (this.getEditRow() === rowNum && this.getEditForm().hasErrors()) {
return true;
}
@@ -2048,6 +2061,9 @@
setRecordFieldErrorMessages: function(rowNum, errors){
var record = this.getRecord(rowNum);
+ if (!record) {
+ return;
+ }
if (record.editColumnLayout) {
record.editColumnLayout.editButton.setErrorState(errors);
record.editColumnLayout.editButton.setErrorMessage(OB.I18N.getLabel('OBUIAPP_ErrorInFields'));
diff -r da316648a704 -r ab02e94cd6ee
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/toolbar/ob-toolbar.js
---
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/toolbar/ob-toolbar.js
Thu May 26 13:23:48 2011 +0200
+++
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/toolbar/ob-toolbar.js
Thu May 26 14:04:15 2011 +0200
@@ -109,7 +109,8 @@
if (grid.getSelectedRecord()) {
view.newRow(grid.getRecordIndex(grid.getSelectedRecord()));
} else {
- view.newRow(0);
+ // pass in -1, as newrow will put the new row one further
+ view.newRow();
}
},
buttonType: 'newRow',
------------------------------------------------------------------------------
vRanger cuts backup time in half-while increasing security.
With the market-leading solution for virtual backup and recovery,
you get blazing-fast, flexible, and affordable data protection.
Download your free trial now.
http://p.sf.net/sfu/quest-d2dcopy1
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits