diff --git a/.gitignore b/.gitignore old mode 100644 new mode 100755 diff --git a/CHANGELOG.md b/CHANGELOG.md old mode 100644 new mode 100755 diff --git a/README.md b/README.md old mode 100644 new mode 100755 index c7a199e..0754d30 --- a/README.md +++ b/README.md @@ -8,6 +8,7 @@ This module adds residual amount display to customer and vendor payments in Odoo - **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 @@ -22,15 +23,17 @@ The module extends the `account.payment` model with a computed field that: ## Fields Added ### `payment_residual` -- **Type**: Monetary (computed) +- **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) +- **Type**: Monetary (computed, stored) - **Currency**: Payment currency - **Purpose**: Shows the residual amount in the payment's currency +- **Aggregation**: Supports "sum" operator ## Usage @@ -46,6 +49,11 @@ The module extends the `account.payment` model with a computed field that: 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 diff --git a/__init__.py b/__init__.py old mode 100644 new mode 100755 diff --git a/__manifest__.py b/__manifest__.py old mode 100644 new mode 100755 index 1b26d5c..c3ec389 --- a/__manifest__.py +++ b/__manifest__.py @@ -1,6 +1,6 @@ { 'name': 'Payment Residual Display', - 'version': '17.0.1.0.0', + 'version': '17.0.1.1.0', 'category': 'Accounting', 'summary': 'Display residual amounts in customer payment lines', 'description': """ @@ -11,6 +11,7 @@ - Shows residual amount in payment form view - Computes residual from journal items automatically - Helps identify partially reconciled payments + - Supports aggregation and grouping by residual fields See README.md for more details. """, diff --git a/__pycache__/__init__.cpython-310.pyc b/__pycache__/__init__.cpython-310.pyc old mode 100644 new mode 100755 diff --git a/models/__init__.py b/models/__init__.py old mode 100644 new mode 100755 diff --git a/models/__pycache__/__init__.cpython-310.pyc b/models/__pycache__/__init__.cpython-310.pyc old mode 100644 new mode 100755 diff --git a/models/__pycache__/account_payment.cpython-310.pyc b/models/__pycache__/account_payment.cpython-310.pyc old mode 100644 new mode 100755 diff --git a/models/account_payment.py b/models/account_payment.py old mode 100644 new mode 100755 index 0ff970f..8366b65 --- a/models/account_payment.py +++ b/models/account_payment.py @@ -12,7 +12,8 @@ class AccountPayment(models.Model): compute='_compute_payment_residual', currency_field='currency_id', help="Residual amount of this payment (amount not yet reconciled)", - readonly=True + readonly=True, + store=True ) payment_residual_currency = fields.Monetary( @@ -20,7 +21,8 @@ class AccountPayment(models.Model): compute='_compute_payment_residual', currency_field='currency_id', help="Residual amount in payment currency", - readonly=True + readonly=True, + store=True ) @api.depends('move_id.line_ids.amount_residual', diff --git a/views/account_payment_views.xml b/views/account_payment_views.xml old mode 100644 new mode 100755 index ea939ec..0566cae --- a/views/account_payment_views.xml +++ b/views/account_payment_views.xml @@ -12,11 +12,13 @@ widget="monetary" options="{'currency_field': 'currency_id'}" string="Residual" + sum="Total Residual" optional="hide"/>