Show current service usage #193
Labels
No labels
API
Billing
UI/UX
dependencies
bug
change
duplicate
enhancement
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
servala/servala-portal#193
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Stories
As a user, I want to see my current service usage which will lead into an invoice
Implementation Notes
This means we should display analytic lines from Odoo in a user friendly way.
Design ready
Spec:
docs/plans/2026-10-19-service-usage-view-design.md(commitc5f381de)What the customer gets
A new page
/{org}/usage/with an entry "Usage" in the Organization menu, below"Invoices". One row per Odoo sale order line: instance, service, quantity, money
accrued this month, money expected at month end. A CSS bar shows accrued against
expected per row, and a total row closes the table.
Where the numbers come from
account.analytic.linewithinstance_event = true. Thevshn_event_billingcron writes one row per day per order line, frominstance_start_timeto today, refreshed hourly. Trial hours carry quantity 0.rule: open line price first, then pricelist, then the catalog fallback.
full day is
(24/730) x instance_size, so the forecast does not depend on thetime of day.
instance_idagainstServiceInstance.name. The longest name wins. A tie leaves the row unlinkedwith the product label.
Decisions
by
order_idwould show one customer the money of another. No Odoo read happens.page. The accrued column is already correct, because Odoo zeroes trial hours.
Feature.SERVICE_USAGE, default off.header clock stays Zurich time.
which matches how the invoice is built.
First step of the plan: verify on prod
Preprod has 8'086 order lines with an
instance_idbut zero usage analyticrows. Every analytic row there is hours, and
billable_metered_usageis false onall of them. So three facts are unverified:
instance_id. Is that UUID aServiceInstance.namein the portal?instance_idinname, and doesunit_amountsum toqty_invoiced + qty_to_invoicefor the same window?If item 1 fails, the compute and storage rows still join, and the managed service
rows stay unlinked with the product label. That is acceptable, not a blocker.
Next step: the implementation plan.
Layout decided
We mocked the page in a browser and settled the shape. Spec updated:
docs/plans/2026-10-19-service-usage-view-design.md(commitc151e21c).The page
It reads like a bill, not like a table.
On the right, right aligned, Accrued so far and Expected at month end in
the success color. A footnote explains the forecast and carries a
"How this is calculated" toggle.
has its own border, the instance name linked to the instance page, its size tag,
its instance id, and its own expected subtotal.
this instance expensive", for example storage being half of it.
line the customer can hold against the invoice.
Small rules that keep it honest
so a "time left in the month" bar would be misread.
item keeps its color in every block.
there is no separate legend line.
accrued and expected is the point of the page.
aria-hiddendecoration, and the footnote toggle is a native<details>, so it works without JavaScript.States
forecast covers 20.10. to 31.10." Zero accrued plus a real forecast would otherwise
look like a bug.
numbers. A zero would be a lie that the customer would believe.
Mobile
Two labelled columns per item: name and share on top, accrued on the left and expected
on the right below.
Next step: the implementation plan.