Skip to content
English
  • There are no suggestions because the search field is empty.

How Purchase Order Creation and Lifecycle Works

Source: purchase_orders_controller.rb:16-177, purchase_order_items_controller.rb:12-72

  • Cannot create stock orders for biller vendors -- the error says to create an additional non-biller version of this supplier
  • Repco, Ashdown Ingram, and Prolink vendors do not allow fractional/partial quantities -- only whole numbers are accepted
  • Purchase order number is auto-generated only when the PO passes validation, not at creation time
  • If the update_product flag is "true" on a line item, the product's description, cost, and cost_including_tax are updated from the PO values on processing
  • Received quantity defaults to quantity ordered when creating a new PO
  • PO can only be deleted if it is in "suggested" status AND has no Xero ID; otherwise it must be voided
  • PO cannot be processed if it has no line items or if it is not in "suggested" status
  • Creating a PO from an invoice reuses an existing "suggested" PO for the same vendor rather than creating a new one; exception: HSY quotes always force a new PO
  • PO items cannot be created, updated, or deleted if the PO is not in "suggested" status; PO items with a Xero ID cannot be deleted even if the PO is suggested
  • Transaction logs are created at every major PO lifecycle event (create, update, process, void)
  • PO line item total is calculated as unit_cost * quantity_ordered, rounded to 2 decimal places

Support scenarios

  • "Why can't I create a stock order for this supplier?" → The supplier is flagged as a biller; create a non-biller version of the vendor
  • "Why can't I order partial quantities from Repco?" → Repco/Ashdown Ingram/Prolink integrations only accept whole number quantities
  • "Why can't I delete this purchase order?" → It has been processed or has a Xero ID; use void instead of delete
  • "Why did my order from the invoice get added to an existing purchase order?" → The system reuses existing suggested POs for the same vendor to avoid duplicates