Anonymous | Login
Project:
RSS
  
News | My View | View Issues | Roadmap | Summary

View Issue DetailsJump to Notes ] Issue History ] Print ]
ID
0054399
TypeCategorySeverityReproducibilityDate SubmittedLast Update
defect[Openbravo ERP] 07. Sales managementminoralways2024-01-19 14:222024-01-19 15:07
ReportersdossantosView Statuspublic 
Assigned ToTriage Omni OMS 
PrioritynormalResolutionopenFixed in Version
StatusnewFix in branchFixed in SCM revision
ProjectionnoneETAnoneTarget Version
OSAnyDatabaseAnyJava version
OS VersionDatabase versionAnt version
Product VersionpiSCM revision 
Review Assigned To
Web browser
ModulesCore
Regression level
Regression date
Regression introduced in release
Regression introduced by commit
Triggers an Emergency PackNo
Summary

0054399: Issue sales order line POS does not generate delivery note lines

DescriptionAn 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 Reproduce1 - Do a order with product BOM
2- Try to do issue sales order
Nothing
Proposed SolutionFor 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"));
TagsNo tags attached.
Attached Filesdiff file icon IssueSalesOrderLines_1.diff [^] (3,610 bytes) 2024-01-19 14:22 [Show Content]

- Relationships Relation Graph ] Dependency Graph ]

-  Notes
There are no notes attached to this issue.

- 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
Powered by Mantis Bugtracker