IDEMPIERE-5981 Misleading error when completing an auto-produce shipment (#2177)

* IDEMPIERE-5981 Misleading error when completing an auto-produce shipment

* - more robust fix
This commit is contained in:
Carlos Ruiz 2024-01-10 10:16:02 +01:00
parent 0ea6a0352b
commit da16af2a46
1 changed files with 8 additions and 1 deletions

View File

@ -240,7 +240,14 @@ public class AutoProduceEventDelegate extends ModelEventDelegate<MInOut> {
//complete the production //complete the production
ProcessInfo pi = MWorkflow.runDocumentActionWorkflow(production, "CO"); ProcessInfo pi = MWorkflow.runDocumentActionWorkflow(production, "CO");
if (pi.isError()) { if (pi.isError()) {
return production.getProcessMsg(); StringBuilder msgError = new StringBuilder();
if (!Util.isEmpty(pi.getSummary()))
msgError.append(pi.getSummary());
if (!Util.isEmpty(production.getProcessMsg()))
msgError.append(" - " ).append(production.getProcessMsg());
if (msgError.length() == 0) // unlikely to arrive here, but we need to ensure that issues is raised
msgError.append("Error completing auto-produce production");
return msgError.toString();
} }
return null; return null;
} }