OpenStack Projects¶
This page documents how to use the manager and record objects for projects.
Details¶
Name | Value |
---|---|
Odoo Modules | OpenStack Integration |
Odoo Model Name | openstack.project |
Manager | projects |
Record Type | Project |
Manager¶
The project manager is available as the projects
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.projects.get(1234)
Project(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.
get_by_os_id
¶
get_by_os_id(
os_id: str,
fields: Iterable[str] | None = None,
order: str | None = None,
as_id: bool = False,
as_dict: bool = False,
optional: bool = False,
) -> Project
get_by_os_id(
os_id: str,
fields: Iterable[str] | None = None,
order: str | None = None,
as_id: bool = False,
as_dict: bool = False,
optional: bool = True,
) -> Project | None
get_by_os_id(
os_id: str,
fields: Iterable[str] | None = None,
order: str | None = None,
as_id: bool = True,
as_dict: bool = False,
optional: bool = False,
) -> int
get_by_os_id(
os_id: str,
fields: Iterable[str] | None = None,
order: str | None = None,
as_id: bool = True,
as_dict: bool = False,
optional: bool = True,
) -> int | None
get_by_os_id(
os_id: str,
fields: Iterable[str] | None = None,
order: str | None = None,
as_id: bool = False,
as_dict: bool = True,
optional: bool = False,
) -> dict[str, Any]
get_by_os_id(
os_id: str,
fields: Iterable[str] | None = None,
order: str | None = None,
as_id: bool = False,
as_dict: bool = True,
optional: bool = True,
) -> dict[str, Any] | None
Query a unique record by OpenStack project ID.
>>> 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.projects.get_by_os_id("1a2b3c4d5e1a2b3c4d5e1a2b3c4d5e1a")
Project(record={'id': 1234, 'name': 'test-project', 'os_id': '1a2b3c4d5e1a2b3c4d5e1a2b3c4d5e1a', ...}, fields=None)
A number of parameters are available to configure the return type, and what happens when a result is not found.
By default all fields available on the record model
will be selected, but this can be filtered using the
fields
parameter.
Use the as_id
parameter to return the ID of the record,
instead of the record object.
Use the as_dict
parameter to return the record as
a dict
object, instead of a record object.
When optional
is True
, None
is returned if a record
with the given name does not exist, instead of raising an error.
Parameters¶
Name | Type | Description | Default |
---|---|---|---|
os_id |
str |
The OpenStack project ID to search for | (required) |
fields |
Iterable[str] | None |
Fields to select, defaults to None (select all) |
None |
as_id |
bool |
Return a record ID | False |
as_dict |
bool |
Return the record as a dictionary | False |
optional |
bool |
Return None if not found |
False |
Raises¶
Type | Description |
---|---|
MultipleRecordsFoundError |
Multiple records with the same name were found |
RecordNotFoundError |
Record with the given name not found (when optional is False ) |
Returns¶
Type | Description |
---|---|
Project |
Project object (default) |
int |
Project ID (when as_id is True ) |
dict[str, Any] |
Project dictionary (when as_dict is True ) |
None |
If a project with the given name was not found (when optional is True ) |
Record¶
The project manager returns Project
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.
display_name
¶
The automatically generated display name for the project.
enabled
¶
Whether or not the project is enabled in Odoo.
group_invoices
¶
Whether or not to group invoices together for this project.
name
¶
OpenStack project name.
os_id
¶
OpenStack project ID.
override_po_number
¶
Whether or not to override the PO number with the value set on this Project.
owner_id
¶
The ID for the partner that owns this project.
owner_name
¶
The name of the partner that owns this project.
owner
¶
The partner that owns this project.
This fetches the full record from Odoo once, and caches it for subsequent accesses.
parent_id
¶
The ID for the parent project, if this project is the child of another project.
parent_name
¶
The name of the parent project, if this project is the child of another project.
parent
¶
The parent project, if this project is the child of another project.
This fetches the full record from Odoo once, and caches it for subsequent accesses.
payment_method
¶
Payment method configured on the project.
Values:
invoice
- Project is paid by invoicecredit_card
- Project is paid by credit card
po_number
¶
The PO number set for this specific Project (if set).
project_contact_ids
¶
A list of IDs for the contacts for this project.
project_contacts
¶
The contacts for this project.
This fetches the full records from Odoo once, and caches them for subsequent accesses.
project_credit_ids
¶
A list of IDs for the credits that apply to this project.
project_credits
¶
The credits that apply to this project.
This fetches the full records from Odoo once, and caches them for subsequent accesses.
project_grant_ids
¶
A list of IDs for the grants that apply to this project.
project_grants
¶
The grants that apply to this project.
This fetches the full records from Odoo once, and caches them for subsequent accesses.
stripe_card_id
¶
The card ID used for credit card payments on this project
using Stripe, if the payment method is set to credit_card
.
If a credit card has not been assigned to this project,
this field will be set to False
.
support_subscription_id
¶
The ID for the support subscription for this project, if the project has one.
support_subscription_name
¶
The name of the support subscription for this project, if the project has one.
support_subscription
¶
The support subscription for this project, if the project has one.
This fetches the full record from Odoo once, and caches it for subsequent accesses.
term_discount_ids
¶
A list of IDs for the term discounts that apply to this project.
term_discounts
¶
The term discounts that apply to this project.
This fetches the full records from Odoo once, and caches them for subsequent accesses.