File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -721,7 +721,7 @@ public function canInvoice()
721
721
*/
722
722
public function canCreditmemo ()
723
723
{
724
- if ($ this ->hasForcedCanCreditmemo ()) {
724
+ if ($ this ->hasForcedCanCreditmemo () && $ this -> getData ( ' forced_can_creditmemo ' ) === true ) {
725
725
return $ this ->getForcedCanCreditmemo ();
726
726
}
727
727
Original file line number Diff line number Diff line change @@ -570,6 +570,19 @@ public function testCanNotCreditMemoWithForced()
570
570
$ this ->assertTrue ($ this ->order ->canCreditmemo ());
571
571
}
572
572
573
+ /**
574
+ * Test canCreditMemo when the forced_can_creditmemo flag set to false.
575
+ *
576
+ * @return void
577
+ */
578
+ public function testCanNotCreditMemoWithForcedWhenFlagSetToFalse ()
579
+ {
580
+ $ this ->prepareOrderItem ();
581
+ $ this ->order ->setData ('forced_can_creditmemo ' , false );
582
+ $ this ->order ->setState (Order::STATE_PROCESSING );
583
+ $ this ->assertFalse ($ this ->order ->canCreditmemo ());
584
+ }
585
+
573
586
public function testCanEditIfHasInvoices ()
574
587
{
575
588
$ invoiceCollection = $ this ->getMockBuilder (OrderInvoiceCollection::class)
You can’t perform that action at this time.
0 commit comments