Refactor methods for updating closed adjustments

This commit is contained in:
Matt-Yorkley
2021-01-29 17:58:49 +00:00
parent b2b6d3ab87
commit 58c7c90624
2 changed files with 3 additions and 6 deletions

View File

@@ -106,8 +106,8 @@ module Spree
# more than on line items at once via accepted_nested_attributes the order
# object on the association would be in a old state and therefore the
# adjustment calculations would not performed on proper values
def update!(calculable = nil)
return if immutable?
def update!(calculable = nil, force: false)
return if immutable? && !force
# Fix for Spree issue #3381
# If we attempt to call 'source' before the reload, then source is currently

View File

@@ -857,11 +857,8 @@ module Spree
def update_adjustment!(adjustment)
return if adjustment.finalized?
state = adjustment.state
adjustment.state = 'open'
adjustment.update!
adjustment.update!(force: true)
update!
adjustment.state = state
end
# object_params sets the payment amount to the order total, but it does this