Autocomplete/Info Window doesn't work well with translated tables in non-base language
Description
Environment
Activity
Tested the following workaround for Product Info Window :
Add “LEFT OUTER JOIN M_Product_Trl trl ON (p.M_Product_ID=trl.M_Product_ID AND trl.AD_Language='@#AD_Language@')” to “Sql FROM”
Change “Sql SELECT” of “Name” Column to “Coalesce(trl.Name, p.Name)”
Seems to works fine for both English and Spanish. The downside is you can’t search using the base language Name when your login language is not the base language.
Hi @Carlos Ruiz ,
Yes, it only works if the identifier configuration of the info window match the table’s identifier configuration. “FillIdentifierSeqNo” make this explicit and it is an improvement over what we have now. However, it is probably better if we can just do that filling using the information from the field’s reference configuration (i.e the same info from ad_reference_id and ad_reference_value_id that’s use to construct the display text of the search field). One thing I don’t like about the “FillIdentifierSeqNo” is it add more configuration and the first 2 identifier column is a simple convention that’s well known and have been in practiced for many years (UI wise, it does looks more cohesive that the first two column of your info window is the same as what’s shown as display text for your lookup field (product field in this use case) ).
For searching using translated or base name - I think it is more intuitive if the name use to construct the display text of the search field is same as what’s shown in the info window (Right now, product field show “Azalea (Arbusto)” and you have “Azalea Bush” at info window).
Also, it seems more natural to me that user would search using their login language (Spanish) instead of the base language (English). Perhaps, the workaround here is to just change the base language to Spanish ? Anyway, that’s probably a preference that’s configurable using sysconfig.
Another possibility here is to have the info window show both base and translated name and the code will try both (i.e user can search using either base or translated name).
Regards,
Low
You are right - we have a bigger problem here.
One solution could be to change the Info Product window to show/search using translated product name, but I don’t like that solution. In my experience most multi-language systems have the preference to have the info windows searching/showing the base name, not the translated one, so, the info window as it is now works fine - and if somebody wants a translated one is easy to create a custom one.
So, trying to collect the information about the problem here, we have:
InfoWindow.processQueryValue with some special code where the entered value is split based on the identifier separator (by default underscore) and if there are exactly two parts then the first two columns marked as identifier in the info window are filled, this have some problems:
for this to work the base table (M_Product) must have exactly two identifiers, if somebody wants to configure products to have three identifiers, then this stop working, even in english
also, it is assuming the first two identifiers in the info window are in the exact order of the identifiers of the table
and is also wrongly assuming the info window is using the translated identifier (in the example product name)
another lateral problem is having the identifier separator by default as underscore, this makes it useless for example dealing with TableNames or ColumnNames, but not a big deal as it is SysConfigurable
The same thing happens with the autocomplete, if the product is defined with three identifiers, or if is working in spanish, then the autocomplete functionality is useless at all
For a real definitive and configurable solution, I think we need to add a new column in AD_InfoColumn, something like “FillIdentifierSeqNo” - so, if the info column has this set we fill the identifiers from the splitted value according to that number. For our case of info product it would be just needed to fill the Value info column with FillIdentifierSeqNo=1 - because the Value is first part of the product identifier and it identifies uniquely the product.
On the other hand we have:
InfoGeneralPanel.processQueryValue - this doesn’t even have any code to do the splitting of the value in the text box. So, any table that doesn’t have an info window and have a multi-column identifier is showing this same problem. This is not a big deal I guess because the solution is to create an info window
Same here, the autocomplete is useless for AD_Table - for example try to use autocomplete in Workflow window in spanish (“Flujo de Trabajo”) and try to fill the table field (“Tabla”) - you cannot use the autocomplete with the mouse or with the keyboard at all - it is totally broken in these cases.
Hi @Carlos Ruiz ,
That looks an info window issue to me (not showing the translated product name) and I don’t think the code changes in the PR is the right fix here.
Regards,
Low
Hi @Heng Sin Low
The problem is visible without configuration changes with the test case on last paragraph of the description.
“Similar test case - without AutoComplete ….”
For the solution, yes, it needs GardenWorld to be set “Multilingual Documents” - I think it is wrongly set in the seed database as we have many of the GW data translated to spanish.
Regards,
Carlos Ruiz
Test case:
Login with role GardenWorld Admin in Spanish Language
Open Sales Order window
Create a header and navigate to line
On Product field type Aza
The autocomplete list shows Azalea Bush_Azalea (Arbusto), as this value doesn't match the expected by the product info window, the info window is opened with the field Value filled with Azalea Bush and the field Name filled with Azalea (Arbusto) - that forces the user to clear the Name to search the proper product.
This problem happens with any table that is translated. The issue seems to be closely related to IDEMPIERE-4448, but the case there is a bit different.
The problem seems to be in MLookup.getDirect (line 688 as of today):
builder.append(m_info.QueryDirect);
this is using the query from m_info which shows the translated Name, but the info window doesn't manage translated names, however when the Info window returns, it fills the field with the translated name.
This can be considered too a general problem with the Info Windows as they fill the field with translated name, but when clicking again they cannot find the product:
Similar test case - without AutoComplete:
Login with role GardenWorld Admin in Spanish Language
Open Sales Order window
Create a header and navigate to line
On Product field type Aza
The field will be automatically filled with Azalea Bush_Azalea (Arbusto)
if the user clicks the icon on the product field, the info window is shown without any record and the user is forced to clear the Name field - when working in base language (English) the info window is opened showing the Azalea record properly