-
Notifications
You must be signed in to change notification settings - Fork 348
Description
Describe the issue
This issue tracks four related bugs in the Usage-Based Billing (UBB) area of Subscription Billing, all affecting the correctness of usage data processing, pricing, invoicing, and archiving.
1. Usage data import only supports total amounts — unit prices are ignored
When a usage data supplier is configured to take sales prices from the import file, the system only handles total amounts correctly. If the import file provides unit prices instead, the total amount is not calculated, resulting in billing lines and sales invoices with an amount of 0.
2. Usage data with foreign currencies calculates amounts incorrectly
When imported usage data contains a currency different from the local currency (LCY) configured in General Ledger Setup, amounts are calculated incorrectly. There is no validation that checks whether the currency in the usage data matches the currency of the vendor or customer subscription contract, and no currency conversion is applied when they differ.
3. Posting a credit memo from usage data import duplicates billing lines
When imported usage data results in a net negative amount and a credit memo is created and posted, all Usage Data Billing Lines associated with that credit memo are duplicated. This causes the next billing run to generate an identical credit memo again, repeating indefinitely with each subsequent posting.
4. Usage-based billing fields are not preserved in sales document archives
When a sales quote or order containing usage-based billing lines is archived, three fields are not transferred to the archive — Usage Based Billing, Usage Based Pricing, and Pricing Unit Cost Surcharge % — because they do not exist on the Sales Subscription Line Archive table. As a result, creating a new quote from an archived document produces subscription lines without the correct UBB configuration.
Expected behavior
-
When processing usage data, if either the unit price or the total amount is missing, the system should calculate the missing value from the available data. After processing, Quantity, Unit Price, and Amount should all have values on billing lines.
-
Currency mismatches between usage data and subscription contracts should either raise a clear processing error, or the system should apply proper currency conversion so that purchase and sales invoices are generated in the contract's currency.
-
Posting a credit memo generated from usage data should not create new Usage Data Billing Lines. The system should recognize it as a regular contract credit memo and handle it accordingly.
-
All usage-based billing fields should be included in the Sales Subscription Line Archive so that archived documents fully reflect the original and can be restored correctly.
Steps to reproduce
Issue 1 — Unit prices ignored in usage data import
- Set up a usage data supplier with Unit Price from Import enabled.
- Prepare an import file that provides unit prices (not total amounts).
- Import and process the file, then create a sales invoice.
- ❌ The amount on the billing lines and invoice is 0.
Issue 2 — Foreign currency amounts calculated incorrectly
- Set up a vendor subscription contract in local currency (e.g. RSD).
- Prepare a usage data import file with amounts in a foreign currency (e.g. USD).
- Import and process the usage data, then create purchase and sales invoices.
- ❌ Amounts are calculated incorrectly; no currency conversion is applied and no error is raised.
Issue 3 — Credit memo posting duplicates billing lines
- Import usage data where the lines for Partner = Customer sum to a negative amount.
- Run Create Customer Invoice — a credit memo is created.
- Post the credit memo.
- ❌ All Usage Data Billing Lines from the credit memo are duplicated.
- Run the invoicing process for the next billing period.
- ❌ An identical credit memo is created again; the loop repeats on every posting.
Issue 4 — UBB fields missing from sales document archive
- Create a sales quote or order with a subscription line that has usage-based billing configured.
- Archive the document.
- Create a new sales quote from the archive.
- ❌ The new quote's subscription lines are missing
Usage Based Billing,Usage Based Pricing, andPricing Unit Cost Surcharge %values.
- ❌ The new quote's subscription lines are missing
Additional context
No response
I will provide a fix for a bug
- I will provide a fix for a bug