Skip to content

Commit 35128a2

Browse files
author
Mike Weis
committed
MAGETWO-31458: FPT is displayed in invoice totals for partial invoice when product with no FPT is invoiced
- fixed
1 parent 569b0d6 commit 35128a2

File tree

2 files changed

+93
-6
lines changed

2 files changed

+93
-6
lines changed

app/code/Magento/Weee/Model/Total/Invoice/Weee.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public function collect(\Magento\Sales\Model\Order\Invoice $invoice)
5757
$orderItem = $item->getOrderItem();
5858
$orderItemQty = $orderItem->getQtyOrdered();
5959

60-
if (!$orderItemQty || $orderItem->isDummy() || $item->getQty() <= 0) {
60+
if (!$orderItemQty || $orderItem->isDummy() || $item->getQty() < 0) {
6161
continue;
6262
}
6363

app/code/Magento/Weee/Test/Unit/Model/Total/Invoice/WeeeTest.php

Lines changed: 92 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ function ($price, $type) use (&$roundingDelta) {
172172
public function collectDataProvider()
173173
{
174174
$result = [];
175+
175176
// 3 item_1, $100 with $weee, 8.25 tax rate, full invoice
176177
$result['complete_invoice'] = [
177178
'order_data' => [
@@ -269,7 +270,6 @@ public function collectDataProvider()
269270
'base_subtotal' => 300,
270271
'subtotal_incl_tax' => 344.85,
271272
'base_subtotal_incl_tax' => 344.85,
272-
273273
],
274274
],
275275
];
@@ -360,7 +360,6 @@ public function collectDataProvider()
360360
'tax_ratio' => serialize(['weee' => 1.65 / 2.47]),
361361
'weee_tax_applied_row_amount' => 20,
362362
'base_weee_tax_applied_row_amount' => 20,
363-
364363
],
365364
],
366365
'invoice_data' => [
@@ -372,7 +371,6 @@ public function collectDataProvider()
372371
'base_subtotal' => 200,
373372
'subtotal_incl_tax' => 238.15,
374373
'base_subtotal_incl_tax' => 238.15,
375-
376374
],
377375
],
378376
];
@@ -464,7 +462,6 @@ public function collectDataProvider()
464462
'tax_ratio' => serialize(['weee' => 0.82 / 2.47]),
465463
'weee_tax_applied_row_amount' => 10,
466464
'base_weee_tax_applied_row_amount' => 10,
467-
468465
],
469466
],
470467
'invoice_data' => [
@@ -476,7 +473,6 @@ public function collectDataProvider()
476473
'base_subtotal' => 100,
477474
'subtotal_incl_tax' => 119.07,
478475
'base_subtotal_incl_tax' => 119.07,
479-
480476
],
481477
],
482478
];
@@ -580,7 +576,98 @@ public function collectDataProvider()
580576
'base_subtotal' => 100,
581577
'subtotal_incl_tax' => 114.95,
582578
'base_subtotal_incl_tax' => 114.95,
579+
],
580+
],
581+
];
583582

583+
// 3 item_1, $100 with $weee, 8.25 tax rate. Invoicing qty 0.
584+
$result['zero_invoice'] = [
585+
'order_data' => [
586+
'previous_invoices' => [
587+
],
588+
'data_fields' => [
589+
'shipping_tax_amount' => 1.24,
590+
'base_shipping_tax_amount' => 1.24,
591+
'shipping_hidden_tax_amount' => 0,
592+
'base_shipping_hidden_tax_amount' => 0,
593+
'tax_amount' => 16.09,
594+
'tax_invoiced' => 0,
595+
'base_tax_amount' => 16.09,
596+
'base_tax_amount_invoiced' => 0,
597+
'subtotal' => '300',
598+
'base_subtotal' => '300',
599+
],
600+
],
601+
'invoice_data' => [
602+
'items' => [
603+
'item_1' => [
604+
'order_item' => [
605+
'qty_ordered' => 3,
606+
'weee_tax_applied_row_amount' => 30,
607+
'base_weee_tax_applied_row_amnt' => 30,
608+
'row_weee_tax_incl_tax' => 32.47,
609+
'base_row_weee_tax_incl_tax' => 32.47,
610+
'weee_amount_invoiced' => 0,
611+
'base_weee_amount_invoiced' => 0,
612+
'weee_tax_amount_invoiced' => 0,
613+
'base_weee_tax_amount_invoiced' => 0,
614+
'applied_weee' => [
615+
[
616+
'title' => 'recycling_fee',
617+
'base_row_amount' => 30,
618+
'row_amount' => 30,
619+
'base_row_amount_incl_tax' => 32.47,
620+
'row_amount_incl_tax' => 32.47,
621+
],
622+
],
623+
'applied_weee_updated' => [
624+
'base_row_amount_invoiced' => 30,
625+
'row_amount_invoiced' => 30,
626+
'base_tax_amount_invoiced' => 2.47,
627+
'tax_amount_invoiced' => 2.47,
628+
],
629+
'qty_invoiced' => 0,
630+
],
631+
'is_last' => true,
632+
'data_fields' => [
633+
'qty' => 0,
634+
'applied_weee' => [
635+
[
636+
],
637+
],
638+
],
639+
],
640+
],
641+
'is_last' => true,
642+
'include_in_subtotal' => false,
643+
'data_fields' => [
644+
'grand_total' => 181.09,
645+
'base_grand_total' => 181.09,
646+
'subtotal' => 300,
647+
'base_subtotal' => 300,
648+
'subtotal_incl_tax' => 314.85,
649+
'base_subtotal_incl_tax' => 314.85,
650+
'tax_amount' => 16.09,
651+
'base_tax_amount' => 16.09,
652+
],
653+
],
654+
'expected_results' => [
655+
'invoice_items' => [
656+
'item_1' => [
657+
'applied_weee' => [
658+
[
659+
'title' => 'recycling_fee',
660+
'base_row_amount' => 0,
661+
'row_amount' => 0,
662+
'base_row_amount_incl_tax' => 0,
663+
'row_amount_incl_tax' => 0,
664+
],
665+
],
666+
],
667+
],
668+
'invoice_data' => [
669+
'subtotal' => 300,
670+
'base_subtotal' => 300,
584671
],
585672
],
586673
];

0 commit comments

Comments
 (0)