app/models/distribution.rb
# Distributions are issued from a single storage location, so we associate
# them so that on-hand amounts can be verified
Distributions are issued from a single storage location, so we associate
them so that on-hand amounts can be verified
Distributions are issued from a single storage location so we associate them so that on - hand amounts can be verified
def copy_from_request(request_id)
    request = Request.find(request_id)
    self.request = request
    self.organization_id = request.organization_id
    self.partner_id = request.partner_id
    self.comment = request.comments
    self.issued_at = Time.zone.today + 1.day
    request.request_items.each do |key, quantity|
      line_items.new(
        quantity: quantity,
        item: Item.joins(:inventory_items).eager_load(:canonical_item).find_by(organization: request.organization, canonical_items: { partner_key: key }),
        itemizable_id: request.id,
        itemizable_type: "Distribution"
      )
    end
  end
def copy_from_request ( request_id ) request = Request . find ( request_id ) self . request = request self . organization_id = request . organization_id self . partner_id = request . partner_id self . comment = request . comments self . issued_at = Time . zone . today + 1 . day request . request_items . each do | key , quantity | line_items . new ( quantity : quantity , item : Item . joins ( :inventory_items ) . eager_load ( :canonical_item ) . find_by ( organization : request . organization , canonical_items : { partner_key : key } ) , itemizable_id : request . id , itemizable_type : "Distribution" ) end end
Distributions are issued from a single storage location, so we associate
them so that on-hand amounts can be verified
Distributions are issued from a single storage location so we associate them so that on - hand amounts can be verified
request_id
<not_specific>