Openbravo Issue Tracking System - Openbravo ERP | |||||
View Issue Details | |||||
ID | Project | Category | View Status | Date Submitted | Last Update |
0054399 | Openbravo ERP | 07. Sales management | public | 2024-01-19 14:22 | 2024-01-19 15:07 |
Reporter | sdossantos | ||||
Assigned To | Triage Omni OMS | ||||
Priority | normal | Severity | minor | Reproducibility | always |
Status | new | Resolution | open | ||
Platform | OS | 5 | OS Version | ||
Product Version | pi | ||||
Target Version | Fixed in Version | ||||
Merge Request Status | |||||
Review Assigned To | |||||
OBNetwork customer | |||||
Web browser | |||||
Modules | Core | ||||
Support ticket | |||||
Regression level | |||||
Regression date | |||||
Regression introduced in release | |||||
Regression introduced by commit | |||||
Triggers an Emergency Pack | No | ||||
Summary | 0054399: Issue sales order line POS does not generate delivery note lines | ||||
Description | An order that has a product of type BOM, which when registering the order generates two more lines. When the issue sales order line is made from the POS, the attached error does not appear It is not possible to exploit the lines on the delivery note and when processing the shipment the error occurs. | ||||
Steps To Reproduce | 1 - Do a order with product BOM 2- Try to do issue sales order Nothing | ||||
Proposed Solution | For a new message in this situation: --- a/modules/org.openbravo.retail.posterminal/src/org/openbravo/retail/posterminal/process/IssueSalesOrderLines.java 2024-01-19 12:32:53.271300000 +0100 +++ b/modules/org.openbravo.retail.posterminal/src/org/openbravo/retail/posterminal/process/IssueSalesOrderLines.java 2024-01-19 13:20:23.250272000 +0100 @@ -42,6 +42,7 @@ import org.openbravo.model.common.order.OrderLine; import org.openbravo.model.common.plm.Product; import org.openbravo.model.materialmgmt.transaction.ShipmentInOut; +import org.openbravo.model.materialmgmt.transaction.ShipmentInOutLine; import org.openbravo.retail.posterminal.InvoiceShipmentHook; import org.openbravo.retail.posterminal.JSONProcessSimple; import org.openbravo.service.json.JsonConstants; @@ -77,6 +78,8 @@ .getInstanceFromStaticBeanManager(GoodsShipmentGenerator.class); ShipmentInOut shipment = createNewShipment(orderFromJson); + addExplodeLines(orderFromJson.getString("order"), linesFromJson); + addLinesForIndependentService(orderFromJson.getString("order"), linesFromJson); Set<String> orders = new HashSet<>(); @@ -90,6 +93,7 @@ OBDal.getInstance().flush(); // Persists the shipment document in order to be ready for // further processing ServiceDeliverUtility.deliverServices(shipment); + checkExplodeLines(shipment); shipmentGenerator.processShipment(); final Invoice invoice = shipmentGenerator.invoiceShipmentIfPossible(orderFromJson); @@ -130,6 +134,46 @@ return jsonResponse; } + private void checkExplodeLines(ShipmentInOut shipment) { + for (ShipmentInOutLine shipmentLine : shipment.getMaterialMgmtShipmentInOutLineList()) { + shipmentLine = OBDal.getInstance().get(ShipmentInOutLine.class, shipmentLine.getId()); + shipmentLine.setExplode(shipmentLine.getSalesOrderLine().isExplode()); + } + + } + + private void addExplodeLines(String orderId, JSONArray linesFromJson) throws JSONException { + for (int j = 0; j < linesFromJson.length(); j++) { + JSONObject jsonLine = linesFromJson.getJSONObject(j); + BigDecimal qtyToDeliver = new BigDecimal(jsonLine.getString("toPrepare")); + + OBQuery<OrderLine> productQuery = OBDal.getInstance() + .createQuery(OrderLine.class, " e where e.bOMParent.id=:orderLineId"); + productQuery.setNamedParameter("orderLineId", jsonLine.getString("lineId")); + List<OrderLine> productList = productQuery.list(); + if (productList.size() > 0) { + for (OrderLine orderLine : productList) { + boolean hasPendingDelivery = true; + if (!orderLine.getOrderedQuantity() + .equals(orderLine.getDeliveredQuantity().add(qtyToDeliver))) { + hasPendingDelivery = false; + } + + if (hasPendingDelivery) { + JSONObject json = new JSONObject(); + json.put("lineId", orderLine.getId()); + json.put("orderId", orderLine.getSalesOrder().getId()); + json.put("productId", orderLine.getProduct().getId()); + json.put("qtyOrdered", orderLine.getOrderedQuantity()); + json.put("qtyDelivered", orderLine.getDeliveredQuantity()); + json.put("toPrepare", qtyToDeliver); + linesFromJson.put(json); + } + } + } + } + } + private ShipmentInOut createNewShipment(final JSONObject orderFromJson) throws JSONException { Organization organization = OBDal.getInstance() .getProxy(Organization.class, orderFromJson.getString("organizationId")); | ||||
Additional Information | |||||
Tags | No tags attached. | ||||
Relationships | |||||
Attached Files | IssueSalesOrderLines_1.diff (3,610) 2024-01-19 14:22 https://issues.openbravo.com/file_download.php?file_id=19351&type=bug | ||||
Issue History | |||||
Date Modified | Username | Field | Change | ||
2024-01-19 14:22 | sdossantos | New Issue | |||
2024-01-19 14:22 | sdossantos | Assigned To | => Triage Omni OMS | ||
2024-01-19 14:22 | sdossantos | File Added: IssueSalesOrderLines_1.diff | |||
2024-01-19 14:22 | sdossantos | Modules | => Core | ||
2024-01-19 14:22 | sdossantos | Triggers an Emergency Pack | => No | ||
2024-01-19 14:52 | Practics | Issue Monitored: Practics | |||
2024-01-19 15:07 | ivazquez | Type | feature request => defect |
There are no notes attached to this issue. |