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()
721721 */
722722 public function canCreditmemo ()
723723 {
724- if ($ this ->hasForcedCanCreditmemo ()) {
724+ if ($ this ->hasForcedCanCreditmemo () && $ this -> getData ( ' forced_can_creditmemo ' ) === true ) {
725725 return $ this ->getForcedCanCreditmemo ();
726726 }
727727
Original file line number Diff line number Diff line change @@ -570,6 +570,19 @@ public function testCanNotCreditMemoWithForced()
570570 $ this ->assertTrue ($ this ->order ->canCreditmemo ());
571571 }
572572
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+
573586 public function testCanEditIfHasInvoices ()
574587 {
575588 $ invoiceCollection = $ this ->getMockBuilder (OrderInvoiceCollection::class)
You can’t perform that action at this time.
0 commit comments