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:
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
¶
Whether or not this voucher code has been claimed.
code
¶
The code string for this voucher code.
credit_amount
¶
The initial credit balance for the voucher code, if a credit is to be created by the voucher code.
credit_type_id
¶
The ID of the credit type to use, if a credit is to be created by this voucher code.
credit_type_name
¶
The name of the credit type to use, if a credit is to be created by this voucher code.
credit_type
¶
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
¶
The duration of the credit, in days, if a credit is to be created by the voucher code.
customer_group_id
¶
The ID of the customer group to add the customer to, if set.
customer_group_name
¶
The name of the customer group to add the customer to, if set.
customer_group
¶
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
¶
The date the voucher code expires.
grant_duration
¶
The duration of the grant, in days, if a grant is to be created by the voucher code.
grant_type_id
¶
The ID of the grant type to use, if a grant is to be created by this voucher code.
grant_type_name
¶
The name of the grant type to use, if a grant is to be created by this voucher code.
grant_type
¶
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
¶
The value of the grant, if a grant is to be created by the voucher code.
multi_use
¶
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
¶
The unique name of this voucher code.
This uses the code specified in the record as-is.
quota_size
¶
The default quota size for new projects signed up using this voucher code.
If unset, use the default quota size.
sales_person_id
¶
The ID for the salesperson partner responsible for this voucher code, if assigned.
sales_person_name
¶
The name of the salesperson partner responsible for this voucher code, if assigned.
sales_person
¶
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
¶
A list of IDs for the tags (partner categories) to assign to partners for new accounts that signed up using this voucher code.
tags
¶
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.