Skip to main content

Peliqan

Odoo

Total sales amount by product

SQL query for Odoo

Calculate the total sales amount for each product.

SELECT products.name, SUM(sales_order_lines.quantity * sales_order_lines.price_unit) AS total_sales_amount FROM sales_order_lines JOIN products ON sales_order_lines.product_id = products.id GROUP BY products.name

Odoo data model

Odoo
Contacts

View 186 columns
IdInteger
TzString
RefBoolean
VatBoolean
ZipString
CityString
DateBoolean
LangString
NameString
TypeString
ColorInteger
DebitNumber
EmailString
PhoneString
TitleBoolean
TrustString
ActiveBoolean
CreditNumber
MobileBoolean
Self_0Integer
Self_1String
StreetString
BarcodeBoolean
CommentBoolean
Street2Boolean
Team_idBoolean
User_idBoolean
WebsiteString
EmployeeBoolean
FunctionBoolean
State_idBoolean
Form_fileBoolean
Im_statusString
Is_publicBoolean
Ocn_tokenBoolean
Parent_idBoolean
Sale_warnString
Total_dueNumber
Tz_offsetString
Bank_ids_0Integer
Company_idBoolean
Country_idBoolean
Create_uidBoolean
Is_companyBoolean
Signup_urlString
State_id_0Integer
State_id_1String
Task_countInteger
User_ids_0Integer
Write_dateDate-time
Child_ids_0Integer
Create_dateDate-time
Debit_limitNumber
Has_messageBoolean
Industry_idBoolean
Message_idsString
Parent_id_0Integer
Parent_id_1String
Parent_nameString
Partner_gidInteger
Signup_typeString
Write_uid_0Integer
Write_uid_1String
Company_id_0Integer
Company_id_1String
Company_nameBoolean
Company_typeString
Country_codeString
Country_id_0Integer
Country_id_1String
Create_uid_0Integer
Create_uid_1String
Credit_limitNumber
Display_nameString
Invoice_warnString
Signup_tokenString
Signup_validBoolean
__last_updateDate-time
Channel_ids_0Integer
Channel_ids_1Integer
Currency_id_0Integer
Currency_id_1String
Customer_rankInteger
Invoice_ids_0Integer
Invoice_ids_1Integer
Invoice_ids_2Integer
Meeting_countInteger
Message_ids_0Integer
Message_ids_1Integer
Message_ids_2Integer
Partner_shareBoolean
Purchase_warnString
Sale_warn_msgBoolean
Supplier_rankInteger
Total_overdueNumber
Activity_stateBoolean
Employee_ids_0Integer
Is_blacklistedBoolean
Message_bounceInteger
Total_invoicedNumber
Additional_infoBoolean
Contact_addressString
Email_formattedString
Employees_countInteger
Followup_statusString
Phone_sanitizedString
Signature_countInteger
Activity_summaryBoolean
Activity_type_idBoolean
Activity_user_idBoolean
Company_registryBoolean
Email_normalizedString
Followup_line_idBoolean
Invoice_warn_msgBoolean
Partner_latitudeNumber
Sale_order_countInteger
Sale_order_ids_0Integer
Sale_order_ids_1Integer
Active_lang_countInteger
Message_has_errorBoolean
Opportunity_countInteger
Partner_longitudeNumber
Phone_blacklistedBoolean
Purchase_warn_msgBoolean
Ref_company_ids_0Integer
Show_credit_limitBoolean
Signup_expirationBoolean
Activity_type_iconBoolean
Bank_account_countInteger
Followup_line_id_0Integer
Followup_line_id_1String
Journal_item_countInteger
Message_needactionBoolean
Mobile_blacklistedBoolean
Message_is_followerBoolean
Payment_token_countInteger
Phone_mobile_searchBoolean
Same_vat_partner_idBoolean
Certifications_countInteger
Purchase_order_countInteger
Unpaid_invoice_ids_0Integer
Message_has_sms_errorBoolean
Message_partner_ids_0Integer
Unpaid_invoices_countInteger
Activity_date_deadlineBoolean
Citizen_identificationBoolean
Followup_reminder_typeString
Message_follower_ids_0Integer
Receipt_reminder_emailBoolean
Supplier_invoice_countInteger
Unreconciled_aml_ids_0Integer
Unreconciled_aml_ids_1Integer
Activity_exception_iconBoolean
Calendar_last_notif_ackDate-time
Commercial_company_nameString
Commercial_partner_id_0Integer
Commercial_partner_id_1String
Followup_responsible_idBoolean
Contact_address_completeString
Has_unreconciled_entriesBoolean
Message_attachment_countInteger
Property_payment_term_idBoolean
Use_partner_credit_limitBoolean
Followup_next_action_dateBoolean
Last_time_entries_checkedBoolean
Message_has_error_counterInteger
My_activity_date_deadlineBoolean
Activity_calendar_event_idBoolean
Message_main_attachment_idBoolean
Message_needaction_counterInteger
Online_partner_informationBoolean
Phone_sanitized_blacklistedBoolean
Certifications_company_countInteger
Property_account_position_idBoolean
Property_product_pricelist_0Integer
Property_product_pricelist_1String
Reminder_date_before_receiptInteger
Activity_exception_decorationBoolean
Property_account_payable_id_0Integer
Property_account_payable_id_1String
Property_purchase_currency_idBoolean
Property_account_receivable_id_0Integer
Property_account_receivable_id_1String
Same_company_registry_partner_idBoolean
Property_supplier_payment_term_idBoolean
Duplicated_bank_account_partners_countInteger
Odoo
Journal

