Go to file
2026-03-12 15:05:08 +07:00
models Refactor 100% discount accounting by removing custom journal entries from pos_session and implementing dynamic account mapping in pos_order_line. 2026-03-12 15:05:08 +07:00
static/src/overrides/models feat: Group 100% loyalty discount reward lines for unified display in the POS UI and receipts while preserving individual lines for accurate accounting. 2026-02-13 16:48:07 +07:00
views feat: Add configurable accounting entries for 100% discounted Point of Sale orders. 2026-02-03 16:13:45 +07:00
__init__.py fix: Add pre-init hook to remove a problematic database constraint and table to resolve installation errors. 2026-02-04 15:20:20 +07:00
__manifest__.py feat: Group 100% loyalty discount reward lines for unified display in the POS UI and receipts while preserving individual lines for accurate accounting. 2026-02-13 16:48:07 +07:00
.gitignore feat: Add configurable accounting entries for 100% discounted Point of Sale orders. 2026-02-03 16:13:45 +07:00
README.md Refactor 100% discount accounting by removing custom journal entries from pos_session and implementing dynamic account mapping in pos_order_line. 2026-03-12 15:05:08 +07:00

POS Loyalty Discount Before Tax

This module modifies the loyalty reward discount calculation in POS to apply discounts before tax calculation and ensures that discount values are displayed as tax-exclusive in both the POS receipt and accounting entries.

Features

  1. Discount Calculation Before Tax: All loyalty rewards are calculated on the tax-exclusive amount rather than the tax-inclusive amount.

  2. Tax-Exclusive Display: Discount values are displayed as tax-exclusive in the POS receipt.

  3. Proper Accounting Entries: Accounting entries are created with tax only on the credit side, ensuring compliance with accounting standards.

  4. 100% Discount Unified Grouping: Ensures exact zero-total for 100% discounts by generating individual lines (to prevent rounding errors) but displays them as a single aggregated line in both the POS screen and printed receipt.

  5. Zero-Value Journal Entries: Automatically creates journal entries for orders with a 0.00 total (e.g., 100% discount) to track the "Foregone Income" and "Discount Expense". This is configurable via settings.

Technical Changes

JavaScript Changes

  • Modified static/src/overrides/models/loyalty.js to calculate discounts on tax-exclusive amounts.
  • Implemented "Line-by-Line Cancellation" for 100% discounts to fix rounding issues, with UI-level grouping for a clean display.
  • Added Orderline and Order overrides (static/src/overrides/models/orderline.js) to handle unified grouping, receipt filtering, and persistence.

Backend Changes

  • Extended pos.order.line (models/pos_order_line.py) to override _get_income_account. For 100% discount orders, this dynamically maps standard item lines to the custom Income Account and discount reward lines to the custom Expense Account during standard POS session aggregation, preventing double journal entries.
  • Extended res.config.settings (models/res_config_settings.py) to allow configuration of Income and Expense accounts for 100% discounts.

Installation

  1. Copy the module to your Odoo addons directory
  2. Update the apps list in Odoo
  3. Install the "POS Loyalty Discount Before Tax" module

Configuration

Zero-Value Journal Entries (100% Discount)

To enable journal entries for 0.00 total orders:

  1. Go to Point of Sale > Configuration > Settings.
  2. Scroll to the 100% Discount Accounting section.
  3. Select the Income Account (Credit) to track the gross sales value.
  4. Select the Expense/Discount Account (Debit) to track the discount cost.
  5. Save the settings.

If these accounts are not set, no journal entry will be created for 0.00 total orders.

Usage

The module works automatically with all existing loyalty programs. Discounts will be calculated on tax-exclusive amounts and displayed as such in the POS interface and accounting entries.

Compatibility

This module is compatible with Odoo 17 and requires the following modules:

  • point_of_sale
  • pos_loyalty

License

LGPL-3