Sage Models *********** - :doc:`../app-sage` .. tip:: Quotes are imported from Sage using the ``sage.service.import_quotes`` function. Mapping ======= ================================== =========================== KB model Sage ================================== =========================== ``sales_order.models.SalesOrder`` Quote ``crm.models.Ticket`` Quote line ``crm.models.TicketType`` Product, Service and Stock ================================== =========================== ==================== ==================================================================== ``sage.models`` Description ==================== ==================================================================== ``SageAuthState`` Status of connection to Sage (tokens etc) ``SageContact`` Map the Sage contact ID to a ``contact.models.Contact`` ``SageSalesOrder`` Map the Sage quote ID to a ``sales_order.models.SalesOrder`` ``SageSettings`` Default values where information missing on Sage ``SageTicket`` Map a line on a Sage quote to a ``crm.models.Ticket`` ``SageTicketType`` Map Sage products, services and stock to ``crm.models.TicketType`` ==================== ==================================================================== ================================ ======================================================== ``crm.models`` Description ================================ ======================================================== ``SalesOrderTypeDefaultTicket`` Auto-create these tickets when we get a new sales order ================================ ======================================================== ================================ ======================================================== ``sales_order.models`` Description ================================ ======================================================== ``SalesOrderType`` Type of sales order. ================================ ======================================================== Logic ===== Tickets get created in three ways: 1. From the ``quote_lines`` on the Sage import. 2. From the ``SalesOrderTypeDefaultTicket`` when the quote is ``ACCEPTED``. 3. By a scheduled task when a quote is not accepted within 10 days. A ticket **must** have a ``priority`` and *I want it* to have a ``ticket_type``.