Skip to content

OpenStack Voucher Codes

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

Details

Name Value
Odoo Modules OpenStack Integration
Odoo Model Name openstack.voucher_code
Manager voucher_codes
Record Type VoucherCode

Manager

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

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

Record

The voucher code manager returns VoucherCode record objects.

To import the record class for type hinting purposes:

from openstack_odooclient import VoucherCode

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.

claimed

claimed: bool

Whether or not this voucher code has been claimed.

code

code: str

The code string for this voucher code.

credit_amount

credit_amount: float | Literal[False]

The initial credit balance for the voucher code, if a credit is to be created by the voucher code.

credit_type_id

credit_type_id: int | None

The ID of the credit type to use, if a credit is to be created by this voucher code.

credit_type_name

credit_type_name: str | None

The name of the credit type to use, if a credit is to be created by this voucher code.

credit_type

credit_type: CreditType | None

The credit type to use, if a credit is to be created by this voucher code.

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

credit_duration

credit_duration: int | Literal[False]

The duration of the credit, in days, if a credit is to be created by the voucher code.

customer_group_id

customer_group_id: int | None

The ID of the customer group to add the customer to, if set.

customer_group_name

customer_group_name: str | None

The name of the customer group to add the customer to, if set.

customer_group

customer_group: CustomerGroup | None

The customer group to add the customer to, if set.

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

expiry_date

expiry_date: date | Literal[False]

The date the voucher code expires.

grant_duration

grant_duration: int | Literal[False]

The duration of the grant, in days, if a grant is to be created by the voucher code.

grant_type_id

grant_type_id: int | None

The ID of the grant type to use, if a grant is to be created by this voucher code.

grant_type_name

grant_type_name: str | None

The name of the grant type to use, if a grant is to be created by this voucher code.

grant_type

grant_type: GrantType | None

The grant type to use, if a grant is to be created by this voucher code.

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

grant_value

grant_value: float | Literal[False]

The value of the grant, if a grant is to be created by the voucher code.

multi_use

multi_use: bool

Whether or not this is a multi-use voucher code.

A multi-use voucher code can be used an unlimited number of times until it expires.

name

name: str

The unique name of this voucher code.

This uses the code specified in the record as-is.

quota_size

quota_size: str | Literal[False]

The default quota size for new projects signed up using this voucher code.

If unset, use the default quota size.

sales_person_id

sales_person_id: int | None

The ID for the salesperson partner responsible for this voucher code, if assigned.

sales_person_name

sales_person_name: str | None

The name of the salesperson partner responsible for this voucher code, if assigned.

sales_person

sales_person: Partner | None

The salesperson partner responsible for this voucher code, if assigned.

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

tag_ids

tag_ids: list[int]

A list of IDs for the tags (partner categories) to assign to partners for new accounts that signed up using this voucher code.

tags

tags: list[PartnerCategory]

The list of tags (partner categories) to assign to partners for new accounts that signed up using this voucher code.

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