View 7 columns
IdInteger
NameString
Asset_idBoolean
Asset_id_0Integer
Asset_id_1String
Write_dateDate-time
Amount_totalNumber
Odoo
Journal Lines

View 5 columns
IdInteger
NameString
QuantityNumber
Write_dateDate-time
Price_totalNumber
Odoo
Invoices

View 40 columns
IdInteger
StateString
QuantityNumber
Move_id_0Integer
Move_id_1String
Move_typeString
Team_id_0Integer
Team_id_1String
Price_totalNumber
Account_id_0Integer
Account_id_1String
Company_id_0Integer
Company_id_1String
Country_id_0Integer
Country_id_1String
Display_nameDate-time
Invoice_dateDate-time
Journal_id_0Integer
Journal_id_1String
Partner_id_0Integer
Partner_id_1String
Product_id_0Integer
Product_id_1String
__last_updateDate-time
Payment_stateString
Price_averageNumber
Price_subtotalNumber
Invoice_date_dueDate-time
Product_uom_id_0Integer
Product_uom_id_1String
Invoice_user_id_0Integer
Invoice_user_id_1String
Product_categ_id_0Integer
Product_categ_id_1String
Fiscal_position_id_0Integer
Fiscal_position_id_1String
Company_currency_id_0Integer
Company_currency_id_1String
Commercial_partner_id_0Integer
Commercial_partner_id_1String
Odoo
Products

View 101 columns
IdInteger
NameString
TypeString
ColorInteger
ActiveBoolean
VolumeNumber
WeightNumber
BarcodeBoolean
Sale_okBoolean
PriorityString
SequenceInteger
Uom_id_0Integer
Uom_id_1String
Uom_nameString
Image_128Boolean
Image_256Boolean
Image_512Boolean
Categ_id_0Integer
Categ_id_1String
Company_idBoolean
Image_1024Boolean
Image_1920Boolean
List_priceNumber
Project_idBoolean
Tax_stringString
Taxes_id_0Integer
Write_dateDate-time
Create_dateDate-time
DescriptionBoolean
Has_messageBoolean
Purchase_okBoolean
Sales_countNumber
Uom_po_id_0Integer
Uom_po_id_1String
Write_uid_0Integer
Write_uid_1String
Create_uid_0Integer
Create_uid_1String
Default_codeBoolean
Display_nameString
Service_typeString
__last_updateDate-time
Currency_id_0Integer
Currency_id_1String
Detailed_typeString
Message_ids_0Integer
Activity_stateBoolean
Expense_policyString
Invoice_policyString
Sale_line_warnString
Service_policyString
Standard_priceNumber
Product_tooltipString
Purchase_methodString
Volume_uom_nameString
Weight_uom_nameString
Activity_summaryBoolean
Activity_type_idBoolean
Activity_user_idBoolean
Description_saleBoolean
Planning_enabledBoolean
Planning_role_idBoolean
Service_trackingString
Message_has_errorBoolean
Activity_type_iconBoolean
Cost_currency_id_0Integer
Cost_currency_id_1String
Is_product_variantBoolean
Message_needactionBoolean
Purchase_line_warnString
Sale_line_warn_msgBoolean
Message_is_followerBoolean
Project_template_idBoolean
Service_to_purchaseBoolean
Supplier_taxes_id_0Integer
Description_purchaseBoolean
Pricelist_item_countInteger
Product_variant_id_0Integer
Product_variant_id_1String
Message_has_sms_errorBoolean
Message_partner_ids_0Integer
Product_variant_countInteger
Product_variant_ids_0Integer
Purchased_product_qtyNumber
Activity_date_deadlineBoolean
Message_follower_ids_0Integer
Purchase_line_warn_msgBoolean
Visible_expense_policyBoolean
Activity_exception_iconBoolean
Can_image_1024_be_zoomedBoolean
Message_attachment_countInteger
Visible_qty_configuratorBoolean
Message_has_error_counterInteger
My_activity_date_deadlineBoolean
Activity_calendar_event_idBoolean
Message_main_attachment_idBoolean
Message_needaction_counterInteger
Property_account_income_idBoolean
Has_configurable_attributesBoolean
Property_account_expense_idBoolean
Activity_exception_decorationBoolean
Odoo
Product Variants

