This page documents how to use the manager and record objects for sale orders.
| Name | Value |
|---|---|
| Odoo Modules | Sales, OpenStack Integration |
| Odoo Model Name | sale.order |
| Manager | sale_orders |
| Record Type | SaleOrder |
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_cancel(
sale_order: int | SaleOrder,
) -> NoneCancel 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_cancel(
... sale_order=1234, # ID or object
... )Added in version 0.2.0.
| Name | Type | Description | Default |
|---|---|---|---|
sale_order |
`int | SaleOrder` | The sale order to cancel |
action_confirm(
sale_order: int | SaleOrder,
) -> NoneConfirm 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
... )| Name | Type | Description | Default |
|---|---|---|---|
sale_order |
`int | SaleOrder` | The sale order to confirm |
create_invoices(
sale_order: int | SaleOrder,
) -> NoneCreate 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
... )| Name | Type | Description | Default |
|---|---|---|---|
sale_order |
`int | SaleOrder` | The sale order to create invoices from |
The sale order manager returns SaleOrder record objects.
To import the record class for type hinting purposes:
from openstack_odooclient import SaleOrderThe 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: floatThe untaxed total cost of the sale order.
amount_tax: floatThe amount in taxes on this sale order.
amount_total: floatThe taxed total cost of the sale order.
client_order_ref: str | Literal[False]The customer reference for this sale order, if defined.
currency_id: intThe ID for the currency used in this sale order.
currency_name: strThe name of the currency used in this sale order.
currency: CurrencyThe currency used in this sale order.
This fetches the full record from Odoo once, and caches it for subsequent accesses.
date_order: datetimeThe time the sale order was created.
display_name: strThe display name of the sale order.
invoice_count: intThe number of invoices (account moves) generated from the sale order.
Added in version 0.2.0.
invoice_ids: list[int]A list of IDs for invoices (account moves) generated from the sale order.
Added in version 0.2.0.
invoices: list[AccountMove]The invoices (account moves) generated from the sale order.
This fetches the full records from Odoo once, and caches them for subsequent accesses.
Added in version 0.2.0.
invoice_status: Literal["no", "to invoice", "invoiced", "upselling"]The current invoicing status of this sale order.
Values:
no- Nothing to invoiceto invoice- Has line items that need to be invoicedinvoiced- Fully invoicedupselling- Upselling opportunity
name: strThe name assigned to the sale order.
note: strA note attached to the sale order.
Generally used for terms and conditions.
order_line_ids: list[int]A list of IDs for the lines added to the sale order.
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: list[SaleOrderLine]An alias for order_line.
os_invoice_date: dateThe invoicing date for the invoice that is created from the sale order.
os_invoice_due_date: dateThe due date for the invoice that is created from the sale order.
os_project_id: int | NoneThe ID for the the OpenStack project this sale order was was generated for.
os_project_name: str | NoneThe name of the the OpenStack project this sale order was was generated for.
os_project: Project | NoneThe 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: intThe ID for the recipient partner for the sale order.
partner_name: strThe name of the recipient partner for the sale order.
partner: PartnerThe recipient partner for the sale order.
This fetches the full record from Odoo once, and caches it for subsequent accesses.
state: Literal["draft", "sale", "done", "cancel"]State of the sale order.
Values:
draft- Draft sale order (quotation), can still be modifiedsale- Finalised sale order, cannot be modifieddone- Finalised and settled sale order, cannot be modifiedcancel- Cancelled sale order, can be deleted in most cases
action_cancel() -> NoneCancel 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_cancel()Added in version 0.2.0.
action_confirm() -> NoneConfirm 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() -> NoneCreate 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()