OpenStack Credits¶
This page documents how to use the manager and record objects for credits.
Details¶
Name | Value |
---|---|
Odoo Modules | OpenStack Integration |
Odoo Model Name | openstack.credit |
Manager | credits |
Record Type | Credit |
Manager¶
The credit manager is available as the credits
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.credits.get(1234)
Credit(record={'id': 1234, ...}, fields=None)
For more information on how to use managers, refer to Managers.
Record¶
The credit manager returns Credit
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.
credit_type_id
¶
The ID of the type of this credit.
credit_type_name
¶
The name of the type of this credit.
credit_type
¶
The type of this credit.
This fetches the full record from Odoo once, and caches it for subsequent accesses.
current_balance
¶
The current remaining balance on the credit.
expiry_date
¶
The date the credit expires.
initial_balance
¶
The initial balance this credit started off with.
name
¶
The automatically generated name of the credit.
start_date
¶
The start date of the credit.
transaction_ids
¶
A list of IDs for the transactions that have been made using this credit.
transactions
¶
The transactions that have been made using this credit.
This fetches the full records from Odoo once, and caches them for subsequent accesses.
voucher_code_id
¶
The ID of the voucher code used when applying for the credit, if one was supplied.
voucher_code_name
¶
The name of the voucher code used when applying for the credit, if one was supplied.
voucher_code
¶
The voucher code used when applying for the credit, if one was supplied.
This fetches the full record from Odoo once, and caches it for subsequent accesses.