Source code for odoo_xmlrpc_twisted.functions.get_product

"""
Get a specific product.
"""


# call the function "get_settings_odoo" to get the parameters
# for the logging of the model on the "odoo Webservice API"
try:
    from .get_settings_odoo import get_settings_odoo
except ImportError:
    from get_settings_odoo import get_settings_odoo
result   = get_settings_odoo()
db       = result[0]
uid      = result[1]
password = result[3]
models   = result[4] 


[docs] def get_product(product_id): """ Function gives back a specific product with the details. """ if not product_id: # Return 'None' if no record exist return None # Get the product list products = models.execute_kw(db, uid, password, 'product.product', 'search_read', [[['id', '=', product_id]]], {'fields': ['name', 'description', 'volume', 'weight', 'x_place']}) # Return the first product if available, else return None return products[0] if products else None