The state/status of invoice can indidate if the invoice has been paid
or not. It would be nice to show/remind our customer via billing panel
if their invoices have been paid.
Change-Id: Ia3f77bbf04ece10f0dc9fdcafa93fcb8d8401c98
To show the discount info in invoice, it's necessary to add discount
into the discount/category mapping.
Change-Id: I53580eaafbd80bd9efd9a17eab03d42bf1edf481
The product category mapping is missing the object storage mapping
relationship. This patch fixes it.
Change-Id: I0a320e57845443307797076ba9ecef2f373648fa
Use 'to_policy_values' method to get context information for policy
checking to avoid exception when using older version of oslo.context,
e.g. in oslo.context==2.2.0, the property 'user_id' doesn't exist in
RequestContext.
Change-Id: I736d008365e28a2826646c1677f739a0a7fbb518
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.
Change-Id: I2f7e2ce8c3f43e79b9e9084903fca1bc4f44f82a
The 'message' attribute has been deprecated and removed
from Python3.
For more details, please check:
https://www.python.org/dev/peps/pep-0352/
Change-Id: I6514be276561525ca17d8bc6e43b8c7312aa5b76
This change give us a convenient way to do usage collection
catch up to specific date. By default the end time when collection
happends is now() and the collection service will keep running
infinitely.
This patch adds a command line param called 'collect_end_time'.
If we start distil-collector manually with 'collect_end_time' param
specified, the service should be stopped automatically after all
projects usage collection is up-to-date.
Change-Id: I0d0aebcf3dfeeb987155bb8d92f2aee1918ceac8
The project ids returned from Keystone is in ascending order which may
lead to some projects will never get updated if some unexcepted error
happens during collection.
This patch adds a config option to define the prefered collection
order, currently, 'ascending', 'descending' and 'random' are supported.
Change-Id: Ife97e73fe2ae4533ef4baf1f935e46579902719e
When some exception happened in collect_usage() when doing collection
for tenant in either time window, correct exception message should be
logged, and tenant collection should not be considered successful.
This patch mainly changes the log message.
Change-Id: I2c6784708c32030b0d32bb0696b194a0be0f8a91
- Fix display result of decimal floating point arithmetic.
- Use 'rate' to represent product unit price, the same with what users
see from invoice and quotation.
Change-Id: I500ff41b2cfc7cb67d4e8570bfae34aadbd45b12
Since the default value is None when can't get a key from a dict,
So there is no need to use dict.get('key', None).
Change-Id: Ia2024152e6f01ce6d46bae74095351477637c908
Instead of calling odoo API 3 times, we're moving out the products
calling out of the loop of regions to improve the performance.
Change-Id: I9536d034ffe67caac2d4350f2e830528f5da5c34
To keep consistent with other projects and enable 'admin_or_owner' rule
in policy.json, this patch adds neccessary fields for policy check
target and use correct method to get context dictionary.
To be clear, the rule in policy.json 'project_id:%(project_id)s' comes
from Nova originally, the policy module will get project_id from
request URL to Nova service andn compare with project_id in the user
credential. For other projects which don't contain project_id in URL,
just get it from user credential to make the rule work properly.
Change-Id: I5979f2c5204e373cc4a84b1f6997845aabc891cb
Currently, only admin user can consume the billing REST
API which means tenant user can't monitor/audit their usage/cost
via API. This patch opens the API by making the project id as
optional for admin user and getting the project id from context
for non-admin user.
Change-Id: I497348dfae882892826ec8bcd2303195e4fe2b31
Oslo.config deprecated parameter enforce_type and change its
default value to True in Ifa552de0a994e40388cbc9f7dbaa55700ca276b0.
Remove the usage of it to avoid DeprecationWarning: "Using the
'enforce_type' argument is deprecated in version '4.0' and will be
removed in version '5.0': The argument enforce_type has changed its
default value to True and then will be removed completely."
Change-Id: I642a341e7532e4b0fdd0719c5cac6933842a4fa4
Related--Bug: #1517839
Support /credits API so that project users can track their current
credit by API. And the credits info can be also shown on the
distil panel.
Change-Id: I5b44d8b05b551c5db3416c00b7caf472c3350be8
The method assertEquals has been deprecated since python 2.7.
http://docs.python.org/2/library/unittest.html#deprecated-aliases
Also in Python 3, a deprecated warning is raised when using assertEquals
therefore we should use assertEqual instead.
Change-Id: I7410c0290403484aec621363661b9e12836a407a