Skip to content

v2.4.7-p1 Magento reorder -1 order numbers #39089

Open
@sgeleon

Description

@sgeleon

Preconditions and environment

  • Magento version - 2.4.7

Steps to reproduce

  1. Open any order
  2. Click reorder
  3. Submit the order

Expected result

The order number is unique 8 digits.

Actual result

The order number is the same 8 digits as the previous order with “-1” added to the end.

Additional information

Early before version 2.4.7, when we recreated an order, you would get a new unique number. In version 2.4.7, you get a number with the postfix '-1' added to the end. This appeared after the bug fix. [Sales] Missing relation data when reorder.

To fix this behavior, I suggest the following:

Index: vendor/magento/module-sales/Model/AdminOrder/Create.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/vendor/magento/module-sales/Model/AdminOrder/Create.php b/vendor/magento/module-sales/Model/AdminOrder/Create.php
--- a/vendor/magento/module-sales/Model/AdminOrder/Create.php	
+++ b/vendor/magento/module-sales/Model/AdminOrder/Create.php	(date 1724315876294)
@@ -2056,10 +2056,13 @@
                 'original_increment_id' => $originalId,
                 'relation_parent_id' => $oldOrder->getId(),
                 'relation_parent_real_id' => $oldOrder->getIncrementId(),
-                'edit_increment' => $oldOrder->getEditIncrement() + 1,
-                'increment_id' => $originalId . '-' . ($oldOrder->getEditIncrement() + 1)
+                'edit_increment' => $oldOrder->getEditIncrement() + 1
             ];
-            $quote->setReservedOrderId($orderData['increment_id']);
+
+            if($this->getSession()->getOrder()->getId()) {
+                $orderData['increment_id'] = $originalId . '-' . ($oldOrder->getEditIncrement() + 1);
+                $quote->setReservedOrderId($orderData['increment_id']);
+            }
         }
 
         return $orderData;

Release note

No response

Triage and priority

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.

Metadata

Metadata

Assignees

Labels

Area: OrderComponent: Order gridIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedPriority: P2A defect with this priority could have functionality issues which are not to expectations.Progress: PR in progressReported on 2.4.7Indicates original Magento version for the Issue report.Reproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branch

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions