diff --git a/app/models/article.rb b/app/models/article.rb index 088485f2..e2ab03c2 100644 --- a/app/models/article.rb +++ b/app/models/article.rb @@ -20,7 +20,7 @@ # order_number :string(255) # created_at :datetime # updated_at :datetime -# quantity :decimal(, ) default(0.0) +# quantity :integer default(0) # deleted_at :datetime # type :string(255) # diff --git a/app/models/delivery.rb b/app/models/delivery.rb index bb36a269..2a9a398d 100644 --- a/app/models/delivery.rb +++ b/app/models/delivery.rb @@ -21,7 +21,7 @@ class Delivery < ActiveRecord::Base def stock_change_attributes=(stock_change_attributes) for attributes in stock_change_attributes - stock_changes.build(attributes) unless attributes[:quantity] == 0.0 or attributes[:quantity].blank? + stock_changes.build(attributes) unless attributes[:quantity].to_i == 0 end end diff --git a/app/models/stock_article.rb b/app/models/stock_article.rb index fe5d7aac..5634f348 100644 --- a/app/models/stock_article.rb +++ b/app/models/stock_article.rb @@ -20,7 +20,7 @@ # order_number :string(255) # created_at :datetime # updated_at :datetime -# quantity :decimal(, ) default(0.0) +# quantity :integer default(0) # deleted_at :datetime # type :string(255) # diff --git a/app/models/stock_change.rb b/app/models/stock_change.rb index f1d72f1b..c1ee6eea 100644 --- a/app/models/stock_change.rb +++ b/app/models/stock_change.rb @@ -7,7 +7,7 @@ # delivery_id :integer # order_id :integer # stock_article_id :integer -# quantity :decimal(, ) default(0.0) +# quantity :integer default(0) # created_at :datetime # diff --git a/app/views/deliveries/_new_stock_article.html.haml b/app/views/deliveries/_new_stock_article.html.haml index e969d018..aafc1966 100644 --- a/app/views/deliveries/_new_stock_article.html.haml +++ b/app/views/deliveries/_new_stock_article.html.haml @@ -29,6 +29,6 @@ = form.text_field :deposit %p Kategorie: - = form.select :article_category, ArticleCategory.all(:order => 'name').collect { |c| [c.name, c.id] } + = form.select :article_category_id, ArticleCategory.all(:order => 'name').collect { |c| [c.name, c.id] } %p = submit_tag "Artikel speichern" \ No newline at end of file diff --git a/test/fixtures/article_categories.yml b/test/fixtures/article_categories.yml index 5fed4fc5..6ed49db0 100644 --- a/test/fixtures/article_categories.yml +++ b/test/fixtures/article_categories.yml @@ -14,3 +14,5 @@ fruits: description: fruits and only fruits vegi: name: Vegetables +other: + name: Other stuff diff --git a/test/fixtures/article_prices.yml b/test/fixtures/article_prices.yml index 750badce..24438ee0 100644 --- a/test/fixtures/article_prices.yml +++ b/test/fixtures/article_prices.yml @@ -36,4 +36,11 @@ potatoe1: article: potatoe price: 1.33 tax: 7.0 - unit_quantity: 25 \ No newline at end of file + unit_quantity: 25 + +applejuice1: + article: applejuice + price: 1.15 + tax: 7.0 + unit_quantity: 1 + deposit: 0.15 diff --git a/test/fixtures/articles.yml b/test/fixtures/articles.yml index b670254c..bda63214 100644 --- a/test/fixtures/articles.yml +++ b/test/fixtures/articles.yml @@ -20,7 +20,7 @@ # order_number :string(255) # created_at :datetime # updated_at :datetime -# quantity :decimal(, ) default(0.0) +# quantity :integer default(0) # deleted_at :datetime # type :string(255) # @@ -38,6 +38,7 @@ banana: tax: 7.0 unit_quantity: 18 order_number: 123456 + kiwi: supplier: terra name: Kiwi @@ -49,6 +50,7 @@ kiwi: tax: 7.0 unit_quantity: 10 order_number: 123457 + potatoe: supplier: terra name: Potatoe @@ -60,3 +62,12 @@ potatoe: tax: 7.0 unit_quantity: 25 order_number: 123458 + +applejuice: + type: StockArticle + supplier: terra + name: Apple-juice + article_category: other + unit: 1L + price: 1.33 + tax: 7.0 diff --git a/test/fixtures/stock_changes.yml b/test/fixtures/stock_changes.yml index e1529326..162d4ca9 100644 --- a/test/fixtures/stock_changes.yml +++ b/test/fixtures/stock_changes.yml @@ -7,7 +7,7 @@ # delivery_id :integer # order_id :integer # stock_article_id :integer -# quantity :decimal(, ) default(0.0) +# quantity :integer default(0) # created_at :datetime #