payment_residual_display/README.md

86 lines
3.2 KiB
Markdown
Executable File

# Payment Residual Display
This module adds residual amount display to customer and vendor payments in Odoo 17.
## Features
- **Residual Amount Field**: Shows the unreconciled amount remaining on each payment
- **List View Integration**: Adds "Residual" column to payment list views (hidden by default)
- **Form View Integration**: Displays residual amount in payment form view
- **Multi-Currency Support**: Handles both company currency and payment currency residuals
- **Aggregation Support**: Enables "sum" aggregation in list views and when grouping by any field (e.g., Partner, Journal)
## How It Works
The module extends the `account.payment` model with a computed field that:
1. Retrieves the journal entry lines created by the payment
2. Identifies only the counterpart lines (receivable/payable accounts)
3. Excludes liquidity account lines (bank/cash) to avoid false residuals when matched with bank statements
4. Sums up their `amount_residual` or `amount_residual_currency` values based on currency
5. Displays the total unreconciled amount
## Fields Added
### `payment_residual`
- **Type**: Monetary (computed, stored)
- **Currency**: Payment currency
- **Purpose**: Shows the residual amount not yet reconciled
- **Aggregation**: Supports "sum" operator for totals and grouping
- **Computation**: Based on `move_id.line_ids.amount_residual` and `amount_residual_currency`
### `payment_residual_currency`
- **Type**: Monetary (computed, stored)
- **Currency**: Payment currency
- **Purpose**: Shows the residual amount in the payment's currency
- **Aggregation**: Supports "sum" operator
## Usage
### In List View
1. Go to **Accounting → Customers → Payments** (or **Vendors → Payments**)
2. Click the column selector (☰ icon)
3. Enable the "Residual" column
4. You'll see the unreconciled amount for each payment
### In Form View
1. Open any customer or vendor payment
2. The "Residual Amount" field appears after the payment amount
3. Shows 0.00 for fully reconciled payments
4. Shows the remaining amount for partially reconciled payments
### Grouping and Aggregation
1. In the payment list view, use the **Group By** filter (e.g., by **Partner** or **Journal**)
2. The group headers will display the total sum of the residual amounts for each group
3. The bottom of the list view displays the total residual for all visible records
## Technical Details
### Dependencies
- `account` - Core Accounting module
### Inheritance
- Extends: `account.payment`
- Views inherited:
- `account.view_account_payment_tree`
- `account.view_account_payment_form`
### Computation Logic
The residual is computed by:
- Filtering only receivable/payable account lines (excludes liquidity accounts)
- This prevents showing residuals when payments are matched with bank statements
- Sums the `amount_residual` or `amount_residual_currency` based on payment currency
- Uses company currency residual for same-currency payments
- Uses foreign currency residual for multi-currency payments
- This ensures accurate residual display regardless of bank statement matching
## Installation
1. Copy the module to your Odoo addons directory
2. Update the apps list
3. Install "Payment Residual Display"
4. No additional configuration needed
## Author
Created for Odoo 17 accounting workflow enhancement.