# 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 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) - **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 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.