|
|
||
|---|---|---|
| __pycache__ | ||
| models | ||
| security | ||
| tests | ||
| views | ||
| __init__.py | ||
| __manifest__.py | ||
| .gitignore | ||
| FINAL_FIX.md | ||
| FIX_SUMMARY.md | ||
| JOURNAL_ENTRY_STRUCTURE.md | ||
| README.md | ||
| REQUIREMENT_EXPENSE_ACCOUNT.md | ||
| SCENARIOS.md | ||
| TEST_UPGRADE.md | ||
| UPGRADE_TO_V2.md | ||
Vendor Payment Diff Amount - Version 2.0
Overview
This module extends Odoo 17'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:
- Backup your database before upgrading
- After upgrade, existing single deductions will need to be manually converted to deduction lines
- The old fields (
amount_substract,substract_account_id) are now computed/removed
New Features
- Multiple Deduction Lines: Add as many deduction lines as needed to a single payment
- Individual Descriptions: Each deduction can have its own description
- Flexible Sequencing: Reorder deduction lines using drag-and-drop
- Automatic Totals: Total deductions calculated automatically
- 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
- Go to Accounting > Vendors > Payments
- Create a new outbound payment
- ⚠️ CRITICAL: Set the Expense Account field (e.g., "Telepon & Internet")
- Enter the payment amount
- 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
- The "Total Deductions" and "Final Payment Amount" are calculated automatically
- 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:
- Create a batch payment
- Add payment lines
- For each line, add deduction lines in the form view
- Generate payments - deductions are automatically transferred
Technical Details
New Models
payment.deduction.line: Stores individual deduction lines
Modified Models
account.payment: Addeddeduction_line_ids(One2many)account.batch.payment.line: Addeddeduction_line_ids(One2many)
Fields
Payment Deduction Line:
sequence: Order of deduction linessubstract_account_id: Account for this deduction (required)amount_substract: Deduction amount (required)name: Optional descriptionpayment_id: Link to paymentbatch_payment_line_id: Link to batch payment line
Account Payment:
deduction_line_ids: One2many to deduction linesamount_substract: Computed total of all deductionsfinal_payment_amount: Computed (amount - total deductions)
Requirements
- Odoo 17.0
accountmodulevendor_batch_payment_mergemodule
License
LGPL-3
Author
Suherdy Yacob