Odoo

Average order value

SQL query for Odoo

Calculate the average order value for a given time period.

SELECT AVG(total_price) AS average_order_value FROM orders WHERE order_date BETWEEN ‘start_date’ AND ‘end_date’

Odoo data model

Odoo
Table Contacts
Id: Integer
Tz: String
Ref: Boolean
Vat: Boolean
Zip: String
City: String
Date: Boolean
Lang: String
Name: String
Type: String
Color: Integer
Debit: Number
Email: String
Phone: String
Title: Boolean
Trust: String
Active: Boolean
Credit: Number
Mobile: Boolean
Self_0: Integer
Self_1: String
Street: String
Barcode: Boolean
Comment: Boolean
Street2: Boolean
Team_id: Boolean
User_id: Boolean
Website: String
Employee: Boolean
Function: Boolean
State_id: Boolean
Form_file: Boolean
Im_status: String
Is_public: Boolean
Ocn_token: Boolean
Parent_id: Boolean
Sale_warn: String
Total_due: Number
Tz_offset: String
Bank_ids_0: Integer
Company_id: Boolean
Country_id: Boolean
Create_uid: Boolean
Is_company: Boolean
Signup_url: String
State_id_0: Integer
State_id_1: String
Task_count: Integer
User_ids_0: Integer
Write_date: Date-time
Child_ids_0: Integer
Create_date: Date-time
Debit_limit: Number
Has_message: Boolean
Industry_id: Boolean
Message_ids: String
Parent_id_0: Integer
Parent_id_1: String
Parent_name: String
Partner_gid: Integer
Signup_type: String
Write_uid_0: Integer
Write_uid_1: String
Company_id_0: Integer
Company_id_1: String
Company_name: Boolean
Company_type: String
Country_code: String
Country_id_0: Integer
Country_id_1: String
Create_uid_0: Integer
Create_uid_1: String
Credit_limit: Number
Display_name: String
Invoice_warn: String
Signup_token: String
Signup_valid: Boolean
__last_update: Date-time
Channel_ids_0: Integer
Channel_ids_1: Integer
Currency_id_0: Integer
Currency_id_1: String
Customer_rank: Integer
Invoice_ids_0: Integer
Invoice_ids_1: Integer
Invoice_ids_2: Integer
Meeting_count: Integer
Message_ids_0: Integer
Message_ids_1: Integer
Message_ids_2: Integer
Partner_share: Boolean
Purchase_warn: String
Sale_warn_msg: Boolean
Supplier_rank: Integer
Total_overdue: Number
Activity_state: Boolean
Employee_ids_0: Integer
Is_blacklisted: Boolean
Message_bounce: Integer
Total_invoiced: Number
Additional_info: Boolean
Contact_address: String
Email_formatted: String
Employees_count: Integer
Followup_status: String
Phone_sanitized: String
Signature_count: Integer
Activity_summary: Boolean
Activity_type_id: Boolean
Activity_user_id: Boolean
Company_registry: Boolean
Email_normalized: String
Followup_line_id: Boolean
Invoice_warn_msg: Boolean
Partner_latitude: Number
Sale_order_count: Integer
Sale_order_ids_0: Integer
Sale_order_ids_1: Integer
Active_lang_count: Integer
Message_has_error: Boolean
Opportunity_count: Integer
Partner_longitude: Number
Phone_blacklisted: Boolean
Purchase_warn_msg: Boolean
Ref_company_ids_0: Integer
Show_credit_limit: Boolean
Signup_expiration: Boolean
Activity_type_icon: Boolean
Bank_account_count: Integer
Followup_line_id_0: Integer
Followup_line_id_1: String
Journal_item_count: Integer
Message_needaction: Boolean
Mobile_blacklisted: Boolean
Message_is_follower: Boolean
Payment_token_count: Integer
Phone_mobile_search: Boolean
Same_vat_partner_id: Boolean
Certifications_count: Integer
Purchase_order_count: Integer
Unpaid_invoice_ids_0: Integer
Message_has_sms_error: Boolean
Message_partner_ids_0: Integer
Unpaid_invoices_count: Integer
Activity_date_deadline: Boolean
Citizen_identification: Boolean
Followup_reminder_type: String
Message_follower_ids_0: Integer
Receipt_reminder_email: Boolean
Supplier_invoice_count: Integer
Unreconciled_aml_ids_0: Integer
Unreconciled_aml_ids_1: Integer
Activity_exception_icon: Boolean
Calendar_last_notif_ack: Date-time
Commercial_company_name: String
Commercial_partner_id_0: Integer
Commercial_partner_id_1: String
Followup_responsible_id: Boolean
Contact_address_complete: String
Has_unreconciled_entries: Boolean
Message_attachment_count: Integer
Property_payment_term_id: Boolean
Use_partner_credit_limit: Boolean
Followup_next_action_date: Boolean
Last_time_entries_checked: Boolean
Message_has_error_counter: Integer
My_activity_date_deadline: Boolean
Activity_calendar_event_id: Boolean
Message_main_attachment_id: Boolean
Message_needaction_counter: Integer
Online_partner_information: Boolean
Phone_sanitized_blacklisted: Boolean
Certifications_company_count: Integer
Property_account_position_id: Boolean
Property_product_pricelist_0: Integer
Property_product_pricelist_1: String
Reminder_date_before_receipt: Integer
Activity_exception_decoration: Boolean
Property_account_payable_id_0: Integer
Property_account_payable_id_1: String
Property_purchase_currency_id: Boolean
Property_account_receivable_id_0: Integer
Property_account_receivable_id_1: String
Same_company_registry_partner_id: Boolean
Property_supplier_payment_term_id: Boolean
Duplicated_bank_account_partners_count: Integer

