Test case:
Open Tax Rate Parent window:
WRONG -> The "GST/PST" parent tax is shown WITHOUT DETAILS
Search all taxes:
RIGHT -> The "GST/PST" is shown - and the two details are shown
Search taxes on the detail tab:
WRONG -> no taxes are found.
POSSIBLE CAUSE:
This window is special in that master and detail tabs are based on the same C_Tax table.
The tax children tab on this window has this WhereClause condition:
C_Tax.IsSummary='N' AND C_Tax.Parent_Tax_ID=@C_Tax_ID@
@C_Tax_ID@ is intended to take the value of the parent tab, although as the children tab has the same column then the variable is filled unproperly.
Regards,
Carlos Ruiz
ANALYSIS:
The fields of the where clause are replaced by values in the context. The context keys have the form: <WindowNo>|<ColumnName>
So there is no separation of same column names in different tabs in one window. So the context value of C_Tax_ID is overwritten by the main tab or the detail tab depending on who came last. One easy way to see it, is to click on the refresh button of the main toolbar and then of the detail toolbar and on the main and on the detail... The details appear and disappear and appear. and disappear....
SOLUTION:
There is a simple solution (see patch for GridField.java class). I just set an additional context value which also includes the TabNo. The key has the format <WindowNo>|<TabNo>|<ColumnName>. Since I do it additional to the old value there is no breaking of the old functionality. Now you could also specify the TabNo from where you want to reference the column name in the where clause.
Because of the format of the context key there is no need to change the Env.parseContext function. Just enter for the WhereClause:
C_Tax.IsSummary='N' AND C_Tax.Parent_Tax_ID=@0|C_Tax_ID@
and everything works as it should.
-Kai
Oh I forgot:
DISADVANTAGE:
Every column is now twice in the context. So the context growth noteworthy in general to cover this single case. An idea would be to have it as an option for the window in the AD.
Kai, we commonly use "Remind" resolution for things with proposed solutions pending to review.
About your patch, you're right, the context is duplicated (window context + tab context now).
At least for this patch this could be solved simply adding the primary key to the context. But I think this is useful also for "Processed" and "IsActive" fields. Many times I've seen customized windows (and not customized also) working unproperly because they take the "Processed" value from the master tab instead of the detail tab. Your proposed solution can solve also this problem.
So, being conservative I think we could add to Tab Context the fields KeyColumn (key column of the table on the tab), Processed and IsActive.
WDYT?
Regards,
Carlos Ruiz
Carlos,
Sorry for using the wrong resolution. I will keep it in mind for the next bug day. :-)
Yes, limiting it to some specific columns could solve the growth problem. This seems to be a good and easy compromise. The question is, if there are some cases where it would be helpful to have it for other fields. I guess than it had to be configurable (on the field level in the AD?).
However, we maybe could start with your suggested fields and see if it comes up for other.
Regards,
Kai
Hi Kai!
I test your patch and I see that are work rightly, thank very much
It solve have other indirect issue
https://sourceforge.net/tracker/index.php?func=detail&aid=2904737&group_id=176962&atid=879332
Revision: 11015
http://adempiere.svn.sourceforge.net/adempiere/?rev=11015&view=rev
Author: vpj-cd
Date: 2009-11-30 16:28:43 +0000 (Mon, 30 Nov 2009)
Log Message:
-----------
Tax Rate Parent window not working
https://sourceforge.net/tracker/index.php?func=detail&aid=2871039&group_id=176962&atid=879332
Modified Paths:
--------------
trunk/base/src/org/compiere/model/GridField.java
kind regards
Victor Perez
www.e-evolution.com
Revision: 11016
http://adempiere.svn.sourceforge.net/adempiere/?rev=11016&view=rev
Author: vpj-cd
Date: 2009-11-30 17:02:40 +0000 (Mon, 30 Nov 2009)
Log Message:
-----------
Tax Rate Parent window not working
https://sourceforge.net/tracker/?func=detail&atid=879332&aid=2871039&group_id=176962
kind regards
Victor Perez
www.e-evolution.com
Víctor, did you conduct tests before committing?
Opening "Tax Rate Parent" window now throws this error in console and doesn't show any record:
-----------> GridTable.createSelectSql: Failed to parse where clause. whereClause=(IsSummary='Y' AND C_Tax.Parent_Tax_ID=@0|C_Tax_ID@) [14]
_________
Carlos Ruiz
Reviewed thoroughly this issue.
Kai's fix is solving some other problems in other windows - so, I think it's ok to keep it.
Window Tax Rate Parent is having a problem because it has the same table (different records) maintained in different tabs (a circular reference). As it's seem today Adempiere is not supporting such circular references in one single window.
I would vote to drop this window - the functionality is duplicated - Tax can be maintained without problems in "Tax Rate" window - so this "Tax Rate Parent" window is not adding anything to Adempiere - instead it's adding a window that is not working - I did a lots of test and couldn't make it work (because of the circular reference problem described) - I think Adempiere would need some deeper changes to make it work.
My vote -> drop this window.
What do you think?
Regards,
Carlos Ruiz
I do work with this window.
So I am against dropping.
Regards
Susanne
Thanks Susan, I guess you work with this window in your own repository - because currently is totally broken on trunk.
Now, the third and fourth tab are broken - so maybe it will be simple just to drop those two tabs.
WDYT?
BTW - if you have a working window - maybe you could share with us how is it working - because in trunk at this moment is totally useless - it's dropping a bug in console. So, you're voting to preserve which window?
Regards,
Carlos Ruiz
Committed revision 11056.
ttp://adempiere.svn.sourceforge.net/adempiere/?rev=11056&view=rev
Extending Kai's approach to cover timestamp and boolean variables.
Regards,
Carlos Ruiz
Message:
Revision: 11052
http://adempiere.svn.sourceforge.net/adempiere/?rev=11052&view=rev
Author: vpj-cd
Date: 2009-12-07 23:19:10 +0000 (Mon, 07 Dec 2009)
Log Message:
-----------
Tax Rate Parent window not working
https://sourceforge.net/tracker/index.php?func=detail&aid=2871039&group_id=176962&atid=879332
The incorrect tab level was fixed, other big issues was detected with the
Adempiere context, So I open other tracker to attending and fix this
issue.
https://sourceforge.net/tracker/?func=detail&aid=2910368&group_id=176962&atid=879332
https://sourceforge.net/tracker/?func=detail&aid=2910358&group_id=176962&atid=879332
kind regards
Victor Perez
www.e-evolution.com
Peer reviewed with revision 11077.
http://adempiere.svn.sourceforge.net/adempiere/?rev=11077&view=rev
Regards,
Carlos Ruiz
This Tracker item was closed automatically by the system. It was
previously set to a Pending status, and the original submitter
did not respond within 14 days (the time period specified by
the administrator of this Tracker).