Update ordergroup values after deleting an ordered article. Closes #11

* TODO: Implement callbacks to avoid such mistakes.
This commit is contained in:
Benjamin Meichsner 2009-05-13 13:04:39 +02:00
parent 8b8a7c08cd
commit 8bfa83118c

View file

@ -145,6 +145,9 @@ class Finance::BalancingController < ApplicationController
def destroy_order_article def destroy_order_article
order_article = OrderArticle.find(params[:id]) order_article = OrderArticle.find(params[:id])
order_article.destroy order_article.destroy
# Updates ordergroup values
order_article.group_order_articles.each { |goa| goa.group_order.update_price! }
render :update do |page| render :update do |page|
page["order_article_#{order_article.id}"].remove page["order_article_#{order_article.id}"].remove
page["group_order_articles_#{order_article.id}"].remove page["group_order_articles_#{order_article.id}"].remove