erpcya / adempiere

ADempiere Business Suite ERP/CRM/MFG/SCM/POS done the Bazaar way in an open and unabated fashion. Focus is on the Community that includes Subject Matter Specialists, Implementors and End-Users.
www.adempiere.net
GNU General Public License v2.0
2 stars 5 forks source link

[Bug Report] Comparación incorrecta en los Smart Browsers para Campos de Moneda #45

Open yamelsenih opened 1 year ago

yamelsenih commented 1 year ago

Bug report

Cuando un Smart Browser tiene una columna como C_Currency_ID_To (Que no termina en _ID) hace la comparación como si el campo en fuera String en lugar de numérico. Esto trae como consecuencia un error en la clausula WHERE del Smart Browser al ejecutar la consulta.

===========> WBrowser.getCount: SELECT COUNT(*) FROM  WH_Withholding wh LEFT JOIN WH_Definition whd ON (whd.WH_Definition_ID=wh.WH_Definition_ID) , C_Currency cto  WHERE wh.IsDeclared = 'N' AND wh.IsSimulation = 'N' AND wh.DocStatus IN ('CO','CL')  AND wh.Processed = 'Y' AND wh.SourceInvoice_ID IS NOT NULL AND NOT EXISTS (SELECT 1 FROM C_Invoice i WHERE wh.C_Invoice_ID = i.C_Invoice_ID AND i.DocStatus IN ('CO', 'CL', 'IP', 'IN')) AND wh.C_BPartner_ID=?  AND wh.AD_Org_ID=?  AND wh.IsManual=?  AND wh.C_Currency_ID=?  AND cto.C_Currency_ID=?  AND wh.AD_Client_ID IN (0,1000000) AND (wh.WH_Withholding_ID IS NULL OR wh.WH_Withholding_ID NOT IN ( SELECT Record_ID FROM AD_Private_Access WHERE AD_Table_ID = 54647 AND AD_User_ID <> 1000021 AND IsActive = 'Y' )) AND (cto.C_Currency_ID IS NULL OR cto.C_Currency_ID NOT IN ( SELECT Record_ID FROM AD_Private_Access WHERE AD_Table_ID = 141 AND AD_User_ID <> 1000021 AND IsActive = 'Y' )) [32]
org.postgresql.util.PSQLException: ERROR: operator does not exist: numeric = character varying
  Hint: No operator matches the given name and argument types. You might need to add explicit type casts.
  Position: 508; State=42883; ErrorCode=0
    at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2675)
    at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2365)
    at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:355)
    at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:490)
    at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:408)
    at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:166)
    at org.postgresql.jdbc.PgPreparedStatement.executeQuery(PgPreparedStatement.java:118)
    at com.zaxxer.hikari.pool.ProxyPreparedStatement.executeQuery(ProxyPreparedStatement.java:52)
    at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeQuery(HikariProxyPreparedStatement.java)
    at jdk.internal.reflect.GeneratedMethodAccessor18.invoke(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at org.compiere.db.StatementProxy.invoke(StatementProxy.java:100)
    at com.sun.proxy.$Proxy9.executeQuery(Unknown Source)
    at org.eevolution.grid.Browser.getCount(Browser.java:422)
    at org.eevolution.grid.Browser.testCount(Browser.java:387)
    at org.eevolution.form.WBrowser.executeQuery(WBrowser.java:298)
    at org.eevolution.form.WBrowser.cmd_Search(WBrowser.java:745)
    at org.eevolution.form.WBrowser$7.onEvent(WBrowser.java:535)
    at org.zkoss.zk.ui.impl.EventProcessor.process0(EventProcessor.java:197)
    at org.zkoss.zk.ui.impl.EventProcessor.process(EventProcessor.java:141)

Steps to reproduce

  1. Agregue a un Smart Browser un campo que haga referencia al elemento C_Currency_ID_To
  2. Ejecute el Smart Browser con un valor cómo parámetro de búsqueda
  3. Vea el error

Screenshot or Gif

Link to minimal reproduction

Expected behavior

A clear and concise description of what you expected to happen.

Other relevant information

Additional context

Add any other context about the problem here.