How Booking Line Items Work
Source: event_items_controller.rb, event_item.rb
- Line items inherit company_id and created_by from the current user session automatically
- A line item cannot be deleted if it has been synced to Xero or if the parent event is closed
- Customer-specific pricing uses product.adjusted_cost_for_customer, which may return a different price than the standard product price
- Quantity is rounded to 2 decimal places; the line total (amount) is always recalculated from quantity and unit price on save
- GST on a line item considers both the product's GST-free flag and the customer's tax-free flag — if either is set, no GST is applied
- For labor items, tax group handling excludes any labor-exempt tax rates from the calculation
- Product type and event date are always synced from the parent product record and parent event respectively on every save
- If an invalid mechanic_id is provided, it is silently set to null rather than raising an error
- Adding a labor line item automatically creates an unassigned event time entry for diary scheduling
Support scenarios
- "I can't delete a line item from my booking" → The item has either been synced to Xero (check for a Xero sync indicator) or the booking is no longer OPEN. Xero-synced items cannot be removed.
- "The price on the line item doesn't match the product price" → Customer-specific adjusted pricing may be in effect via product.adjusted_cost_for_customer. Check if this customer has a custom price set for that product.
- "I added a labor item but no one is assigned to it on the diary" → Labor items auto-create an unassigned event time. The mechanic needs to be assigned separately on the diary view.
- "I set a mechanic on the line item but it shows as unassigned" → If the mechanic_id was invalid (e.g., deleted or inactive mechanic), the system silently nullifies it. Check the mechanic record is active.