i18n cleanup (affects foodcoops#137)
This commit is contained in:
parent
043607f20d
commit
a475a27f79
3 changed files with 18 additions and 22 deletions
|
@ -14,10 +14,14 @@ class StockArticle < Article
|
||||||
|
|
||||||
# Check for unclosed orders and substract its ordered quantity
|
# Check for unclosed orders and substract its ordered quantity
|
||||||
def quantity_available
|
def quantity_available
|
||||||
quantity - OrderArticle.where(article_id: id).
|
quantity - quantity_ordered
|
||||||
|
end
|
||||||
|
|
||||||
|
def quantity_ordered
|
||||||
|
OrderArticle.where(article_id: id).
|
||||||
joins(:order).where("orders.state = 'open' OR orders.state = 'finished'").sum(:units_to_order)
|
joins(:order).where("orders.state = 'open' OR orders.state = 'finished'").sum(:units_to_order)
|
||||||
end
|
end
|
||||||
|
|
||||||
def quantity_history
|
def quantity_history
|
||||||
stock_changes.reorder('stock_changes.created_at ASC').map{|s| s.quantity}.cumulative_sum
|
stock_changes.reorder('stock_changes.created_at ASC').map{|s| s.quantity}.cumulative_sum
|
||||||
end
|
end
|
||||||
|
|
|
@ -32,22 +32,22 @@
|
||||||
%table.table.table-hover#articles
|
%table.table.table-hover#articles
|
||||||
%thead
|
%thead
|
||||||
%tr
|
%tr
|
||||||
%th= t '.article.article'
|
%th= Article.model_name.human
|
||||||
%th= t '.article.stock'
|
%th= heading_helper StockArticle, :quantity
|
||||||
%th= t '.article.ordered'
|
%th= heading_helper StockArticle, :quantity_ordered
|
||||||
%th= t '.article.available'
|
%th= heading_helper StockArticle, :available
|
||||||
%th= t '.article.unit'
|
%th= heading_helper StockArticle, :unit
|
||||||
%th= t '.article.price'
|
%th= heading_helper StockArticle, :price
|
||||||
%th= t '.article.vat'
|
%th= heading_helper StockArticle, :tax
|
||||||
%th= t '.article.supplier'
|
%th= heading_helper StockArticle, :supplier
|
||||||
%th= t '.article.category'
|
%th= heading_helper StockArticle, :article_category
|
||||||
%th
|
%th
|
||||||
%tbody
|
%tbody
|
||||||
- for article in @stock_articles
|
- for article in @stock_articles
|
||||||
%tr{:class => stock_article_classes(article), :id => "stockArticle-#{article.id}"}
|
%tr{:class => stock_article_classes(article), :id => "stockArticle-#{article.id}"}
|
||||||
%td= link_to article.name, article
|
%td= link_to article.name, article
|
||||||
%td= article.quantity
|
%td= article.quantity
|
||||||
%td= article.quantity - article.quantity_available
|
%td= article.quantity_ordered
|
||||||
%th= article.quantity_available
|
%th= article.quantity_available
|
||||||
%td= article.unit
|
%td= article.unit
|
||||||
%td= article.price
|
%td= article.price
|
||||||
|
|
|
@ -95,8 +95,10 @@ en:
|
||||||
stock_article:
|
stock_article:
|
||||||
available: Available
|
available: Available
|
||||||
price: Price
|
price: Price
|
||||||
|
quantity: In stock
|
||||||
quantity_available: Available quantity
|
quantity_available: Available quantity
|
||||||
quantity_available_short: Avail.
|
quantity_available_short: Avail.
|
||||||
|
quantity_ordered: Ordered
|
||||||
stock_taking:
|
stock_taking:
|
||||||
date: Date
|
date: Date
|
||||||
note: Note
|
note: Note
|
||||||
|
@ -1428,16 +1430,6 @@ en:
|
||||||
form:
|
form:
|
||||||
price_hint: To avoid choas, it is not possible to edit the prices of already added stock articles until further notice.
|
price_hint: To avoid choas, it is not possible to edit the prices of already added stock articles until further notice.
|
||||||
index:
|
index:
|
||||||
article:
|
|
||||||
article: Article
|
|
||||||
available: available
|
|
||||||
category: Category
|
|
||||||
ordered: ordered
|
|
||||||
price: Price
|
|
||||||
stock: In stock
|
|
||||||
supplier: Supplier
|
|
||||||
unit: Unit
|
|
||||||
vat: VAT
|
|
||||||
confirm_delete: Are you sure you want to delete?
|
confirm_delete: Are you sure you want to delete?
|
||||||
new_delivery: New delivery ...
|
new_delivery: New delivery ...
|
||||||
new_stock_article: Add new stock article
|
new_stock_article: Add new stock article
|
||||||
|
|
Loading…
Reference in a new issue