Sha256: eeb6b1047ab6be42c0310a57e31687ddb3680dd8696ccf9818ba7b4a58637c4e

Contents?: true

Size: 942 Bytes

Versions: 3

Compression:

Stored size: 942 Bytes

Contents

module Comee
  module Core
    class SalesOrderItem < ApplicationRecord
      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 :warehouse_shipment_items
      has_many :item_statuses

      validates :customer_item_no, :delivery_date, presence: true
      validates :quantity, :price, presence: true, numericality: {greater_than: 0}
      validates :quantity_delivered, numericality: {greater_than_or_equal_to: 0}

      def self.ransackable_attributes(_auth_object = nil)
        %w[
          customer_item_no
          customer_order_item_id
          delivery_date
          eb_number
          handover_date
          lead_time
          po_reference
          product_id
          sales_order_id
          source_id
          unit_id
        ]
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
comee_core-0.1.66 app/models/comee/core/sales_order_item.rb
comee_core-0.1.65 app/models/comee/core/sales_order_item.rb
comee_core-0.1.64 app/models/comee/core/sales_order_item.rb