Odoo
Table Journal
Id: Integer
Name: String
Asset_id: Boolean
Asset_id_0: Integer
Asset_id_1: String
Write_date: Date-time
Amount_total: Number

Odoo
Table Journal Lines
Id: Integer
Name: String
Quantity: Number
Write_date: Date-time
Price_total: Number

Odoo
Table Invoices
Id: Integer
State: String
Quantity: Number
Move_id_0: Integer
Move_id_1: String
Move_type: String
Team_id_0: Integer
Team_id_1: String
Price_total: Number
Account_id_0: Integer
Account_id_1: String
Company_id_0: Integer
Company_id_1: String
Country_id_0: Integer
Country_id_1: String
Display_name: Date-time
Invoice_date: Date-time
Journal_id_0: Integer
Journal_id_1: String
Partner_id_0: Integer
Partner_id_1: String
Product_id_0: Integer
Product_id_1: String
__last_update: Date-time
Payment_state: String
Price_average: Number
Price_subtotal: Number
Invoice_date_due: Date-time
Product_uom_id_0: Integer
Product_uom_id_1: String
Invoice_user_id_0: Integer
Invoice_user_id_1: String
Product_categ_id_0: Integer
Product_categ_id_1: String
Fiscal_position_id_0: Integer
Fiscal_position_id_1: String
Company_currency_id_0: Integer
Company_currency_id_1: String
Commercial_partner_id_0: Integer
Commercial_partner_id_1: String

Odoo
Table Products
Id: Integer
Name: String
Type: String
Color: Integer
Active: Boolean
Volume: Number
Weight: Number
Barcode: Boolean
Sale_ok: Boolean
Priority: String
Sequence: Integer
Uom_id_0: Integer
Uom_id_1: String
Uom_name: String
Image_128: Boolean
Image_256: Boolean
Image_512: Boolean
Categ_id_0: Integer
Categ_id_1: String
Company_id: Boolean
Image_1024: Boolean
Image_1920: Boolean
List_price: Number
Project_id: Boolean
Tax_string: String
Taxes_id_0: Integer
Write_date: Date-time
Create_date: Date-time
Description: Boolean
Has_message: Boolean
Purchase_ok: Boolean
Sales_count: Number
Uom_po_id_0: Integer
Uom_po_id_1: String
Write_uid_0: Integer
Write_uid_1: String
Create_uid_0: Integer
Create_uid_1: String
Default_code: Boolean
Display_name: String
Service_type: String
__last_update: Date-time
Currency_id_0: Integer
Currency_id_1: String
Detailed_type: String
Message_ids_0: Integer
Activity_state: Boolean
Expense_policy: String
Invoice_policy: String
Sale_line_warn: String
Service_policy: String
Standard_price: Number
Product_tooltip: String
Purchase_method: String
Volume_uom_name: String
Weight_uom_name: String
Activity_summary: Boolean
Activity_type_id: Boolean
Activity_user_id: Boolean
Description_sale: Boolean
Planning_enabled: Boolean
Planning_role_id: Boolean
Service_tracking: String
Message_has_error: Boolean
Activity_type_icon: Boolean
Cost_currency_id_0: Integer
Cost_currency_id_1: String
Is_product_variant: Boolean
Message_needaction: Boolean
Purchase_line_warn: String
Sale_line_warn_msg: Boolean
Message_is_follower: Boolean
Project_template_id: Boolean
Service_to_purchase: Boolean
Supplier_taxes_id_0: Integer
Description_purchase: Boolean
Pricelist_item_count: Integer
Product_variant_id_0: Integer
Product_variant_id_1: String
Message_has_sms_error: Boolean
Message_partner_ids_0: Integer
Product_variant_count: Integer
Product_variant_ids_0: Integer
Purchased_product_qty: Number
Activity_date_deadline: Boolean
Message_follower_ids_0: Integer
Purchase_line_warn_msg: Boolean
Visible_expense_policy: Boolean
Activity_exception_icon: Boolean
Can_image_1024_be_zoomed: Boolean
Message_attachment_count: Integer
Visible_qty_configurator: Boolean
Message_has_error_counter: Integer
My_activity_date_deadline: Boolean
Activity_calendar_event_id: Boolean
Message_main_attachment_id: Boolean
Message_needaction_counter: Integer
Property_account_income_id: Boolean
Has_configurable_attributes: Boolean
Property_account_expense_id: Boolean
Activity_exception_decoration: Boolean

