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_odooimportget_settings_odooexceptImportError:fromget_settings_odooimportget_settings_odooresult=get_settings_odoo()db=result[0]uid=result[1]password=result[3]models=result[4]
[docs]defget_product(product_id):""" Function gives back a specific product with the details. """ifnotproduct_id:# Return 'None' if no record existreturnNone# Get the product listproducts=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 Nonereturnproducts[0]ifproductselseNone