Openbravo Issue Tracking System - Modules
View Issue Details
0053273ModulesDistribution Orderspublic2023-08-23 09:462023-08-23 19:35
dmiguelez 
AtulOpenbravo 
normalminoralways
closedfixed 
5
 
 
0053273: Improve the error message in the DO import API
When importing a an existing DO through the API with lines that is not in draft status it fails correctly, but the error message does not give information about the document number and line number. It is important because several documents can be imported in a batch.
Import a DO trough the API using the provided json.
Import it a second time, then it fails with this error message: "Error while importing an item: Not possible to add new lines to an existing document!!!" and should be "Error while importing an item: Not possible to add new lines to an existing document!!! DocumentNo: 9999999999"

[
  {
    "documentNo": "9999999999",
    "organization": "US",
    "isIssue": false,
    "warehouseIssue": "WC",
    "warehouseReceipt": "EC",
    "orderDate": "2022-06-05",
    "scheduledDeliveryDate": "2022-06-10",
    "lines": [
      {
        "product": "CH_CAMEMBERT_CHEESE",
        "operativeQuantity": 2,
        "qtyIssued": 2,
        "qtyReceived": 2
      },
      {
        "product": "CH_MANCHEGO_CHEESE",
        "operativeQuantity": 1,
        "qtyIssued": 1,
        "qtyReceived": 1
      }
    ]
  }
]


How to import:
As AWO QA Admin client, enable the Web Services for AWO QA Admin Role in the role window and use the swagger URL to import the previous data.
diff --git a/src/org/openbravo/distributionorder/api/hook/distributionorderline/ImportDOLineBaseOBObjectFetcher.java b/src/org/openbravo/distributionorder/api/hook/distributionorderline/ImportDOLineBaseOBObjectFetcher.java
index 10eec75..cfcef47 100644
--- a/src/org/openbravo/distributionorder/api/hook/distributionorderline/ImportDOLineBaseOBObjectFetcher.java
+++ b/src/org/openbravo/distributionorder/api/hook/distributionorderline/ImportDOLineBaseOBObjectFetcher.java
@@ -79,7 +79,11 @@ public class ImportDOLineBaseOBObjectFetcher implements ImportedBaseOBObjectFetc
       }
       if (distOrderLine == null
           && !distOrd.getDocumentStatus().equalsIgnoreCase(ImportDOUtils.DRAFT_STATUS)) {
- throw new OBException("Not possible to add new lines to an existing document!!!");
+ throw new OBException(String.format(
+ "Not possible to add new lines to an existing document!!! DocumentNo: %s and LineNo: %s",
+ distOrd.getDocumentNo(),
+ properties.containsKey("lineNo") ? (String) properties.get("lineNo")
+ : "has not been provided in the import data"));
       }
       return (T) distOrderLine;
     } else {
No tags attached.
png screenshot of developed.png (135,502) 2023-08-23 19:35
https://issues.openbravo.com/file_download.php?file_id=18904&type=bug
png
Issue History
2023-08-23 09:46dmiguelezNew Issue
2023-08-23 09:46dmiguelezAssigned To => Triage Omni WMS
2023-08-23 09:46dmiguelezProposed Solution updated
2023-08-23 13:02mtaalAssigned ToTriage Omni WMS => AtulOpenbravo
2023-08-23 13:05AtulOpenbravoStatusnew => scheduled
2023-08-23 17:47hgbotNote Added: 0153856
2023-08-23 19:35hgbotResolutionopen => fixed
2023-08-23 19:35hgbotStatusscheduled => closed
2023-08-23 19:35hgbotNote Added: 0153857
2023-08-23 19:35hgbotNote Added: 0153858
2023-08-23 19:35mtaalFile Added: screenshot of developed.png

Notes
(0153856)
hgbot   
2023-08-23 17:47   
Merge Request created: https://gitlab.com/openbravo/product/pmods/org.openbravo.distributionorder.api/-/merge_requests/22 [^]
(0153857)
hgbot   
2023-08-23 19:35   
Directly closing issue as related merge request is already approved.

Repository: https://gitlab.com/openbravo/product/pmods/org.openbravo.distributionorder.api [^]
Changeset: 81cc5ca905320e079a8663e1a147041f2c0ef81a
Author: Atul Gaware <atul.gaware@openbravo.com>
Date: 23-08-2023 17:35:00
URL: https://gitlab.com/openbravo/product/pmods/org.openbravo.distributionorder.api/-/commit/81cc5ca905320e079a8663e1a147041f2c0ef81a [^]

Fixes BUG-0053273: Improve the error message in the DO import API

---
M src/org/openbravo/distributionorder/api/hook/distributionorderline/ImportDOLineBaseOBObjectFetcher.java
---
(0153858)
hgbot   
2023-08-23 19:35   
Merge request merged: https://gitlab.com/openbravo/product/pmods/org.openbravo.distributionorder.api/-/merge_requests/22 [^]