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 = []
dimrows = []
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.result,
number_to_currency(goa.total_price(order_article))]

View file

@ -2,7 +2,7 @@
class OrderMatrix < OrderPdf
MAX_ARTICLES_PER_PAGE = 16 # How many order_articles shoud written on a page
def filename
I18n.t('documents.order_matrix.filename', :name => @order.name, :date => @order.ends.to_date) + '.pdf'
end
@ -62,7 +62,7 @@ class OrderMatrix < OrderPdf
@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
# get the Ordergroup result for this order_article

View file

@ -111,7 +111,7 @@ module OrdersHelper
if group_orders.count == 0
return txt
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
end
end

View file

@ -17,7 +17,7 @@
%tr[group_order_article]
%td
%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.numeric= number_to_currency(group_order_article.order_article.price.fc_price * group_order_article.result)
%td.actions{:style=>"width:1em"}

View file

@ -3,7 +3,7 @@
%table.table.table-striped{:style => "width:35em"}
- for group_order in @order.group_orders
%tr{:class => cycle('even', 'odd')}
%td= group_order.ordergroup.name
%td= group_order.ordergroup_name
%td.numeric= number_to_currency(group_order.price)
.form-actions
= 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
%tr.list-heading
%th{colspan: 9}
%h4.name= group_order.ordergroup.name
%h4.name= group_order.ordergroup_name
- total = 0
- for goa in group_order.group_order_articles.ordered.includes(:order_article)
- 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}")
within("#group_order_articles_#{oa.id}") do
# 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(go2.ordergroup.name)
expect(page).to have_content(go1.ordergroup_name)
expect(page).to have_content(go2.ordergroup_name)
# and that their order results match what we expect
expect(page).to have_selector("#r_#{goa1.id}")
expect(find("#r_#{goa1.id}").value.to_f).to eq(3)