Project:
View Issue Details[ Jump to Notes ] | [ Issue History ] [ Print ] | |||||||||||
ID | ||||||||||||
0054399 | ||||||||||||
Type | Category | Severity | Reproducibility | Date Submitted | Last Update | |||||||
defect | [Openbravo ERP] 07. Sales management | minor | always | 2024-01-19 14:22 | 2024-01-19 15:07 | |||||||
Reporter | sdossantos | View Status | public | |||||||||
Assigned To | Triage Omni OMS | |||||||||||
Priority | normal | Resolution | open | Fixed in Version | ||||||||
Status | new | Fix in branch | Fixed in SCM revision | |||||||||
Projection | none | ETA | none | Target Version | ||||||||
OS | Any | Database | Any | Java version | ||||||||
OS Version | Database version | Ant version | ||||||||||
Product Version | pi | SCM revision | ||||||||||
Review Assigned To | ||||||||||||
Web browser | ||||||||||||
Modules | Core | |||||||||||
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")); | |||||||||||
Tags | No tags attached. | |||||||||||
Attached Files | IssueSalesOrderLines_1.diff [^] (3,610 bytes) 2024-01-19 14:22 [Show Content] | |||||||||||
Relationships [ Relation Graph ] [ Dependency Graph ] | |
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 |
Copyright © 2000 - 2009 MantisBT Group |