Skip to content

OpenStack Grants

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

Details

Name Value
Odoo Modules OpenStack Integration
Odoo Model Name openstack.grant
Manager grants
Record Type Grant

Manager

The grant manager is available as the grants 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.grants.get(1234)
Grant(record={'id': 1234, ...}, fields=None)

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

Record

The grant manager returns Grant record objects.

To import the record class for type hinting purposes:

from openstack_odooclient import Grant

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.

expiry_date

expiry_date: date

The date the grant expires.

grant_type_id

grant_type_id: int

The ID of the type of this grant.

grant_type_name

grant_type_name: str

The name of the type of this grant.

grant_type

grant_type: GrantType

The type of this grant.

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

name

name: str

The automatically generated name of the grant.

start_date

start_date: date

The start date of the grant.

value

value: float

The value of this grant.

voucher_code_id

voucher_code_id: int | None

The ID of the voucher code used when applying for the grant, if one was supplied.

voucher_code_name

voucher_code_name: str | None

The name of the voucher code used when applying for the grant, if one was supplied.

voucher_code

voucher_code: VoucherCode | None

The voucher code used when applying for the grant, if one was supplied.

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