Update ordergroup values after deleting an ordered article. Closes #11
* TODO: Implement callbacks to avoid such mistakes.
This commit is contained in:
parent
8b8a7c08cd
commit
8bfa83118c
1 changed files with 3 additions and 0 deletions
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue