PurchaseOrder (row_processors/purchase_order.rb)

spree · spree/core/app/services/spree/imports/row_processors/purchase_order.rb · ruby · BSD-3-Clause
pos, tag:knn-classified

Processes purchase order rows, creating or updating drafts, validating suppliers, SKUs, and amounts.

# Source: https://github.com/spree/spree | License: BSD-3-Clause | Copyright 2024-present, Vendo Sp. z o.o., Vendo Connect Inc
# Provided via justclaw.it.com; keep this notice with the code.
module Spree
  module Imports
    module RowProcessors
      # One line of a purchase order. The first row carrying a reference opens
      # a draft for it through the same workflow the screen uses; every later
      # row with that reference adds its line. Suppliers, warehouses and SKUs
      # are named, not created: a typo must fail the row, not spawn a record.
      class PurchaseOrder < Base
        QUANTITY_FORMAT = /\A\d+\z/
        AMOUNT_FORMAT = /\A\d+(\.\d+)?\z/

        def initialize(row, **)
          super
          @store = import.store
        end

        attr_reader :store

        

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key