payment_residual_display/README.md
2025-11-19 15:57:33 +07:00

75 lines
2.5 KiB
Markdown

# 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
## 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 the counterpart lines (receivable/payable accounts) and write-off lines
3. Sums up their `amount_residual` or `amount_residual_currency` values
4. Displays the total unreconciled amount
## Fields Added
### `payment_residual`
- **Type**: Monetary (computed)
- **Currency**: Payment currency
- **Purpose**: Shows the residual amount not yet reconciled
- **Computation**: Based on `move_id.line_ids.amount_residual` and `amount_residual_currency`
### `payment_residual_currency`
- **Type**: Monetary (computed)
- **Currency**: Payment currency
- **Purpose**: Shows the residual amount in the payment's currency
## 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
## 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 using the same approach as Odoo's built-in `is_reconciled` field:
- Uses `_seek_for_lines()` to identify counterpart and write-off lines
- Filters for reconcilable accounts
- Sums the `amount_residual` or `amount_residual_currency` based on currency matching
- This ensures consistency with Odoo's core reconciliation logic
## 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.