How are order discounts transfered to invoice and creditmemo?
-
12-12-2019 - |
Question
I want to copy some attributes from order to invoice and creditmemo, but adjust them dependent on the discount_amount
attribute of the target.
I wrote an observer for core_copy_fieldset_sales_convert_order_to_invoice
and core_copy_fieldset_sales_convert_order_to_cm
but at this point, the value is not set yet. I also could not find any corresponding fieldset configuration in Mage/Sales/etc/config.xml
.
So my question is: Where does Magento set these values when it converts orders? And do I need to fall back to sales_invoice_save_before
and sales_creditmemo_save_before
events or is there a better way?
Solution
Discount Amount would come from Mage_Sales_Model_Order_Invoice_Total_Discount
but there are not many events around so the ones you mentioned might be the best avenue.