How are the methods setAdjustmentPositive(), getAdjustmentPositive(), setAdjustmentNegative(), getAdjustmentNegative() of the \Magento\Sales\Model\Order\Creditmemo class used?

Implementation

setAdjustmentPositive()

Bug: the setAdjustmentPositive() and setAdjustmentNegative() methods of the \Magento\Sales\Model\Order\Creditmemo class wrongly use the \Magento\Sales\Model\Order's getGrandTotal() method instead of the getBaseGrandTotal() when an adjusment is in percent, so it lead to a wrong calculation result

https://github.com/magento/magento2/blob/8fd3e8/app/code/Magento/Sales/Model/Order/Creditmemo.php#L489-L507

setAdjustmentNegative()

Bug: the setAdjustmentPositive() and setAdjustmentNegative() methods of the \Magento\Sales\Model\Order\Creditmemo class wrongly use the \Magento\Sales\Model\Order's getGrandTotal() method instead of the getBaseGrandTotal() when an adjusment is in percent, so it lead to a wrong calculation result

https://github.com/magento/magento2/blob/2.1.5/app/code/Magento/Sales/Model/Order/Creditmemo.php#L508-L526

getAdjustmentPositive()

https://github.com/magento/magento2/blob/2.1.5/app/code/Magento/Sales/Api/Data/CreditmemoInterface.php#L32-L35

https://github.com/magento/magento2/blob/2.1.5/app/code/Magento/Sales/Model/Order/Creditmemo.php#L707-L715

getAdjustmentNegative()

https://github.com/magento/magento2/blob/2.1.5/app/code/Magento/Sales/Api/Data/CreditmemoInterface.php#L72-L75

https://github.com/magento/magento2/blob/2.1.5/app/code/Magento/Sales/Model/Order/Creditmemo.php#L697-L705

Usage

1. On a credit memo creation

https://github.com/magento/magento2/blob/2.1.5/app/code/Magento/Sales/Controller/Adminhtml/Order/Creditmemo/Save.php#L54-L63

https://github.com/magento/magento2/blob/2.1.5/app/code/Magento/Sales/Controller/Adminhtml/Order/Creditmemo/Save.php#L75-L75


https://github.com/magento/magento2/blob/2.1.5/app/code/Magento/Sales/Controller/Adminhtml/Order/CreditmemoLoader.php#L209-L209


https://github.com/magento/magento2/blob/2.1.5/app/code/Magento/Sales/Model/Order/CreditmemoFactory.php#L155-L155


https://github.com/magento/magento2/blob/2.1.5/app/code/Magento/Sales/Model/Order/CreditmemoFactory.php#L241-L246

2

https://github.com/magento/magento2/blob/2.1.5/app/code/Magento/Sales/Block/Adminhtml/Order/Creditmemo/Totals.php#L58-L78

3

https://github.com/magento/magento2/blob/2.1.5/app/code/Magento/Sales/Model/Order/Creditmemo/Total/Grand.php#L14-L34

4

https://github.com/magento/magento2/blob/2.1.5/app/code/Magento/Sales/Model/ResourceModel/Order/Creditmemo/Relation/Refund.php#L68-L74

https://github.com/magento/magento2/blob/2.1.5/app/code/Magento/Sales/Model/ResourceModel/Order/Creditmemo/Relation/Refund.php#L106-L114

See also: