Files

GRT Sales Commission

Overview

GRT Sales Commission extends Odoo Sales to calculate salesperson commission and post commission payment journal entries.

The module supports:

  • Commission per Sales Order
  • Commission by weight (Kg) or by unit
  • Eligible salesperson filtering per company
  • Monthly settlement reporting with paid/unpaid tracking and aging buckets
  • Payment posting to Accounting via journal entry

Technical Information

  • Module name: grt_sales_commission
  • Odoo version target: 14.0
  • Current version: 14.0.1.0.0
  • Dependencies:
    • sale_management
    • account
    • grt_sales_business_category

Features

1. Commission Configuration (Company Level)

In Sales settings, configure:

  • Sales Commission Rate
  • Eligible Sales Users
  • Sales Commission Calculation Basis:
    • Quotation and Sales Order
    • Confirmed Sales Order Only
  • Default Sales Commission Calculation Method:
    • By Weight (Kg)
    • By Unit
  • Sales Commission Expense Account
  • Sales Commission Payment Journal

2. Product Configuration

In Product form, configure:

  • Commission Weight per Unit (Kg)

Notes:

  • Product setup no longer decides whether commission applies.
  • Weight per Unit is only used when the Sales Order commission method is By Weight.
  • If a Sales Order uses By Weight, every product line in that order should have Commission Weight per Unit (Kg) filled.

3. Sales Order Commission Computation

Commission is controlled once at Sales Order level and then computed across all order lines consistently.

Additional sales order information:

  • Apply Sales Commission (yes/no for the whole order)
  • Sales Commission Method (By Weight or By Unit for the whole order)
  • Commission eligible status
  • Commission basis total and basis unit
  • Commission amount
  • Paid/unpaid status
  • Payment move reference
  • Paid datetime and paid by user

A dedicated Commission Calculation tab shows per-line details:

  • Ordered quantity and UoM
  • Converted commission basis quantity
  • Basis UoM
  • Commission amount
  • Human-readable formula

Important rule:

  • One Sales Order must use one commission treatment only.
  • If some items should use commission and others should not, create a separate Sales Order.
  • If some items should use By Weight and others By Unit, create separate Sales Orders.

4. Commission Payment Journal Entry

From Sales Order, click Pay Sales Commission.

Validation checks include:

  • User must be Accounting User (server-side authorization)
  • Not already paid
  • Commission amount > 0
  • Salesperson is eligible
  • Order is eligible per configured calculation basis
  • Payment journal configured
  • Expense account configured
  • Journal has liquidity account

Journal entry posted:

  • Debit: Sales Commission Expense Account
  • Credit: Payment Journal Liquidity Account

Business category behavior:

  • The payment move inherits business_category_id from the Sales Order.
  • The payment move inherits analytic_account_id from the Sales Order business category.
  • The journal lines also receive the same analytic account so the commission payment stays consistent with the Sales business category pattern.

After posting:

  • Order marked as commission paid
  • Payment move linked to the order
  • Payment metadata stored (datetime, user)

Concurrency behavior:

  • Payment uses database row locking on Sales Order before posting, so concurrent RPC/UI calls cannot create duplicate commission journal entries for the same order.

5. Reporting

The module provides:

  • Sales Commission Report
  • Monthly Commission Settlement report

Monthly settlement includes:

  • Pivot analysis by salesperson and order month
  • Paid/unpaid analysis
  • Unpaid aging buckets:
    • 0-30 days
    • 31-60 days
    • 61-90 days
    • 90 days

Calculation Logic

A. By Weight (Kg)

  1. Convert ordered quantity to product reference UoM
  2. Weight total = converted qty x commission weight per unit (Kg)
  3. Commission amount = weight total x commission rate

Formula: commission = qty_in_product_uom x weight_per_unit_kg x rate

B. By Unit

  1. Convert ordered quantity to product reference UoM
  2. Basis qty = converted qty
  3. Commission amount = basis qty x commission rate

Formula: commission = qty_in_product_uom x rate

Menu and User Flow

Configuration

  • Sales > Configuration > Settings > Sales Commission section

Product Setup

  • Sales > Products > Products