Odoo
Table Product Variants
Id: Integer
Code: Boolean
Name: String
Type: String
Color: Integer
Active: Boolean
Volume: Number
Weight: Number
Barcode: Boolean
Sale_ok: Boolean
Priority: String
Sequence: Integer
Uom_id_0: Integer
Uom_id_1: String
Uom_name: String
Image_128: Boolean
Image_256: Boolean
Image_512: Boolean
Lst_price: Number
Categ_id_0: Integer
Categ_id_1: String
Company_id: Boolean
Image_1024: Boolean
Image_1920: Boolean
List_price: Number
Project_id: Boolean
Tax_string: String
Taxes_id_0: Integer
Write_date: Date-time
Create_date: Date-time
Description: Boolean
Has_message: Boolean
Partner_ref: String
Price_extra: Number
Purchase_ok: Boolean
Sales_count: Number
Uom_po_id_0: Integer
Uom_po_id_1: String
Write_uid_0: Integer
Write_uid_1: String
Create_uid_0: Integer
Create_uid_1: String
Default_code: Boolean
Display_name: String
Service_type: String
__last_update: Date-time
Currency_id_0: Integer
Currency_id_1: String
Detailed_type: String
Message_ids_0: Integer
Activity_state: Boolean
Expense_policy: String
Invoice_policy: String
Sale_line_warn: String
Service_policy: String
Standard_price: Number
Product_tooltip: String
Purchase_method: String
Volume_uom_name: String
Weight_uom_name: String
Activity_summary: Boolean
Activity_type_id: Boolean
Activity_user_id: Boolean
Description_sale: Boolean
Planning_enabled: Boolean
Planning_role_id: Boolean
Service_tracking: String
Image_variant_128: Boolean
Image_variant_256: Boolean
Image_variant_512: Boolean
Message_has_error: Boolean
Product_tmpl_id_0: Integer
Product_tmpl_id_1: String
Activity_type_icon: Boolean
Cost_currency_id_0: Integer
Cost_currency_id_1: String
Image_variant_1024: Boolean
Image_variant_1920: Boolean
Is_product_variant: Boolean
Message_needaction: Boolean
Purchase_line_warn: String
Sale_line_warn_msg: Boolean
Combination_indices: String
Message_is_follower: Boolean
Project_template_id: Boolean
Service_to_purchase: Boolean
Supplier_taxes_id_0: Integer
Description_purchase: Boolean
Pricelist_item_count: Integer
Product_variant_id_0: Integer
Product_variant_id_1: String
Message_has_sms_error: Boolean
Message_partner_ids_0: Integer
Product_variant_count: Integer
Product_variant_ids_0: Integer
Purchased_product_qty: Number
Activity_date_deadline: Boolean
Message_follower_ids_0: Integer
Purchase_line_warn_msg: Boolean
Visible_expense_policy: Boolean
Activity_exception_icon: Boolean
Can_image_1024_be_zoomed: Boolean
Message_attachment_count: Integer
Visible_qty_configurator: Boolean
Message_has_error_counter: Integer
My_activity_date_deadline: Boolean
Activity_calendar_event_id: Boolean
Message_main_attachment_id: Boolean
Message_needaction_counter: Integer
Property_account_income_id: Boolean
Has_configurable_attributes: Boolean
Property_account_expense_id: Boolean
Activity_exception_decoration: Boolean
Can_image_variant_1024_be_zoomed: Boolean

