Simplifiying balancing view part 2. Lets call it finished.

This commit is contained in:
benni 2012-07-27 18:03:46 +02:00
parent dc0d1b3e46
commit af3c07f031
26 changed files with 185 additions and 219 deletions

View file

@ -18,6 +18,16 @@ class GroupOrderArticle < ActiveRecord::Base
localize_input_of :result
# Setter used in group_order_article#new
# We have to create an group_order, if the ordergroup wasn't involved in the order yet
def ordergroup_id=(id)
self.group_order = GroupOrder.find_or_initialize_by_order_id_and_ordergroup_id(order_article.order_id, id)
end
def ordergroup_id
group_order.try(:ordergroup_id)
end
# Updates the quantity/tolerance for this GroupOrderArticle by updating both GroupOrderArticle properties
# and the associated GroupOrderArticleQuantities chronologically.
#

View file

@ -194,6 +194,12 @@ class Order < ActiveRecord::Base
end
end
# Close the order directly, without automaticly updating ordergroups account balances
def close_direct!(user)
raise "Bestellung wurde schon abgerechnet" if closed?
update_attributes! state: 'closed', updated_by: user
end
protected
def starts_before_ends