Incorrect context variables - onNavigate Callout
Description
Environment
Attachments
- 17 Jun 2015, 09:42 PM
- 17 Jun 2015, 09:23 PM
- 17 Jun 2015, 08:48 PM
- 17 Jun 2015, 06:52 PM
Activity
Carlos Ruiz September 3, 2016 at 2:19 PM
Commit https://bitbucket.org/idempiere/idempiere/commits/b8aef86
To implement my own recommendation above:
> Running read-only callouts (callouts that don't change values, but maybe just load
> context variables) could be safe on completed documents
Hiep Lq July 13, 2016 at 12:23 PM
just for read/write context variable, i see no problem. event handle do in same thread, and you can pass anything with WindowValidatorEvent (gridTab, Grid field,...)
Carlos Ruiz July 12, 2016 at 12:53 PM
Yep, question is for example how to load context variables when you navigate to a record using window event validator? Is that possible with what we have actually?
Hiep Lq July 12, 2016 at 9:53 AM
Hi @Carlos Ruiz, your patch work.
but why you think "I'm not sure if that can be done with window event validator"?
maybe reason callout flexible than event, callout can be done by script but event validator isn't.
Carlos Ruiz May 11, 2016 at 3:36 PM
This would be the patch to implement the latest suggestion (run always callouts on key records):
diff -r ac341a3f58ca org.adempiere.base/src/org/compiere/model/GridTab.java
--- a/org.adempiere.base/src/org/compiere/model/GridTab.java Thu Mar 03 02:41:01 2016 +0700
+++ b/org.adempiere.base/src/org/compiere/model/GridTab.java Wed May 11 08:35:58 2016 -0700
@@ -2826,7 +2826,7 @@
public String processCallout (GridField field)
{
//
- if (isProcessed() && !field.isAlwaysUpdateable()) // only active records
+ if (isProcessed() && !field.isAlwaysUpdateable() && !field.isKey()) // only active records
return ""; // "DocProcessed";
Object value = field.getValue();
Noticed that when you set a context variable to a window, and then you search for another record using the same window, that setted variable (related to previous record) stays there. And it shouldn't.
How to reproduce:
1) Create sales order A (price list X)
2) Create sales order B (price list Z)
1) Open sales order A and add a line with product Elm Tree
2) Go back to main tab, search (toolbar icon) for sales order B and try to add product Elm Tree. Price is incorrect (getting from price list X of sales order A!