Source code for odoo_xmlrpc_twisted.functions.count_product_place

"""
Return the number of products in a place for a customer.
"""

# 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 count_product_place(partner_id, place): """ Function returns how many of the customer's items belong to a particular place. """ count = 0 if (partner_id != '') and (place != ''): # get the number of products with the specific place belonging to the client count = models.execute_kw(db,uid, password, 'product.product', 'search_count', [[['x_partner_id', '=', partner_id], ['x_place', '=', place]]]) return(count)