Operational Use

  • Sales > Orders > Quotations / Sales Orders
  • Open order and set:
    • Apply Sales Commission
    • Sales Commission Method
  • Review Commission Calculation tab
  • Click Pay Sales Commission (accounting user)

Reporting

  • Sales > Reporting > Sales Commission Report
  • Sales > Reporting > Monthly Commission Settlement

Security and Access

  • Sales configuration and report menus are intended for Sales Manager users.
  • Payment action/button is restricted to Accounting users (account.group_account_user).
  • Payment is also protected server-side with group validation, so external RPC calls by unauthorized users are rejected.

Important Behavior Notes

  • If Calculation Basis is Confirmed Sales Order Only, commission amount is 0 while order is still quotation.
  • Commission is not computed for section/note lines.
  • Commission amount uses company currency rounding.
  • Commission is applied consistently per Sales Order, not per line.
  • Disabling commission on a Sales Order disables commission for all lines in that order.
  • If By Weight is used, all normal product lines in the order must have Commission Weight per Unit (Kg) greater than 0.
  • Commission payment now follows the Sales Business Category analytic pattern, so the Sales Order should already have a valid Business Category before payment is posted.
  • Commission payment flow is idempotent-safe per order under concurrent requests due to row-level locking and paid-state recheck.
  1. Weight method with same UoM
  2. Weight method with different line UoM (validate conversion)
  3. Unit method
  4. Commission disabled on Sales Order
  5. Eligible vs non-eligible salesperson
  6. Quotation vs confirmed order basis behavior
  7. Validation when By Weight is used but a product has no Commission Weight per Unit
  8. Payment posting and duplicate payment prevention
  9. Monthly settlement aging filters

Troubleshooting

  • Error: payment journal not configured
    • Set Sales Commission Payment Journal in settings or on the order.
  • Error: expense account not configured
    • Set Sales Commission Expense Account in settings.
  • Error: no liquidity account on journal
    • Configure default account on bank/cash journal.
  • Zero commission unexpectedly
    • Check salesperson eligibility, order state, Sales Order commission toggle, and product Commission Weight per Unit when using By Weight.
  • Error: some products invalid for By Weight
    • Fill Commission Weight per Unit (Kg) for every product in that Sales Order, or split the items into another Sales Order.
  • Error: you do not have permission to pay sales commission on this order
    • Use a user that belongs to Accounting User group (account.group_account_user).

Future Enhancements

  • Reversal action for commission payment moves
  • Automated monthly settlement posting
  • Approval workflow before payment
  • Additional order-level basis options (delivered qty, invoiced qty)
  • Automated tests for all commission methods and accounting flow

Changelog Summary

  • Changed commission logic to be controlled per Sales Order instead of per product line
  • Limited Sales Order commission method to weight or unit
  • Added Sales Order level toggle to apply or disable commission for the whole order
  • Added validation to force consistent treatment within one Sales Order
  • Added monthly settlement report and unpaid aging
  • Added commission payment posting with accounting journal entry
  • Added commission payment tracking fields on Sales Order
  • Updated commission payment journal entry to inherit Business Category and Analytic Account from Sales Order
  • Added server-side authorization guard for commission payment (secure for external RPC)
  • Added row-lock protection to prevent duplicate commission payment journals from concurrent requests

Update Default Type Behavior (2026-04-23)

Perubahan terbaru menyelaraskan default komisi dengan sale_order_type dari modul grt_sales_business_category.

Default method:

  • Sales Commission Method default untuk order baru sekarang By Weight (Kg)

Default berdasarkan sale_order_type:

  • reguler -> commission aktif, method By Weight (Kg)
  • kering -> commission aktif, method By Weight (Kg)
  • partus -> commission aktif, method By Weight (Kg)
  • peralatan -> commission nonaktif, method tetap default By Weight (Kg)
  • silase -> commission nonaktif, method tetap default By Weight (Kg)

Catatan:

  • default ini diterapkan saat create order dan saat sale_order_type diganti
  • user masih bisa melakukan penyesuaian manual setelah default terisi jika proses bisnis memerlukannya