Go to file
2026-05-06 13:45:20 +07:00
models fix: prevent duplicate deduction accounting entries and update documentation to reStructuredText format 2026-05-06 11:32:43 +07:00
security feat: Upgrade module to Odoo 19, updating view definitions from tree to list and refining account domains. 2026-01-21 10:57:40 +07:00
tests fix calculation when using advance account 2026-01-23 13:03:23 +07:00
views feat: Upgrade module to Odoo 19, updating view definitions from tree to list and refining account domains. 2026-01-21 10:57:40 +07:00
wizard fix calculation when using advance account 2026-01-23 13:03:23 +07:00
__init__.py feat: Upgrade module to Odoo 19, updating view definitions from tree to list and refining account domains. 2026-01-21 10:57:40 +07:00
__manifest__.py feat: Upgrade module to Odoo 19, updating view definitions from tree to list and refining account domains. 2026-01-21 10:57:40 +07:00
.gitignore feat: Upgrade module to Odoo 19, updating view definitions from tree to list and refining account domains. 2026-01-21 10:57:40 +07:00
AMOUNT_FIX_GUIDE.md feat: Upgrade module to Odoo 19, updating view definitions from tree to list and refining account domains. 2026-01-21 10:57:40 +07:00
CHANGELOG.md feat: Upgrade module to Odoo 19, updating view definitions from tree to list and refining account domains. 2026-01-21 10:57:40 +07:00
fix_amount_issue.py fix calculation when using advance account 2026-01-23 13:03:23 +07:00
README.rst docs: adjust underline length in README.rst to match header title width 2026-05-06 13:45:20 +07:00

========================================
Vendor Payment Diff Amount - Version 2.0
========================================

Overview
========

This module extends Odoo's vendor payment functionality to support **multiple payment deductions** 
such as withholding tax, payment fees, and other charges.

Version 2.0 Changes
===================

Major Update: One2Many Deduction Lines
--------------------------------------

Version 2.0 introduces a significant architectural change:

**Before (v1.x):**
* Single deduction amount field (`amount_substract`)
* Single deduction account field (`substract_account_id`)
* One payment could have only one deduction

**After (v2.0):**
* Multiple deduction lines (`deduction_line_ids`)
* Each deduction line has its own amount and account
* One payment can have multiple deductions with different accounts
* Total deductions computed automatically

Migration Notes
---------------

**Important:** This is a breaking change. Existing payments with deductions will need to be migrated.

If you have existing payments with `amount_substract` and `substract_account_id` values, you should:

1. Backup your database before upgrading
2. After upgrade, existing single deductions will need to be manually converted to deduction lines
3. The old fields (`amount_substract`, `substract_account_id`) are now computed/removed

New Features
------------

1. **Multiple Deduction Lines**: Add as many deduction lines as needed to a single payment
2. **Individual Descriptions**: Each deduction can have its own description
3. **Flexible Sequencing**: Reorder deduction lines using drag-and-drop
4. **Automatic Totals**: Total deductions calculated automatically
5. **Batch Payment Support**: Deduction lines work seamlessly with batch payments

Usage
=====

⚠️ IMPORTANT: Expense Account Required
--------------------------------------

**When using payment deductions, you MUST set the Expense Account field first.**

Creating a Payment with Deductions
----------------------------------

1. Go to Accounting > Vendors > Payments
2. Create a new outbound payment
3. **⚠️ CRITICAL: Set the Expense Account field** (e.g., "Telepon & Internet")
4. Enter the payment amount
5. In the "Deductions" section, add one or more deduction lines:
    * Select the deduction account (e.g., PPh 21 - Withholding Tax)
    * Enter the deduction amount
    * Optionally add a description
6. The "Total Deductions" and "Final Payment Amount" are calculated automatically
7. Post the payment

**Note:** If you try to add deductions without setting the Expense Account, you will get a validation error.

Journal Entry Structure
-----------------------

For a payment of 2000 with two deductions (100 for tax, 50 for fees):

::

    Expense/Payable Account    Debit: 2000   (original amount)
    Tax Account (PPh 21)       Credit: 100   (first deduction)
    Fee Account (PPh 29)       Credit: 50    (second deduction)
    Bank Account               Credit: 1850  (final payment amount)
    ---
    Total: Debit 2000 = Credit 2000 (balanced)

Batch Payments
--------------

When using with `vendor_batch_payment_merge`:

1. Create a batch payment
2. Add payment lines
3. For each line, add deduction lines in the form view
4. Generate payments - deductions are automatically transferred

Technical Details
=================

New Models
----------

* `payment.deduction.line`: Stores individual deduction lines

Modified Models
---------------

* `account.payment`: Added `deduction_line_ids` (One2many)
* `account.batch.payment.line`: Added `deduction_line_ids` (One2many)

Fields
------

**Payment Deduction Line:**
* `sequence`: Order of deduction lines
* `substract_account_id`: Account for this deduction (required)
* `amount_substract`: Deduction amount (required)
* `name`: Optional description
* `payment_id`: Link to payment
* `batch_payment_line_id`: Link to batch payment line

**Account Payment:**
* `deduction_line_ids`: One2many to deduction lines
* `amount_substract`: Computed total of all deductions
* `final_payment_amount`: Computed (amount - total deductions)

Requirements
============

* Odoo 17.0+
* `account` module
* `vendor_batch_payment_merge` module

License
=======

LGPL-3

Author
======

Suherdy Yacob