metasfresh / metasfresh-webui-frontend-legacy

metasfresh Webui Frontend
GNU General Public License v2.0
57 stars 35 forks source link

Empties Returns - batch entry cannot add negative qty #2322

Open TheBestPessimist opened 5 years ago

TheBestPessimist commented 5 years ago

Is this a bug or feature request?

bug

What is the current behavior?

Cannot add negative qty in batch entry.

Which are the steps to reproduce?

0000000331

It seems that frontend always sends a second request when pressing enter on the Qty field (before the http://localhost:8080/rest/api/window/540322/1000023/AD_Tab-540779/quickInput/26/complete request).

See the requests log:

curl 'http://localhost:8080/rest/api/window/540322/1000023/AD_Tab-540779/quickInput' -X POST      ;
curl 'http://localhost:8080/rest/api/window/540322/1000023/AD_Tab-540779/quickInput/layout'      ;
curl 'http://localhost:8080/rest/api/window/540322/1000023/AD_Tab-540779/quickInput/26/field/M_HU_PackingMaterial_ID/typeahead?query=e'      ;
curl 'http://localhost:8080/rest/api/window/540322/1000023/AD_Tab-540779/quickInput/26' -X PATCH      -H 'Content-Type: application/json;charset=UTF-8' --data-binary '[{"op":"replace","path":"M_HU_PackingMaterial_ID","value":{"key":"2002708","caption":"Blaue Kiste"}}]' ;
curl 'http://localhost:8080/rest/api/window/540322/1000023/AD_Tab-540779/quickInput/26' -X PATCH      -H 'Content-Type: application/json;charset=UTF-8' --data-binary '[{"op":"replace","path":"Qty","value":"-123"}]' ;
curl 'http://localhost:8080/rest/api/window/540322/1000023/AD_Tab-540779/quickInput/26' -X PATCH      -H 'Content-Type: application/json;charset=UTF-8' --data-binary '[{"op":"replace","path":"Qty","value":"0"}]' ; <- why is this 0? this is the bug
curl 'http://localhost:8080/rest/api/window/540322/1000023/AD_Tab-540779/quickInput/26/complete' -X POST     ;

What is the expected or desired behavior?

Can add products with negative qty.

TheBestPessimist commented 5 years ago

It seems this issue sometimes happens even for positive values:

curl 'https://dev614.metasfresh.com/rest/api/window/540322/1000025/AD_Tab-540779/quickInput/33' -X PATCH            --data-binary '[{"op":"replace","path":"Qty","value":"222"}]' 
    resp: [{"id":"33","fieldsByName":{"Qty":{"field":"Qty","value":222,"widgetType":"Integer","validStatus":{"valid":true,"initialValue":false,"fieldName":"Qty"}}}}]
curl 'https://dev614.metasfresh.com/rest/api/window/540322/1000025/AD_Tab-540779/quickInput/33' -X PATCH            --data-binary '[{"op":"replace","path":"Qty","value":""}]'      <---- wrong
    resp: [{"id":"33","fieldsByName":{"Qty":{"field":"Qty","value":null,"widgetType":"Integer","validStatus":{"valid":false,"initialValue":true,"reason":"Mandatory field Qty not filled","fieldName":"Qty"}}}}]
curl 'https://dev614.metasfresh.com/rest/api/window/540322/1000025/AD_Tab-540779/quickInput/33/complete' -X POST           -H 'Content-Length: 0' 
    resp: {"timestamp":"2019-07-24T15:11:57.084+02:00[Europe/Berlin]","status":500,"error":"Internal Server Error","exception":"org.adempiere.exceptions.AdempiereException","message":"IllegalArgumentException: new or null rowId is not accepted: null","trace":[removed]

What is different here is that the qty here is "" (empty string) whereas the qty in the original issue is "0".

siemiatj commented 5 years ago

Entering negative values is not possible for any of our number fields. Do we want to change that ? @metas-ts @metas-mk