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
|
||||
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)
|
||||
end
|
||||
|
||||
|
||||
def quantity_history
|
||||
stock_changes.reorder('stock_changes.created_at ASC').map{|s| s.quantity}.cumulative_sum
|
||||
end
|
||||
|
|
|
@ -32,22 +32,22 @@
|
|||
%table.table.table-hover#articles
|
||||
%thead
|
||||
%tr
|
||||
%th= t '.article.article'
|
||||
%th= t '.article.stock'
|
||||
%th= t '.article.ordered'
|
||||
%th= t '.article.available'
|
||||
%th= t '.article.unit'
|
||||
%th= t '.article.price'
|
||||
%th= t '.article.vat'
|
||||
%th= t '.article.supplier'
|
||||
%th= t '.article.category'
|
||||
%th= Article.model_name.human
|
||||
%th= heading_helper StockArticle, :quantity
|
||||
%th= heading_helper StockArticle, :quantity_ordered
|
||||
%th= heading_helper StockArticle, :available
|
||||
%th= heading_helper StockArticle, :unit
|
||||
%th= heading_helper StockArticle, :price
|
||||
%th= heading_helper StockArticle, :tax
|
||||
%th= heading_helper StockArticle, :supplier
|
||||
%th= heading_helper StockArticle, :article_category
|
||||
%th
|
||||
%tbody
|
||||
- for article in @stock_articles
|
||||
%tr{:class => stock_article_classes(article), :id => "stockArticle-#{article.id}"}
|
||||
%td= link_to article.name, article
|
||||
%td= article.quantity
|
||||
%td= article.quantity - article.quantity_available
|
||||
%td= article.quantity_ordered
|
||||
%th= article.quantity_available
|
||||
%td= article.unit
|
||||
%td= article.price
|
||||
|
|
|
@ -95,8 +95,10 @@ en:
|
|||
stock_article:
|
||||
available: Available
|
||||
price: Price
|
||||
quantity: In stock
|
||||
quantity_available: Available quantity
|
||||
quantity_available_short: Avail.
|
||||
quantity_ordered: Ordered
|
||||
stock_taking:
|
||||
date: Date
|
||||
note: Note
|
||||
|
@ -1428,16 +1430,6 @@ en:
|
|||
form:
|
||||
price_hint: To avoid choas, it is not possible to edit the prices of already added stock articles until further notice.
|
||||
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?
|
||||
new_delivery: New delivery ...
|
||||
new_stock_article: Add new stock article
|
||||
|
|
Loading…
Reference in a new issue