Skip to content

Commit cf5dbc6

Browse files
bkasumesh-GL
authored andcommitted
Incorrect qty to ship after few creditmemos
qty_refunded should decrease items qty to ship
1 parent 9a62604 commit cf5dbc6

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

app/code/Magento/Sales/Model/Order/Item.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ public function getQtyToShip()
234234
*/
235235
public function getSimpleQtyToShip()
236236
{
237-
$qty = $this->getQtyOrdered() - max($this->getQtyShipped(), $this->getQtyRefunded()) - $this->getQtyCanceled();
237+
$qty = $this->getQtyOrdered() - $this->getQtyShipped() - $this->getQtyRefunded() - $this->getQtyCanceled();
238238
return max(round($qty, 8), 0);
239239
}
240240

app/code/Magento/Sales/Test/Unit/Model/Order/ItemTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ public static function getItemQtyVariants()
321321
'qty_ordered' => 12, 'qty_invoiced' => 12, 'qty_refunded' => 5, 'qty_shipped' => 4,
322322
'qty_canceled' => 0
323323
],
324-
'expectedResult' => ['to_ship' => 7.0, 'to_invoice' => 0.0]
324+
'expectedResult' => ['to_ship' => 3.0, 'to_invoice' => 0.0]
325325
],
326326
'complete' => [
327327
'options' => [
@@ -339,10 +339,10 @@ public static function getItemQtyVariants()
339339
],
340340
'completely_shipped_using_decimals' => [
341341
'options' => [
342-
'qty_ordered' => 4.4, 'qty_invoiced' => 0.4, 'qty_refunded' => 0.4, 'qty_shipped' => 4,
342+
'qty_ordered' => 4.8, 'qty_invoiced' => 0.4, 'qty_refunded' => 0.4, 'qty_shipped' => 4,
343343
'qty_canceled' => 0,
344344
],
345-
'expectedResult' => ['to_ship' => 0.4, 'to_invoice' => 4.0]
345+
'expectedResult' => ['to_ship' => 0.4, 'to_invoice' => 4.4]
346346
],
347347
'completely_invoiced_using_decimals' => [
348348
'options' => [

0 commit comments

Comments
 (0)