Merge "Improve cache about get products"

This commit is contained in:
Jenkins 2017-08-09 05:49:42 +00:00 committed by Gerrit Code Review
commit 54953ed06c
1 changed files with 6 additions and 1 deletions

View File

@ -386,7 +386,12 @@ class OdooDriver(driver.BaseDriver):
odoo_region = self.region_mapping.get(region, region).upper()
resources = {row.id: json.loads(row.info) for row in resources}
products = self.get_products([region])[region]
# NOTE(flwang): For most of the cases of Distil API, the request comes
# from billing panel. Billing panel sends 1 API call for /invoices and
# several API calls for /quotations against different regions. So it's
# not efficient to specify the region for get_products method because
# it won't help cache the products based on the parameters.
products = self.get_products()[region]
service_mapping = self._get_service_mapping(products)
for entry in measurements: