2019-01-13 07:05:54 +01:00
|
|
|
class ArticlePrice < ApplicationRecord
|
2022-02-03 08:37:38 +01:00
|
|
|
include LocalizeInput
|
2017-10-08 12:20:54 +02:00
|
|
|
include PriceCalculation
|
2009-01-29 01:57:51 +01:00
|
|
|
|
2014-06-06 16:34:07 +02:00
|
|
|
# @!attribute price
|
|
|
|
# @return [Number] Net price
|
|
|
|
# @see Article#price
|
|
|
|
# @!attribute tax
|
|
|
|
# @return [Number] VAT percentage
|
|
|
|
# @see Article#tax
|
|
|
|
# @!attribute deposit
|
|
|
|
# @return [Number] Deposit
|
|
|
|
# @see Article#deposit
|
|
|
|
# @!attribute unit_quantity
|
|
|
|
# @return [Number] Number of units in wholesale package (box).
|
|
|
|
# @see Article#unit
|
|
|
|
# @see Article#unit_quantity
|
|
|
|
# @!attribute article
|
|
|
|
# @return [Article] Article this price is about.
|
2009-01-29 01:57:51 +01:00
|
|
|
belongs_to :article
|
2014-06-06 16:34:07 +02:00
|
|
|
# @!attribute order_articles
|
|
|
|
# @return [Array<OrderArticle>] Order articles this price is associated with.
|
2009-01-29 01:57:51 +01:00
|
|
|
has_many :order_articles
|
2010-07-01 16:12:02 +02:00
|
|
|
|
2014-06-06 16:34:07 +02:00
|
|
|
localize_input_of :price, :tax, :deposit
|
|
|
|
|
2010-07-01 16:12:02 +02:00
|
|
|
validates_presence_of :price, :tax, :deposit, :unit_quantity
|
2013-04-08 14:40:02 +02:00
|
|
|
validates_numericality_of :price, :greater_than_or_equal_to => 0
|
|
|
|
validates_numericality_of :unit_quantity, :greater_than => 0
|
2012-12-11 10:59:50 +01:00
|
|
|
validates_numericality_of :deposit, :tax
|
2009-01-29 01:57:51 +01:00
|
|
|
end
|