Odoo
Table Sales Orders
Id: Integer
Name: String
Note: String
State: String
Origin: Boolean
Medium_id: Boolean
Reference: Boolean
Signature: Boolean
Signed_by: Boolean
Signed_on: Boolean
Source_id: Boolean
Team_id_0: Integer
Team_id_1: String
Type_name: String
User_id_0: Integer
User_id_1: String
Access_url: String
Amount_tax: Number
Date_order: Date-time
Is_expired: Boolean
Project_id: Boolean
Terms_type: String
Write_date: Date-time
Campaign_id: Boolean
Create_date: Date-time
Has_message: Boolean
Tasks_count: Integer
Write_uid_0: Integer
Write_uid_1: String
Access_token: Boolean
Amount_total: Number
Company_id_0: Integer
Company_id_1: String
Country_code: String
Create_uid_0: Integer
Create_uid_1: String
Display_name: String
Order_line_0: Integer
Partner_id_0: Integer
Partner_id_1: String
__last_update: Date-time
Currency_id_0: Integer
Currency_id_1: String
Currency_rate: Number
Expected_date: Date-time
Invoice_count: Integer
Invoice_ids_0: Integer
Message_ids_0: Integer
Message_ids_1: Integer
Message_ids_2: Integer
Project_count: Integer
Validity_date: Boolean
Access_warning: String
Activity_state: Boolean
Amount_untaxed: Number
Invoice_status: String
Opportunity_id: Boolean
Pricelist_id_0: Integer
Pricelist_id_1: String
Commitment_date: Boolean
Milestone_count: Integer
Payment_term_id: Boolean
Require_payment: Boolean
Visible_project: Boolean
Activity_summary: Boolean
Activity_type_id: Boolean
Activity_user_id: Boolean
Client_order_ref: Boolean
Show_update_fpos: Boolean
Tax_country_id_0: Integer
Tax_country_id_1: String
Message_has_error: Boolean
Require_signature: Boolean
Activity_type_icon: Boolean
Message_needaction: Boolean
Amount_undiscounted: Number
Analytic_account_id: Boolean
Message_is_follower: Boolean
Fiscal_position_id_0: Integer
Fiscal_position_id_1: String
Is_product_milestone: Boolean
Partner_invoice_id_0: Integer
Partner_invoice_id_1: String
Purchase_order_count: Integer
Message_has_sms_error: Boolean
Message_partner_ids_0: Integer
Message_partner_ids_1: Integer
Partner_shipping_id_0: Integer
Partner_shipping_id_1: String
Planning_initial_date: Boolean
Show_update_pricelist: Boolean
Activity_date_deadline: Boolean
Message_follower_ids_0: Integer
Message_follower_ids_1: Integer
Partner_credit_warning: String
Planning_hours_planned: Number
Planning_hours_to_plan: Number
Sale_order_template_id: Boolean
Activity_exception_icon: Boolean
Tax_totals_amount_total: Number
Message_attachment_count: Integer
Message_has_error_counter: Integer
My_activity_date_deadline: Boolean
Tax_totals_amount_untaxed: Number
Activity_calendar_event_id: Boolean
Message_main_attachment_id: Boolean
Message_needaction_counter: Integer
Planning_first_sale_line_id: Boolean
Tax_totals_display_tax_base: Boolean
Tax_totals_subtotals_0_name: String
Tax_totals_subtotals_order_0: String
Activity_exception_decoration: Boolean
Tax_totals_subtotals_0_amount: Number
Tax_totals_formatted_amount_total: String
Tax_totals_formatted_amount_untaxed: String
Tax_totals_subtotals_0_formatted_amount: String
Tax_totals_groups_by_subtotal_Untaxed Amount_0_group_key: Integer
Tax_totals_groups_by_subtotal_Untaxed Amount_0_tax_group_id: Integer
Tax_totals_groups_by_subtotal_Untaxed Amount_0_tax_group_name: String
Tax_totals_groups_by_subtotal_Untaxed Amount_0_tax_group_amount: Number
Tax_totals_groups_by_subtotal_Untaxed Amount_0_tax_group_base_amount: Number
Tax_totals_groups_by_subtotal_Untaxed Amount_0_formatted_tax_group_amount: String
Tax_totals_groups_by_subtotal_Untaxed Amount_0_formatted_tax_group_base_amount: String

