Skip to content

Commit 1b01179

Browse files
authored
Merge pull request #3447 from magento-trigger/MAGETWO-96262
[Trigger] Bug fix
2 parents b61b5ce + 0dfe7ff commit 1b01179

File tree

11 files changed

+16
-385
lines changed

11 files changed

+16
-385
lines changed

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

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -547,12 +547,7 @@ public function canCancel()
547547
}
548548
}
549549

550-
$allRefunded = true;
551-
foreach ($this->getAllItems() as $orderItem) {
552-
$allRefunded = $allRefunded && ((float)$orderItem->getQtyRefunded() == (float)$orderItem->getQtyInvoiced());
553-
}
554-
555-
if ($allInvoiced && !$allRefunded) {
550+
if ($allInvoiced) {
556551
return false;
557552
}
558553

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

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

app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminOrderActionGroup.xml

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -94,24 +94,6 @@
9494
<click selector="{{AdminOrderFormItemsSection.addSelected}}" stepKey="clickAddSelectedProducts"/>
9595
</actionGroup>
9696

97-
<!--Add a simple product to order with user defined quantity-->
98-
<actionGroup name="addSimpleProductToOrderWithCustomQuantity">
99-
<arguments>
100-
<argument name="product" defaultValue="_defaultProduct"/>
101-
<argument name="quantity" type="string"/>
102-
</arguments>
103-
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMastToDisappear"/>
104-
<waitForElementVisible selector="{{AdminOrderFormItemsSection.addProducts}}" stepKey="waitForAddProductButton"/>
105-
<click selector="{{AdminOrderFormItemsSection.addProducts}}" stepKey="clickAddProducts"/>
106-
<fillField selector="{{AdminOrderFormItemsSection.skuFilter}}" userInput="{{product.sku}}" stepKey="fillSkuFilter"/>
107-
<click selector="{{AdminOrderFormItemsSection.search}}" stepKey="clickSearch"/>
108-
<scrollTo selector="{{AdminOrderFormItemsSection.rowCheck('1')}}" x="0" y="-100" stepKey="scrollToCheckColumn"/>
109-
<checkOption selector="{{AdminOrderFormItemsSection.rowCheck('1')}}" stepKey="selectProduct"/>
110-
<fillField selector="{{AdminOrderFormItemsSection.rowQty('1')}}" userInput="{{quantity}}" stepKey="fillProductQty"/>
111-
<scrollTo selector="{{AdminOrderFormItemsSection.addSelected}}" x="0" y="-100" stepKey="scrollToAddSelectedButton"/>
112-
<click selector="{{AdminOrderFormItemsSection.addSelected}}" stepKey="clickAddSelectedProducts"/>
113-
</actionGroup>
114-
11597
<!--Add configurable product to order -->
11698
<actionGroup name="addConfigurableProductToOrder">
11799
<arguments>

app/code/Magento/Sales/Test/Mftf/Test/AdminAbleToShipPartiallyInvoicedItemsTest.xml

Lines changed: 0 additions & 168 deletions
This file was deleted.

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -295,14 +295,14 @@ public function getItemQtyVariants()
295295
'qty_ordered' => 12, 'qty_invoiced' => 5, 'qty_refunded' => 5, 'qty_shipped' => 0,
296296
'qty_canceled' => 0,
297297
],
298-
'expectedResult' => ['to_ship' => 12.0, 'to_invoice' => 7.0]
298+
'expectedResult' => ['to_ship' => 7.0, 'to_invoice' => 7.0]
299299
],
300300
'partially_refunded' => [
301301
'options' => [
302302
'qty_ordered' => 12, 'qty_invoiced' => 12, 'qty_refunded' => 5, 'qty_shipped' => 0,
303303
'qty_canceled' => 0,
304304
],
305-
'expectedResult' => ['to_ship' => 12.0, 'to_invoice' => 0.0]
305+
'expectedResult' => ['to_ship' => 7.0, 'to_invoice' => 0.0]
306306
],
307307
'partially_shipped' => [
308308
'options' => [
@@ -316,7 +316,7 @@ public function getItemQtyVariants()
316316
'qty_ordered' => 12, 'qty_invoiced' => 12, 'qty_refunded' => 5, 'qty_shipped' => 4,
317317
'qty_canceled' => 0
318318
],
319-
'expectedResult' => ['to_ship' => 8.0, 'to_invoice' => 0.0]
319+
'expectedResult' => ['to_ship' => 3.0, 'to_invoice' => 0.0]
320320
],
321321
'complete' => [
322322
'options' => [
@@ -337,7 +337,7 @@ public function getItemQtyVariants()
337337
'qty_ordered' => 4.4, 'qty_invoiced' => 0.4, 'qty_refunded' => 0.4, 'qty_shipped' => 4,
338338
'qty_canceled' => 0,
339339
],
340-
'expectedResult' => ['to_ship' => 0.4, 'to_invoice' => 4.0]
340+
'expectedResult' => ['to_ship' => 0.0, 'to_invoice' => 4.0]
341341
],
342342
'completely_invoiced_using_decimals' => [
343343
'options' => [

0 commit comments

Comments
 (0)