details: /erp/devel/pi/rev/6c0d862ded05
changeset: 9766:6c0d862ded05
user: Asier Lostalé <asier.lostale <at> openbravo.com>
date: Thu Jan 13 10:38:05 2011 +0100
summary: [process] Autosave before executing process
details: /erp/devel/pi/rev/03998aaa2fc5
changeset: 9767:03998aaa2fc5
user: Asier Lostalé <asier.lostale <at> openbravo.com>
date: Thu Jan 13 10:57:12 2011 +0100
summary: [process] Make use of 'triggers autosave' property of button columns
diffstat:
modules/org.openbravo.client.application/src/org/openbravo/client/application/templates/ob-view-tab.js.ftl
| 1 +
modules/org.openbravo.client.application/src/org/openbravo/client/application/window/OBViewTab.java
| 6 +++
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-action-button.js
| 19 +++++++++-
3 files changed, 25 insertions(+), 1 deletions(-)
diffs (70 lines):
diff -r 962238acceaf -r 03998aaa2fc5
modules/org.openbravo.client.application/src/org/openbravo/client/application/templates/ob-view-tab.js.ftl
---
a/modules/org.openbravo.client.application/src/org/openbravo/client/application/templates/ob-view-tab.js.ftl
Thu Jan 13 10:26:55 2011 +0100
+++
b/modules/org.openbravo.client.application/src/org/openbravo/client/application/templates/ob-view-tab.js.ftl
Thu Jan 13 10:57:12 2011 +0100
@@ -51,6 +51,7 @@
obManualURL: '${field.url?js_string}',
command: '${field.command?js_string}',
property: '${field.propertyName?js_string}',
+ autosave: ${field.autosave?string},
labelValue: {<#list field.labelValues as value>
'${value.value?js_string}': '${value.label?js_string}'<#if
value_has_next>,</#if>
</#list>
diff -r 962238acceaf -r 03998aaa2fc5
modules/org.openbravo.client.application/src/org/openbravo/client/application/window/OBViewTab.java
---
a/modules/org.openbravo.client.application/src/org/openbravo/client/application/window/OBViewTab.java
Thu Jan 13 10:26:55 2011 +0100
+++
b/modules/org.openbravo.client.application/src/org/openbravo/client/application/window/OBViewTab.java
Thu Jan 13 10:57:12 2011 +0100
@@ -247,6 +247,7 @@
private String url;
private String propertyName;
private List<Value> labelValues;
+ private boolean autosave;
public ButtonField(Field fld) {
id = fld.getId();
@@ -254,6 +255,7 @@
Column column = fld.getColumn();
propertyName =
KernelUtils.getInstance().getPropertyFromColumn(column).getName();
+ autosave = column.isAutosave();
// Define command
Process process = column.getProcess();
@@ -300,6 +302,10 @@
}
}
+ public boolean isAutosave() {
+ return autosave;
+ }
+
public String getPropertyName() {
return propertyName;
}
diff -r 962238acceaf -r 03998aaa2fc5
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-action-button.js
---
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-action-button.js
Thu Jan 13 10:26:55 2011 +0100
+++
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-action-button.js
Thu Jan 13 10:57:12 2011 +0100
@@ -34,7 +34,24 @@
isc.warn('No record selected');
return;
}
-
+
+ //TODO: Currently autosave is only supported in form view, once it is
supported
+ //in grid, make use of it here.
+ if (this.autosave && theView.viewForm.hasChanged) {
+ var actionObject = {
+ target: this,
+ method: this.doAction,
+ parameters: []
+ };
+ theView.viewForm.autoSave(actionObject);
+ } else {
+ // If no changes, execute action directly
+ this.doAction();
+ }
+ },
+
+ doAction: function(){
+ var theView = this.view;
var popupParams = {
viewId : 'OBPopupClassicWindow',
obManualURL : this.obManualURL,
------------------------------------------------------------------------------
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand
malware threats, the impact they can have on your business, and how you
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits