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¶
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 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:
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¶
The untaxed total cost of the sale order.
amount_tax¶
The amount in taxes on this sale order.
amount_total¶
The taxed total cost of the sale order.
client_order_ref¶
The customer reference for this sale order, if defined.
currency_id¶
The ID for the currency used in this sale order.
currency_name¶
The name of the currency used in this sale order.
currency¶
The currency used in this sale order.
This fetches the full record from Odoo once, and caches it for subsequent accesses.
date_order¶
The time the sale order was created.
display_name¶
The display name of the sale order.
invoice_status¶
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¶
The name assigned to the sale order.
note¶
A note attached to the sale order.
Generally used for terms and conditions.
order_line_ids¶
A list of IDs for the lines added to the sale order.
order_line¶
The lines added to the sale order.
This fetches the full records from Odoo once, and caches them for subsequent accesses.
order_lines¶
An alias for order_line.
os_invoice_date¶
The invoicing date for the invoice that is created from the sale order.
os_invoice_due_date¶
The due date for the invoice that is created from the sale order.
os_project_id¶
The ID for the the OpenStack project this sale order was was generated for.
os_project_name¶
The name of the the OpenStack project this sale order was was generated for.
os_project¶
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¶
The ID for the recipient partner for the sale order.
partner_name¶
The name of the recipient partner for the sale order.
partner¶
The recipient partner for the sale order.
This fetches the full record from Odoo once, and caches it for subsequent accesses.
state¶
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_confirm¶
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 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()