View 114 columns
IdInteger
CodeBoolean
NameString
TypeString
ColorInteger
ActiveBoolean
VolumeNumber
WeightNumber
BarcodeBoolean
Sale_okBoolean
PriorityString
SequenceInteger
Uom_id_0Integer
Uom_id_1String
Uom_nameString
Image_128Boolean
Image_256Boolean
Image_512Boolean
Lst_priceNumber
Categ_id_0Integer
Categ_id_1String
Company_idBoolean
Image_1024Boolean
Image_1920Boolean
List_priceNumber
Project_idBoolean
Tax_stringString
Taxes_id_0Integer
Write_dateDate-time
Create_dateDate-time
DescriptionBoolean
Has_messageBoolean
Partner_refString
Price_extraNumber
Purchase_okBoolean
Sales_countNumber
Uom_po_id_0Integer
Uom_po_id_1String
Write_uid_0Integer
Write_uid_1String
Create_uid_0Integer
Create_uid_1String
Default_codeBoolean
Display_nameString
Service_typeString
__last_updateDate-time
Currency_id_0Integer
Currency_id_1String
Detailed_typeString
Message_ids_0Integer
Activity_stateBoolean
Expense_policyString
Invoice_policyString
Sale_line_warnString
Service_policyString
Standard_priceNumber
Product_tooltipString
Purchase_methodString
Volume_uom_nameString
Weight_uom_nameString
Activity_summaryBoolean
Activity_type_idBoolean
Activity_user_idBoolean
Description_saleBoolean
Planning_enabledBoolean
Planning_role_idBoolean
Service_trackingString
Image_variant_128Boolean
Image_variant_256Boolean
Image_variant_512Boolean
Message_has_errorBoolean
Product_tmpl_id_0Integer
Product_tmpl_id_1String
Activity_type_iconBoolean
Cost_currency_id_0Integer
Cost_currency_id_1String
Image_variant_1024Boolean
Image_variant_1920Boolean
Is_product_variantBoolean
Message_needactionBoolean
Purchase_line_warnString
Sale_line_warn_msgBoolean
Combination_indicesString
Message_is_followerBoolean
Project_template_idBoolean
Service_to_purchaseBoolean
Supplier_taxes_id_0Integer
Description_purchaseBoolean
Pricelist_item_countInteger
Product_variant_id_0Integer
Product_variant_id_1String
Message_has_sms_errorBoolean
Message_partner_ids_0Integer
Product_variant_countInteger
Product_variant_ids_0Integer
Purchased_product_qtyNumber
Activity_date_deadlineBoolean
Message_follower_ids_0Integer
Purchase_line_warn_msgBoolean
Visible_expense_policyBoolean
Activity_exception_iconBoolean
Can_image_1024_be_zoomedBoolean
Message_attachment_countInteger
Visible_qty_configuratorBoolean
Message_has_error_counterInteger
My_activity_date_deadlineBoolean
Activity_calendar_event_idBoolean
Message_main_attachment_idBoolean
Message_needaction_counterInteger
Property_account_income_idBoolean
Has_configurable_attributesBoolean
Property_account_expense_idBoolean
Activity_exception_decorationBoolean
Can_image_variant_1024_be_zoomedBoolean
Odoo
Sales Orders