Odoo
Table Purchase Orders
Id: Integer
Name: String
Notes: Boolean
State: String
Origin: Boolean
Priority: String
User_id_0: Integer
User_id_1: String
Access_url: String
Amount_tax: Number
Date_order: Date-time
Product_id: Boolean
Write_date: Date-time
Create_date: Date-time
Has_message: Boolean
Incoterm_id: Boolean
Partner_ref: Boolean
Write_uid_0: Integer
Write_uid_1: String
Access_token: Boolean
Amount_total: Number
Company_id_0: Integer
Company_id_1: String
Country_code: String
Create_uid_0: Integer
Create_uid_1: String
Date_approve: Boolean
Date_planned: Date-time
Display_name: String
Order_line_0: Integer
Order_line_1: Integer
Partner_id_0: Integer
Partner_id_1: String
Product_id_0: Integer
Product_id_1: String
__last_update: Date-time
Currency_id_0: Integer
Currency_id_1: String
Currency_rate: Number
Invoice_count: Integer
Message_ids_0: Integer
Message_ids_1: Integer
Message_ids_2: Integer
Message_ids_3: Integer
Access_warning: String
Activity_state: Boolean
Amount_untaxed: Number
Invoice_status: String
Dest_address_id: Boolean
Payment_term_id: Boolean
Activity_summary: Boolean
Activity_type_id: Boolean
Activity_user_id: Boolean
Sale_order_count: Integer
Tax_country_id_0: Integer
Tax_country_id_1: String
Message_has_error: Boolean
Activity_type_icon: Boolean
Fiscal_position_id: Boolean
Message_needaction: Boolean
Date_calendar_start: Date-time
Message_is_follower: Boolean
Fiscal_position_id_0: Integer
Fiscal_position_id_1: String
Message_has_sms_error: Boolean
Message_partner_ids_0: Integer
Activity_date_deadline: Boolean
Message_follower_ids_0: Integer
Receipt_reminder_email: Boolean
Activity_exception_icon: Boolean
Mail_reminder_confirmed: Boolean
Tax_totals_amount_total: Number
Mail_reception_confirmed: Boolean
Message_attachment_count: Integer
Message_has_error_counter: Integer
My_activity_date_deadline: Boolean
Tax_totals_amount_untaxed: Number
Activity_calendar_event_id: Boolean
Message_main_attachment_id: Boolean
Message_needaction_counter: Integer
Tax_totals_display_tax_base: Boolean
Tax_totals_subtotals_0_name: String
Reminder_date_before_receipt: Integer
Tax_totals_subtotals_order_0: String
Activity_exception_decoration: Boolean
Tax_totals_subtotals_0_amount: Number
Tax_totals_formatted_amount_total: String
Tax_totals_formatted_amount_untaxed: String
Tax_totals_subtotals_0_formatted_amount: String
Tax_totals_groups_by_subtotal_Untaxed Amount_0_group_key: Integer
Tax_totals_groups_by_subtotal_Untaxed Amount_0_tax_group_id: Integer
Tax_totals_groups_by_subtotal_Untaxed Amount_0_tax_group_name: String
Tax_totals_groups_by_subtotal_Untaxed Amount_0_tax_group_amount: Number
Tax_totals_groups_by_subtotal_Untaxed Amount_0_tax_group_base_amount: Number
Tax_totals_groups_by_subtotal_Untaxed Amount_0_formatted_tax_group_amount: String
Tax_totals_groups_by_subtotal_Untaxed Amount_0_formatted_tax_group_base_amount: String

Odoo
Table Partners

Odoo
Table Payment

Odoo
Table Invoice Lines

Odoo
Table Accounts

Odoo
Table Sales Order Lines

Odoo
Table Purchase Order Lines

Odoo
Table Projects

Odoo
Table Tasks

Odoo
Table Users

Odoo
Table Payment Method Lines

Odoo
Table Statements

Odoo
Table Custom Model Sync

Odoo
Table Project Stages

Use SQL on all your SaaS data

Magical SQL for Odoo with Peliqan.io

Explore data in a rich spreadsheet UI. Use Magical SQL to combine and transform data. SQL queries become new tables that can be shared with business users and used in any BI tool such as Microsoft Power BI, Tableau or Metabase.

Let AI do the work for you

Peliqan’s AI assistant helps you to write SQL queries to get to insights fast. Ask your question in plain English and immediately see the result in Peliqan’s rich spreadsheet viewer.

Peliqan Ask AI willl write your SQL queries from plain English