Pricelists¶
This page documents how to use the manager and record objects for pricelists.
Details¶
Name | Value |
---|---|
Odoo Modules | Product |
Odoo Model Name | product.pricelist |
Manager | pricelists |
Record Type | Pricelist |
Manager¶
The partner manager is available as the pricelists
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.pricelists.get(1234)
Pricelist(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_price
¶
Get the price to charge for a given pricelist, product and quantity.
>>> 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.pricelists.get_price(
... pricelist=1234, # ID or object
... product=5678, # ID or object
... qty=100,
... )
2.5
Parameters¶
Name | Type | Description | Default |
---|---|---|---|
pricelist |
int | Pricelist |
Pricelist to reference (ID or object) | (required) |
product |
int | Product |
Product to get the price for (ID or object) | (required) |
qty |
float |
Quantity to charge for | (required) |
Returns¶
Type | Description |
---|---|
float |
Price to charge |
Record¶
The partner manager returns Partner
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.
active
¶
Whether or not this partner is active (enabled).
company_id
¶
The ID for the company for this pricelist, if set.
company_name
¶
The name of the company for this pricelist, if set.
company
¶
The company for this pricelist, if set.
This fetches the full record from Odoo once, and caches it for subsequent accesses.
currency_id
¶
The ID for the currency used in this pricelist.
currency_name
¶
The name of the currency used in this pricelist.
currency
¶
The currency used in this pricelist.
This fetches the full record from Odoo once, and caches it for subsequent accesses.
discount_policy
¶
Discount policy for the pricelist.
Values:
with_discount
- Discount included in the pricewithout_discount
- Show public price & discount to the customer
name
¶
The name of this pricelist.
get_price
¶
Get the price to charge for a given product and quantity.
>>> from openstack_odooclient import Client as OdooClient
>>> odoo_client = OdooClient(
... hostname="localhost",
... port=8069,
... protocol="jsonrpc",
... database="odoodb",
... user="test-user",
... password="<password>",
... )
>>> pricelist = odoo_client.pricelists.get(1234)
>>> pricelist.get_price(
... product=5678, # ID or object
... qty=100,
... )
2.5
Parameters¶
Name | Type | Description | Default |
---|---|---|---|
product |
int | Product |
Product to get the price for (ID or object) | (required) |
qty |
float |
Quantity to charge for | (required) |
Returns¶
Type | Description |
---|---|
float |
Price to charge |