View 123 columns
IdInteger
NameString
NoteString
StateString
OriginBoolean
Medium_idBoolean
ReferenceBoolean
SignatureBoolean
Signed_byBoolean
Signed_onBoolean
Source_idBoolean
Team_id_0Integer
Team_id_1String
Type_nameString
User_id_0Integer
User_id_1String
Access_urlString
Amount_taxNumber
Date_orderDate-time
Is_expiredBoolean
Project_idBoolean
Terms_typeString
Write_dateDate-time
Campaign_idBoolean
Create_dateDate-time
Has_messageBoolean
Tasks_countInteger
Write_uid_0Integer
Write_uid_1String
Access_tokenBoolean
Amount_totalNumber
Company_id_0Integer
Company_id_1String
Country_codeString
Create_uid_0Integer
Create_uid_1String
Display_nameString
Order_line_0Integer
Partner_id_0Integer
Partner_id_1String
__last_updateDate-time
Currency_id_0Integer
Currency_id_1String
Currency_rateNumber
Expected_dateDate-time
Invoice_countInteger
Invoice_ids_0Integer
Message_ids_0Integer
Message_ids_1Integer
Message_ids_2Integer
Project_countInteger
Validity_dateBoolean
Access_warningString
Activity_stateBoolean
Amount_untaxedNumber
Invoice_statusString
Opportunity_idBoolean
Pricelist_id_0Integer
Pricelist_id_1String
Commitment_dateBoolean
Milestone_countInteger
Payment_term_idBoolean
Require_paymentBoolean
Visible_projectBoolean
Activity_summaryBoolean
Activity_type_idBoolean
Activity_user_idBoolean
Client_order_refBoolean
Show_update_fposBoolean
Tax_country_id_0Integer
Tax_country_id_1String
Message_has_errorBoolean
Require_signatureBoolean
Activity_type_iconBoolean
Message_needactionBoolean
Amount_undiscountedNumber
Analytic_account_idBoolean
Message_is_followerBoolean
Fiscal_position_id_0Integer
Fiscal_position_id_1String
Is_product_milestoneBoolean
Partner_invoice_id_0Integer
Partner_invoice_id_1String
Purchase_order_countInteger
Message_has_sms_errorBoolean
Message_partner_ids_0Integer
Message_partner_ids_1Integer
Partner_shipping_id_0Integer
Partner_shipping_id_1String
Planning_initial_dateBoolean
Show_update_pricelistBoolean
Activity_date_deadlineBoolean
Message_follower_ids_0Integer
Message_follower_ids_1Integer
Partner_credit_warningString
Planning_hours_plannedNumber
Planning_hours_to_planNumber
Sale_order_template_idBoolean
Activity_exception_iconBoolean
Tax_totals_amount_totalNumber
Message_attachment_countInteger
Message_has_error_counterInteger
My_activity_date_deadlineBoolean
Tax_totals_amount_untaxedNumber
Activity_calendar_event_idBoolean
Message_main_attachment_idBoolean
Message_needaction_counterInteger
Planning_first_sale_line_idBoolean
Tax_totals_display_tax_baseBoolean
Tax_totals_subtotals_0_nameString
Tax_totals_subtotals_order_0String
Activity_exception_decorationBoolean
Tax_totals_subtotals_0_amountNumber
Tax_totals_formatted_amount_totalString
Tax_totals_formatted_amount_untaxedString
Tax_totals_subtotals_0_formatted_amountString
Tax_totals_groups_by_subtotal_Untaxed Amount_0_group_keyInteger
Tax_totals_groups_by_subtotal_Untaxed Amount_0_tax_group_idInteger
Tax_totals_groups_by_subtotal_Untaxed Amount_0_tax_group_nameString
Tax_totals_groups_by_subtotal_Untaxed Amount_0_tax_group_amountNumber
Tax_totals_groups_by_subtotal_Untaxed Amount_0_tax_group_base_amountNumber
Tax_totals_groups_by_subtotal_Untaxed Amount_0_formatted_tax_group_amountString
Tax_totals_groups_by_subtotal_Untaxed Amount_0_formatted_tax_group_base_amountString
Odoo
Purchase Orders

