Navigation Menu

Skip to content

Commit

Permalink
MAGETWO-96262: Order with simple product after partial cancellation a…
Browse files Browse the repository at this point in the history
…nd credit memo has status 'Processing'
  • Loading branch information
omiroshnichenko committed Nov 13, 2018
1 parent b61b5ce commit 54139e3
Show file tree
Hide file tree
Showing 11 changed files with 12 additions and 373 deletions.
7 changes: 1 addition & 6 deletions app/code/Magento/Sales/Model/Order.php
Expand Up @@ -547,12 +547,7 @@ public function canCancel()
}
}

$allRefunded = true;
foreach ($this->getAllItems() as $orderItem) {
$allRefunded = $allRefunded && ((float)$orderItem->getQtyRefunded() == (float)$orderItem->getQtyInvoiced());
}

if ($allInvoiced && !$allRefunded) {
if ($allInvoiced) {
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Sales/Model/Order/Item.php
Expand Up @@ -232,7 +232,7 @@ public function getQtyToShip()
*/
public function getSimpleQtyToShip()
{
$qty = $this->getQtyOrdered() - $this->getQtyShipped() - $this->getQtyCanceled();
$qty = $this->getQtyOrdered() - $this->getQtyShipped() - $this->getQtyRefunded() - $this->getQtyCanceled();
return max(round($qty, 8), 0);
}

Expand Down
Expand Up @@ -94,24 +94,6 @@
<click selector="{{AdminOrderFormItemsSection.addSelected}}" stepKey="clickAddSelectedProducts"/>
</actionGroup>

<!--Add a simple product to order with user defined quantity-->
<actionGroup name="addSimpleProductToOrderWithCustomQuantity">
<arguments>
<argument name="product" defaultValue="_defaultProduct"/>
<argument name="quantity" type="string"/>
</arguments>
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMastToDisappear"/>
<waitForElementVisible selector="{{AdminOrderFormItemsSection.addProducts}}" stepKey="waitForAddProductButton"/>
<click selector="{{AdminOrderFormItemsSection.addProducts}}" stepKey="clickAddProducts"/>
<fillField selector="{{AdminOrderFormItemsSection.skuFilter}}" userInput="{{product.sku}}" stepKey="fillSkuFilter"/>
<click selector="{{AdminOrderFormItemsSection.search}}" stepKey="clickSearch"/>
<scrollTo selector="{{AdminOrderFormItemsSection.rowCheck('1')}}" x="0" y="-100" stepKey="scrollToCheckColumn"/>
<checkOption selector="{{AdminOrderFormItemsSection.rowCheck('1')}}" stepKey="selectProduct"/>
<fillField selector="{{AdminOrderFormItemsSection.rowQty('1')}}" userInput="{{quantity}}" stepKey="fillProductQty"/>
<scrollTo selector="{{AdminOrderFormItemsSection.addSelected}}" x="0" y="-100" stepKey="scrollToAddSelectedButton"/>
<click selector="{{AdminOrderFormItemsSection.addSelected}}" stepKey="clickAddSelectedProducts"/>
</actionGroup>

<!--Add configurable product to order -->
<actionGroup name="addConfigurableProductToOrder">
<arguments>
Expand Down

This file was deleted.

8 changes: 4 additions & 4 deletions app/code/Magento/Sales/Test/Unit/Model/Order/ItemTest.php
Expand Up @@ -295,14 +295,14 @@ public function getItemQtyVariants()
'qty_ordered' => 12, 'qty_invoiced' => 5, 'qty_refunded' => 5, 'qty_shipped' => 0,
'qty_canceled' => 0,
],
'expectedResult' => ['to_ship' => 12.0, 'to_invoice' => 7.0]
'expectedResult' => ['to_ship' => 7.0, 'to_invoice' => 7.0]
],
'partially_refunded' => [
'options' => [
'qty_ordered' => 12, 'qty_invoiced' => 12, 'qty_refunded' => 5, 'qty_shipped' => 0,
'qty_canceled' => 0,
],
'expectedResult' => ['to_ship' => 12.0, 'to_invoice' => 0.0]
'expectedResult' => ['to_ship' => 7.0, 'to_invoice' => 0.0]
],
'partially_shipped' => [
'options' => [
Expand All @@ -316,7 +316,7 @@ public function getItemQtyVariants()
'qty_ordered' => 12, 'qty_invoiced' => 12, 'qty_refunded' => 5, 'qty_shipped' => 4,
'qty_canceled' => 0
],
'expectedResult' => ['to_ship' => 8.0, 'to_invoice' => 0.0]
'expectedResult' => ['to_ship' => 3.0, 'to_invoice' => 0.0]
],
'complete' => [
'options' => [
Expand All @@ -337,7 +337,7 @@ public function getItemQtyVariants()
'qty_ordered' => 4.4, 'qty_invoiced' => 0.4, 'qty_refunded' => 0.4, 'qty_shipped' => 4,
'qty_canceled' => 0,
],
'expectedResult' => ['to_ship' => 0.4, 'to_invoice' => 4.0]
'expectedResult' => ['to_ship' => 0.0, 'to_invoice' => 4.0]
],
'completely_invoiced_using_decimals' => [
'options' => [
Expand Down

0 comments on commit 54139e3

Please sign in to comment.