Skip to content

Sale Orders

This page documents how to use the manager and record objects for sale orders.

Details

Name Value
Odoo Modules Sales, OpenStack Integration
Odoo Model Name sale.order
Manager sale_orders
Record Type SaleOrder

Manager

The sale order manager is available as the sale_orders attribute on the Odoo client object.

>>> from openstack_odooclient import Client as OdooClient
>>> odoo_client = OdooClient(
...     hostname="localhost",
...     port=8069,
...     protocol="jsonrpc",
...     database="odoodb",
...     user="test-user",
...     password="<password>",
... )
>>> odoo_client.sale_orders.get(1234)
SaleOrder(record={'id': 1234, ...}, fields=None)

For more information on how to use managers, refer to Managers.

The following manager methods are also available, in addition to the standard methods.

action_confirm

action_confirm(
    sale_order: int | SaleOrder,
) -> None

Confirm the given sale order.

>>> from openstack_odooclient import Client as OdooClient
>>> odoo_client = OdooClient(
...     hostname="localhost",
...     port=8069,
...     protocol="jsonrpc",
...     database="odoodb",
...     user="test-user",
...     password="<password>",
... )
>>> odoo_client.sale_orders.action_confirm(
...     sale_order=1234,  # ID or object
... )

Parameters

Name Type Description Default
sale_order int | SaleOrder The sale order to confirm (required)

create_invoices

create_invoices(
    sale_order: int | SaleOrder,
) -> None

Create invoices from the given sale order.

>>> from openstack_odooclient import Client as OdooClient
>>> odoo_client = OdooClient(
...     hostname="localhost",
...     port=8069,
...     protocol="jsonrpc",
...     database="odoodb",
...     user="test-user",
...     password="<password>",
... )
>>> odoo_client.sale_orders.create_invoices(
...     sale_order=1234,  # ID or object
... )

Parameters

Name Type Description Default
sale_order int | SaleOrder The sale order to create invoices from (required)

Record

The sale order manager returns SaleOrder record objects.

To import the record class for type hinting purposes:

from openstack_odooclient import SaleOrder

The record class currently implements the following fields and methods.

For more information on attributes and methods common to all record types, see Record Attributes and Methods.

amount_untaxed

amount_untaxed: float

The untaxed total cost of the sale order.

amount_tax

amount_tax: float

The amount in taxes on this sale order.

amount_total

amount_total: float

The taxed total cost of the sale order.

client_order_ref

client_order_ref: str | Literal[False]

The customer reference for this sale order, if defined.

currency_id

currency_id: int

The ID for the currency used in this sale order.

currency_name

currency_name: str

The name of the currency used in this sale order.

currency

currency: Currency

The currency used in this sale order.

This fetches the full record from Odoo once, and caches it for subsequent accesses.

date_order

date_order: datetime

The time the sale order was created.

display_name

display_name: str

The display name of the sale order.

invoice_status

invoice_status: Literal["no", "to invoice", "invoiced", "upselling"]

The current invoicing status of this sale order.

Values:

  • no - Nothing to invoice
  • to invoice - Has line items that need to be invoiced
  • invoiced - Fully invoiced
  • upselling - Upselling opportunity

name

name: str

The name assigned to the sale order.

note

note: str

A note attached to the sale order.

Generally used for terms and conditions.

order_line_ids

order_line_ids: list[int]

A list of IDs for the lines added to the sale order.

order_line

order_line: list[SaleOrderLine]

The lines added to the sale order.

This fetches the full records from Odoo once, and caches them for subsequent accesses.

order_lines

order_lines: list[SaleOrderLine]

An alias for order_line.

os_invoice_date

os_invoice_date: date

The invoicing date for the invoice that is created from the sale order.

os_invoice_due_date

os_invoice_due_date: date

The due date for the invoice that is created from the sale order.

os_project_id

os_project_id: int | None

The ID for the the OpenStack project this sale order was was generated for.

os_project_name

os_project_name: str | None

The name of the the OpenStack project this sale order was was generated for.

os_project

os_project: Project | None

The OpenStack project this sale order was was generated for.

This fetches the full record from Odoo once, and caches it for subsequent accesses.

partner_id

partner_id: int

The ID for the recipient partner for the sale order.

partner_name

partner_name: str

The name of the recipient partner for the sale order.

partner

partner: Partner

The recipient partner for the sale order.

This fetches the full record from Odoo once, and caches it for subsequent accesses.

state

state: Literal["draft", "sale", "done", "cancel"]

State of the sale order.

Values:

  • draft - Draft sale order (quotation), can still be modified
  • sale - Finalised sale order, cannot be modified
  • done - Finalised and settled sale order, cannot be modified
  • cancel - Cancelled sale order, can be deleted in most cases

action_confirm

action_confirm() -> None

Confirm this sale order.

>>> from openstack_odooclient import Client as OdooClient
>>> odoo_client = OdooClient(
...     hostname="localhost",
...     port=8069,
...     protocol="jsonrpc",
...     database="odoodb",
...     user="test-user",
...     password="<password>",
... )
>>> sale_order = odoo_client.sale_orders.get(1234)
>>> sale_order.action_confirm()

create_invoices

create_invoices() -> None

Create invoices from this sale order.

>>> from openstack_odooclient import Client as OdooClient
>>> odoo_client = OdooClient(
...     hostname="localhost",
...     port=8069,
...     protocol="jsonrpc",
...     database="odoodb",
...     user="test-user",
...     password="<password>",
... )
>>> sale_order = odoo_client.sale_orders.get(1234)
>>> sale_order.create_invoices()