View 96 columns
IdInteger
NameString
NotesBoolean
StateString
OriginBoolean
PriorityString
User_id_0Integer
User_id_1String
Access_urlString
Amount_taxNumber
Date_orderDate-time
Product_idBoolean
Write_dateDate-time
Create_dateDate-time
Has_messageBoolean
Incoterm_idBoolean
Partner_refBoolean
Write_uid_0Integer
Write_uid_1String
Access_tokenBoolean
Amount_totalNumber
Company_id_0Integer
Company_id_1String
Country_codeString
Create_uid_0Integer
Create_uid_1String
Date_approveBoolean
Date_plannedDate-time
Display_nameString
Order_line_0Integer
Order_line_1Integer
Partner_id_0Integer
Partner_id_1String
Product_id_0Integer
Product_id_1String
__last_updateDate-time
Currency_id_0Integer
Currency_id_1String
Currency_rateNumber
Invoice_countInteger
Message_ids_0Integer
Message_ids_1Integer
Message_ids_2Integer
Message_ids_3Integer
Access_warningString
Activity_stateBoolean
Amount_untaxedNumber
Invoice_statusString
Dest_address_idBoolean
Payment_term_idBoolean
Activity_summaryBoolean
Activity_type_idBoolean
Activity_user_idBoolean
Sale_order_countInteger
Tax_country_id_0Integer
Tax_country_id_1String
Message_has_errorBoolean
Activity_type_iconBoolean
Fiscal_position_idBoolean
Message_needactionBoolean
Date_calendar_startDate-time
Message_is_followerBoolean
Fiscal_position_id_0Integer
Fiscal_position_id_1String
Message_has_sms_errorBoolean
Message_partner_ids_0Integer
Activity_date_deadlineBoolean
Message_follower_ids_0Integer
Receipt_reminder_emailBoolean
Activity_exception_iconBoolean
Mail_reminder_confirmedBoolean
Tax_totals_amount_totalNumber
Mail_reception_confirmedBoolean
Message_attachment_countInteger
Message_has_error_counterInteger
My_activity_date_deadlineBoolean
Tax_totals_amount_untaxedNumber
Activity_calendar_event_idBoolean
Message_main_attachment_idBoolean
Message_needaction_counterInteger
Tax_totals_display_tax_baseBoolean
Tax_totals_subtotals_0_nameString
Reminder_date_before_receiptInteger
Tax_totals_subtotals_order_0String
Activity_exception_decorationBoolean
Tax_totals_subtotals_0_amountNumber
Tax_totals_formatted_amount_totalString
Tax_totals_formatted_amount_untaxedString
Tax_totals_subtotals_0_formatted_amountString
Tax_totals_groups_by_subtotal_Untaxed Amount_0_group_keyInteger
Tax_totals_groups_by_subtotal_Untaxed Amount_0_tax_group_idInteger
Tax_totals_groups_by_subtotal_Untaxed Amount_0_tax_group_nameString
Tax_totals_groups_by_subtotal_Untaxed Amount_0_tax_group_amountNumber
Tax_totals_groups_by_subtotal_Untaxed Amount_0_tax_group_base_amountNumber
Tax_totals_groups_by_subtotal_Untaxed Amount_0_formatted_tax_group_amountString
Tax_totals_groups_by_subtotal_Untaxed Amount_0_formatted_tax_group_base_amountString
Odoo
Accounts

Odoo
Account Move

Odoo
Account Move Line

Odoo
Crm Lead

Odoo
Invoice Lines

Odoo
Invoice Lines All Move Types

Odoo
Journals

Odoo
Models

Odoo
Partners

Odoo
Partner Categories

Odoo
Payments

Odoo
Payment Method Lines

Odoo
Pos Orders

Odoo
Pos Order Lines

Odoo
Pos Payments

Odoo
Projects

Odoo
Project Stages

Odoo
Product Categories

Odoo
Purchase Order Lines

Odoo
Sales Order Lines

Odoo
Statements

Odoo
Stock Quantities

Odoo
Stock Locations

Odoo
Stock Moves

Odoo
Stock Move Lines

Odoo
Stock Pickings

Odoo
Stock Picking Types

Odoo
Stock Valuation Layers

Odoo
Tasks

Odoo
Users

Ready to get instant access to all your company data ?​

Connect 300+ sources, serve any BI tool, and give every AI agent one governed endpoint to read, and write back where the app supports it.