| Availability |
Odoo Online
Odoo.sh
On Premise
|
| Odoo Apps Dependencies |
•
Invoicing (account)
• Sales (sale_management) • Discuss (mail) |
| Lines of code | 390 |
| Technical Name |
noi_target_discount |
| License | LGPL-3 |
| Website | http://nexorionis.odoo.com |
| Availability |
Odoo Online
Odoo.sh
On Premise
|
| Odoo Apps Dependencies |
•
Invoicing (account)
• Sales (sale_management) • Discuss (mail) |
| Lines of code | 390 |
| Technical Name |
noi_target_discount |
| License | LGPL-3 |
| Website | http://nexorionis.odoo.com |
🎯 Target Discount Configuration
Global discount based on customer historical invoice totals
📋 Overview
The Target Discount Configuration module allows you to automatically apply discounts to sales orders based on customer's historical posted invoice totals within a specified period (yearly or monthly).
📊 Historical Analysis
Automatically calculates customer's total invoiced amount for the configured period.
💰 Slab-based Discounts
Configure multiple discount slabs based on invoice amount thresholds.
📅 Flexible Periods
Support for yearly and monthly period configurations.
📑 Proper Accounting
Discount flows to invoice with dedicated discount account.
🔄 Process Flow
Configure
Discount Slabs
Create
Sale Order
Select
Customer
View Historical
& Discount %
Apply
Discount
Detailed Flow Steps
- Configure Discount Slabs: Set up target discount configuration with period type, year/month, and discount slabs.
- Create Sale Order: Create a new quotation/sales order.
- Select Customer: When you select a customer, the system automatically calculates their historical invoice total.
- View Information: The system displays:
- Historical Invoice Total
- Target Discount Percentage (based on slab)
- Target Discount Amount (calculated when applying)
- Apply Discount: Click "Apply Target Discount" to add the discount line to the order.
⚙️ Configuration Guide
Step 1: Create Target Discount Product
The module automatically creates a "Target Discount" product. If needed, you can manually create one:
- Go to Sales → Products → Products
- Create a new product with:
- Name: "Target Discount"
- Type: Service
- Check "Is Target Discount Product" in the Sales tab
- Remove all taxes (Customer Taxes should be empty)
Step 2: Create Discount Configuration
- Go to Sales → Configuration → Target Discount Configuration
- Click Create
- Fill in the configuration:
Field Description Name Descriptive name for this configuration Period Type Select "Yearly" or "Monthly" Year The year for calculating historical invoices Month Required if Period Type is "Monthly" Discount Account Contra-revenue account for discount journal entries Active Only one configuration can be active per company
Step 3: Configure Discount Slabs
Add discount slabs to define discount percentages based on historical invoice amounts:
| Minimum Amount | Discount (%) | Description |
|---|---|---|
| 0 | 0% | No discount for amounts below first threshold |
| 100,000 | 2% | 2% discount for totals ≥ 100,000 |
| 500,000 | 5% | 5% discount for totals ≥ 500,000 |
| 1,000,000 | 10% | 10% discount for totals ≥ 1,000,000 |
📖 Usage Guide
Creating a Sale Order with Target Discount
- Go to Sales → Orders → Quotations
- Click Create
- Select a Customer
- The system automatically calculates and displays:
- Historical Invoice Total: Sum of posted invoices for the configured period
- Target Discount (%): Discount percentage based on slabs
- The system automatically calculates and displays:
- Add Order Lines (products/services)
- Review the Target Discount Information section (below Terms & Conditions)
- Click "Apply Target Discount" button
- This calculates the discount amount based on order subtotal
- Adds a discount line with negative amount to the order
- Confirm the order and create invoice as usual
Removing Target Discount
- On the sale order, find the Target Discount Information section
- Click "Remove Target Discount" button
- The discount line will be removed from the order
📊 Accounting Flow
Invoice Journal Entry
When the sale order with target discount is invoiced, the journal entry includes:
| Account | Debit | Credit |
|---|---|---|
| Accounts Receivable | Net Amount | - |
| Sales Revenue | - | Gross Amount |
| Discount Account (Contra-Revenue) | Discount Amount | - |
| Tax Payable (if applicable) | - | Tax Amount |
❓ Frequently Asked Questions
Q: Why is the Historical Invoice Total showing 0?
A: This can happen if:
- The customer has no posted invoices in the configured period
- The order date doesn't match the configuration period (year/month)
- No active discount configuration exists for the company
Q: Why can't I see the Apply Target Discount button?
A: The button is hidden when:
- Target Discount Percentage is 0%
- A discount line has already been applied
- The order is not in Draft or Sent state
Q: Can I have multiple active configurations?
A: No, only one Target Discount Configuration can be active per company at a time.
Q: Does the discount include taxes?
A: No, the Target Discount product should have no taxes. The discount is applied before tax calculation on other line items.
Q: How are refunds handled?
A: Credit notes (refunds) are included in the historical invoice total calculation
using amount_total_signed, which is negative for refunds.
🔧 Technical Information
Models
| Model | Description |
|---|---|
target.discount.config |
Configuration for target discount periods and settings |
target.discount.slab |
Discount slabs with minimum amounts and percentages |
sale.order |
Extended with target discount fields and methods |
sale.order.line |
Extended with is_target_discount_line flag |
product.template |
Extended with is_target_discount boolean |
Key Fields on Sale Order
| Field | Type | Description |
|---|---|---|
historical_invoice_total |
Monetary | Sum of posted invoices for customer in period |
target_discount_percentage |
Float | Discount percentage based on slab |
target_discount_amount |
Monetary | Calculated discount amount |
has_target_discount |
Boolean | Computed: True if discount line exists |
Dependencies
sale_management- Sales Managementaccount- Invoicing
🏷️ Author & Support
Author: NexOrioins Techsphere
Maintainer: Rowan Ember
Website: nexorionis.odoo.com
Email: nexorionis.info@gmail.com
Please log in to comment on this module