Add ordergroup_name to GroupOrder

This commit is contained in:
Patrick Gansterer 2016-02-25 02:08:04 +01:00 committed by wvengen
parent 9c4d9d5c20
commit b8010fedca
7 changed files with 9 additions and 9 deletions

View file

@ -17,7 +17,7 @@ class OrderByArticles < OrderPdf
rows = [] rows = []
dimrows = [] dimrows = []
for goa in order_article.group_order_articles.ordered for goa in order_article.group_order_articles.ordered
rows << [goa.group_order.ordergroup.name, rows << [goa.group_order.ordergroup_name,
"#{goa.quantity} + #{goa.tolerance}", "#{goa.quantity} + #{goa.tolerance}",
goa.result, goa.result,
number_to_currency(goa.total_price(order_article))] number_to_currency(goa.total_price(order_article))]

View file

@ -62,7 +62,7 @@ class OrderMatrix < OrderPdf
@order.group_orders.includes(:ordergroup).each do |group_order| @order.group_orders.includes(:ordergroup).each do |group_order|
group_result = [group_order.ordergroup.name.truncate(20)] group_result = [group_order.ordergroup_name.truncate(20)]
for order_article in current_order_articles for order_article in current_order_articles
# get the Ordergroup result for this order_article # get the Ordergroup result for this order_article

View file

@ -111,7 +111,7 @@ module OrdersHelper
if group_orders.count == 0 if group_orders.count == 0
return txt return txt
else else
desc = group_orders.includes(:ordergroup).map {|g| g.ordergroup.name}.join(', ') desc = group_orders.includes(:ordergroup).map {|g| g.ordergroup_name}.join(', ')
content_tag(:abbr, txt, title: desc).html_safe content_tag(:abbr, txt, title: desc).html_safe
end end
end end

View file

@ -17,7 +17,7 @@
%tr[group_order_article] %tr[group_order_article]
%td %td
%td{:style=>"width:50%"} %td{:style=>"width:50%"}
= group_order_article.group_order.ordergroup.name = group_order_article.group_order.ordergroup_name
%td.center= group_order_article_edit_result(group_order_article) %td.center= group_order_article_edit_result(group_order_article)
%td.numeric= number_to_currency(group_order_article.order_article.price.fc_price * group_order_article.result) %td.numeric= number_to_currency(group_order_article.order_article.price.fc_price * group_order_article.result)
%td.actions{:style=>"width:1em"} %td.actions{:style=>"width:1em"}

View file

@ -3,7 +3,7 @@
%table.table.table-striped{:style => "width:35em"} %table.table.table-striped{:style => "width:35em"}
- for group_order in @order.group_orders - for group_order in @order.group_orders
%tr{:class => cycle('even', 'odd')} %tr{:class => cycle('even', 'odd')}
%td= group_order.ordergroup.name %td= group_order.ordergroup_name
%td.numeric= number_to_currency(group_order.price) %td.numeric= number_to_currency(group_order.price)
.form-actions .form-actions
= link_to t('.clear'), close_finance_order_path(@order), method: :patch, class: 'btn btn-primary' = link_to t('.clear'), close_finance_order_path(@order), method: :patch, class: 'btn btn-primary'

View file

@ -2,7 +2,7 @@
- if not defined?(heading) or heading - if not defined?(heading) or heading
%tr.list-heading %tr.list-heading
%th{colspan: 9} %th{colspan: 9}
%h4.name= group_order.ordergroup.name %h4.name= group_order.ordergroup_name
- total = 0 - total = 0
- for goa in group_order.group_order_articles.ordered.includes(:order_article) - for goa in group_order.group_order_articles.ordered.includes(:order_article)
- total += goa.total_price - total += goa.total_price

View file

@ -40,8 +40,8 @@ feature 'settling an order', js: true do
expect(page).to have_selector("#group_order_articles_#{oa.id}") expect(page).to have_selector("#group_order_articles_#{oa.id}")
within("#group_order_articles_#{oa.id}") do within("#group_order_articles_#{oa.id}") do
# make sure these ordergroup names are in the list for this product # make sure these ordergroup names are in the list for this product
expect(page).to have_content(go1.ordergroup.name) expect(page).to have_content(go1.ordergroup_name)
expect(page).to have_content(go2.ordergroup.name) expect(page).to have_content(go2.ordergroup_name)
# and that their order results match what we expect # and that their order results match what we expect
expect(page).to have_selector("#r_#{goa1.id}") expect(page).to have_selector("#r_#{goa1.id}")
expect(find("#r_#{goa1.id}").value.to_f).to eq(3) expect(find("#r_#{goa1.id}").value.to_f).to eq(3)