Sha256: d657858fb6fad491a702bdb30b4b824378f9f103e87969b1058473ae88f5768c
Contents?: true
Size: 1.35 KB
Versions: 1
Compression:
Stored size: 1.35 KB
Contents
module Comee module Core class SalesOrderItem < ApplicationRecord before_save :calculate_total_price enum processing_status: {unprocessed: 0, partially_processed: 1, fully_processed: 2} belongs_to :sales_order belongs_to :customer_order_item belongs_to :product belongs_to :unit belongs_to :source, class_name: "Comee::Core::FulfillmentCenter", optional: true has_many :shipment_items validates :customer_item_no, :customer_item_description, :delivery_date, :processing_status, presence: true validates :quantity, :price, presence: true, numericality: {greater_than: 0} validates :quantity_delivered, numericality: {greater_than_or_equal_to: 0} def calculate_total_price self.total_price = price * quantity end def self.ransackable_attributes(_auth_object = nil) %w[ id customer_item_no customer_item_description customer_order_item_id delivery_date eb_number handover_date lead_time po_reference product_id sales_order_id source_id unit_id processing_status ] end def self.ransackable_associations(_auth_object = nil) %w[customer_order_item product sales_order source unit] end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
comee_core-0.2.35 | app/models/comee/core/sales_order_item.rb |