pos_loyalty_discount_before.../README.md

60 lines
2.5 KiB
Markdown
Executable File

# 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 Rounding Fix**: Ensures exact zero-total for 100% discounts by generating individual reward lines for each item, preventing tax rounding discrepancies.
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.
### Backend Changes
- Extended `pos.session` (`models/pos_session.py`) to generate additional journal entry lines for 0-value orders.
- Extended `res.config.settings` 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