How Trade-In and Vehicle Sale Line Items Work
Source: invoice_item.rb:182-193, invoice_item.rb:254-258, invoice.rb:1046-1061
- Trade-in product cost is forced to zero (unit_cost and cost_including_tax both set to 0)
- Trade-in value must be negative on invoices (unit_price <= 0) and positive on credits (unit_price >= 0)
- Quantity must be exactly 1 for both trade-in and vehicle sale products
- Acquisition product cannot be used on sales invoices -- error directs users to use the trade-in product instead
- Invoice auto-detects trade-in and vehicle sale products by matching against the company's configured trade_in_product_id and vehicle_sale_product_id; sets contains_trade_in / contains_vehicle_sale flags
- GST-free flag is inherited from the product, but overridden to true if a vehicle_sale_id or vehicle_trade_in_id is present and the customer is tax-free
- An invoice containing only a trade-in product cannot be processed as an invoice -- must be issued as a credit instead
Support scenarios
- "Why does it say the trade-in value should be negative?" -> on invoices, trade-in values reduce the total so must be negative; on credits they must be positive
- "Why is the cost zero on the trade-in item?" -> trade-in product cost is always forced to zero by the system
- "I have a trade-in only invoice and it won't process" -> single trade-in invoices must be issued as credits; change the type to credit
- "Why can't I use the acquisition product on this invoice?" -> acquisition products are for supplier invoices only; use the trade-in product for customer invoices