Fix enterprise fee calculation. The adjustment.source value of the fee is now allowing the inheritance of the tax category from line items

This commit is contained in:
luisramos0
2018-10-02 23:42:22 +01:00
parent 1ce431b671
commit 8a22567291

View File

@@ -20,6 +20,12 @@ module OpenFoodNetwork
def create_enterprise_fee_adjustment(label, target, calculable)
adjustment = enterprise_fee.create_adjustment(label, target, calculable, true)
# This is necessary when source is a line_item
# probably because the association order.adjustments contains "inverse_of :source"
# which overrides the value (the line item) set in calculated_adjustment.create_adjustment
adjustment.source = calculable
adjustment
end
def line_item_adjustment_label