fix journal movement
This commit is contained in:
parent
53e95fb370
commit
8e004d822b
40
CHANGELOG.md
40
CHANGELOG.md
@ -1,40 +0,0 @@
|
||||
# Changelog
|
||||
|
||||
## Version 2.0.0 (2024)
|
||||
|
||||
### Major Changes
|
||||
- **Breaking Change**: Converted from single deduction fields to multiple deduction lines (One2many)
|
||||
- Added new model `payment.deduction.line` for storing individual deductions
|
||||
- `amount_substract` is now a computed field (sum of all deduction lines)
|
||||
- Removed `substract_account_id` field (replaced by deduction lines)
|
||||
|
||||
### Features
|
||||
- Support for multiple deductions per payment
|
||||
- Each deduction can have its own account and description
|
||||
- Drag-and-drop reordering of deduction lines
|
||||
- Automatic calculation of total deductions
|
||||
- Full integration with batch payments
|
||||
|
||||
### Views
|
||||
- Updated payment form to show editable tree of deduction lines
|
||||
- Updated batch payment to support deduction lines in form view
|
||||
- Added total deductions column to batch payment tree view
|
||||
|
||||
### Technical
|
||||
- Added security rules for `payment.deduction.line` model
|
||||
- Updated journal entry creation to handle multiple deduction lines
|
||||
- Maintained backward compatibility for journal entry structure
|
||||
|
||||
### Migration
|
||||
- See UPGRADE_TO_V2.md for detailed migration instructions
|
||||
- Existing payments with single deductions need manual migration
|
||||
|
||||
## Version 1.0.0 (Initial Release)
|
||||
|
||||
### Features
|
||||
- Single deduction amount per payment
|
||||
- Single deduction account per payment
|
||||
- Final payment amount calculation
|
||||
- Journal entry with deduction line
|
||||
- Integration with batch payments
|
||||
- Validation for deduction amounts
|
||||
238
USER_GUIDE.md
238
USER_GUIDE.md
@ -1,238 +0,0 @@
|
||||
# User Guide: Payment Deductions
|
||||
|
||||
## ⚠️ IMPORTANT: Expense Account Required
|
||||
|
||||
**When using payment deductions, you MUST set the Expense Account field.**
|
||||
|
||||
This is a requirement to ensure proper journal entry creation.
|
||||
|
||||
## Quick Start Guide
|
||||
|
||||
### Step-by-Step: Creating a Payment with Deductions
|
||||
|
||||
1. **Go to Accounting > Vendors > Payments**
|
||||
|
||||
2. **Create New Payment**
|
||||
- Payment Type: Send Money (Outbound)
|
||||
- Partner Type: Vendor
|
||||
- Partner: Select your vendor (e.g., PT Telkom Indonesia)
|
||||
|
||||
3. **⚠️ CRITICAL: Set Expense Account FIRST**
|
||||
- Expense Account: Select the expense account (e.g., "611505 Telepon & Internet")
|
||||
- This field is REQUIRED when using deductions
|
||||
|
||||
4. **Enter Payment Amount**
|
||||
- Amount: Enter the full amount (e.g., 2,000,000)
|
||||
|
||||
5. **Add Deductions**
|
||||
- Click "Add a line" in the Deductions section
|
||||
- For each deduction:
|
||||
- Deduction Account: Select tax account (e.g., "PPh 21")
|
||||
- Deduction Amount: Enter amount (e.g., 100,000)
|
||||
- Description: Optional (e.g., "Withholding Tax")
|
||||
|
||||
6. **Verify Amounts**
|
||||
- Total Deductions: Should show sum of all deductions
|
||||
- Final Payment Amount: Should show amount minus deductions
|
||||
|
||||
7. **Post Payment**
|
||||
- Click "Confirm" to post the payment
|
||||
|
||||
## Example
|
||||
|
||||
### Scenario: Paying PT Telkom with Tax Withholding
|
||||
|
||||
**Payment Details:**
|
||||
- Vendor: PT Telkom Indonesia
|
||||
- Expense Account: 611505 Telepon & Internet
|
||||
- Amount: Rp 2,000,000
|
||||
|
||||
**Deductions:**
|
||||
- PPh 21: Rp 100,000
|
||||
- PPh 29: Rp 50,000
|
||||
|
||||
**Result:**
|
||||
- Total Deductions: Rp 150,000
|
||||
- Final Payment Amount: Rp 1,850,000
|
||||
|
||||
**Journal Entry Created:**
|
||||
```
|
||||
611505 Telepon & Internet Debit: Rp 2,000,000
|
||||
217101 PPh 21 Credit: Rp 100,000
|
||||
117104 PPh 29 Credit: Rp 50,000
|
||||
Bank Account Credit: Rp 1,850,000
|
||||
```
|
||||
|
||||
## Common Mistakes
|
||||
|
||||
### ❌ Mistake 1: Not Setting Expense Account
|
||||
|
||||
**Error:** "Expense Account is required when using payment deductions"
|
||||
|
||||
**Solution:** Set the Expense Account field before adding deductions
|
||||
|
||||
### ❌ Mistake 2: Using Wrong Account for Deductions
|
||||
|
||||
**Problem:** Trying to use Accounts Payable for deductions
|
||||
|
||||
**Solution:** Use tax payable accounts (PPh 21, PPh 23, PPh 29, etc.)
|
||||
|
||||
### ❌ Mistake 3: Deductions Exceed Payment Amount
|
||||
|
||||
**Error:** "Total deductions cannot be greater than the payment amount"
|
||||
|
||||
**Solution:** Reduce deduction amounts or increase payment amount
|
||||
|
||||
## Account Setup
|
||||
|
||||
### Required Accounts
|
||||
|
||||
Before using this feature, ensure you have these accounts set up:
|
||||
|
||||
#### 1. Expense Accounts
|
||||
```
|
||||
611505 - Telepon & Internet (Expense)
|
||||
612001 - Office Supplies (Expense)
|
||||
etc.
|
||||
```
|
||||
|
||||
#### 2. Tax Payable Accounts
|
||||
```
|
||||
217101 - PPh 21 (Current Liability)
|
||||
217102 - PPh 23 (Current Liability)
|
||||
117104 - PPh 29 (Current Liability)
|
||||
```
|
||||
|
||||
### Account Types
|
||||
|
||||
| Account Purpose | Account Type | Example |
|
||||
|----------------|--------------|---------|
|
||||
| Expense Account | Expense | Telepon & Internet |
|
||||
| Tax Deductions | Current Liability | PPh 21, PPh 23, PPh 29 |
|
||||
| Bank | Bank and Cash | Bank BCA |
|
||||
|
||||
## Workflow
|
||||
|
||||
### Standard Payment Flow
|
||||
|
||||
```
|
||||
1. Create Payment
|
||||
↓
|
||||
2. Set Expense Account ⚠️ REQUIRED
|
||||
↓
|
||||
3. Enter Amount
|
||||
↓
|
||||
4. Add Deductions
|
||||
↓
|
||||
5. Verify Totals
|
||||
↓
|
||||
6. Post Payment
|
||||
↓
|
||||
7. Journal Entry Created
|
||||
```
|
||||
|
||||
### Batch Payment Flow
|
||||
|
||||
```
|
||||
1. Create Batch Payment
|
||||
↓
|
||||
2. Add Payment Lines
|
||||
↓
|
||||
3. For each line:
|
||||
- Set Expense Account ⚠️ REQUIRED
|
||||
- Add Deductions
|
||||
↓
|
||||
4. Generate Payments
|
||||
↓
|
||||
5. Payments Created with Deductions
|
||||
```
|
||||
|
||||
## Tips & Best Practices
|
||||
|
||||
### ✅ Do This:
|
||||
|
||||
1. **Always set Expense Account first** before adding deductions
|
||||
2. **Use descriptive names** for deductions (e.g., "PPh 21 - January 2025")
|
||||
3. **Verify amounts** before posting
|
||||
4. **Use correct tax accounts** for deductions
|
||||
5. **Keep deductions organized** with clear descriptions
|
||||
|
||||
### ❌ Don't Do This:
|
||||
|
||||
1. **Don't skip Expense Account** - it's required!
|
||||
2. **Don't use Accounts Payable** for deductions
|
||||
3. **Don't exceed payment amount** with deductions
|
||||
4. **Don't use bank accounts** for deductions
|
||||
5. **Don't forget to verify** final payment amount
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Problem: Can't add deductions
|
||||
|
||||
**Cause:** Expense Account not set
|
||||
|
||||
**Solution:**
|
||||
1. Set the Expense Account field
|
||||
2. Then add deductions
|
||||
|
||||
### Problem: Wrong journal entry
|
||||
|
||||
**Cause:** Using wrong account types
|
||||
|
||||
**Solution:**
|
||||
- Expense Account: Use expense account type
|
||||
- Deductions: Use tax payable (current liability) accounts
|
||||
|
||||
### Problem: Payment doesn't balance
|
||||
|
||||
**Cause:** Deductions exceed payment amount
|
||||
|
||||
**Solution:**
|
||||
- Check Total Deductions
|
||||
- Ensure it's less than Amount
|
||||
- Adjust deduction amounts if needed
|
||||
|
||||
## FAQ
|
||||
|
||||
### Q: Why is Expense Account required?
|
||||
|
||||
**A:** The Expense Account is required to ensure proper journal entry creation. It specifies which expense account should be debited for the full amount.
|
||||
|
||||
### Q: Can I use Accounts Payable instead of Expense Account?
|
||||
|
||||
**A:** No. When using deductions, you must use an Expense Account. This ensures the correct accounting treatment where:
|
||||
- Expense is recorded at full amount
|
||||
- Tax liabilities are created
|
||||
- Bank is reduced by net amount
|
||||
|
||||
### Q: What accounts can I use for deductions?
|
||||
|
||||
**A:** Use tax payable accounts (Current Liability type) such as:
|
||||
- PPh 21 (Income Tax Article 21)
|
||||
- PPh 23 (Income Tax Article 23)
|
||||
- PPh 29 (Income Tax Article 29)
|
||||
- Other tax withholding accounts
|
||||
|
||||
### Q: Can I have multiple deductions?
|
||||
|
||||
**A:** Yes! You can add as many deduction lines as needed. Each deduction can have its own account and amount.
|
||||
|
||||
### Q: What if I don't have deductions?
|
||||
|
||||
**A:** If you don't have deductions, you don't need to set the Expense Account. You can use the standard payment flow with Accounts Payable.
|
||||
|
||||
## Support
|
||||
|
||||
For additional help:
|
||||
1. Check the module documentation
|
||||
2. Review example payments
|
||||
3. Contact your system administrator
|
||||
4. Refer to FINAL_FIX.md for technical details
|
||||
|
||||
## Version
|
||||
|
||||
This guide is for version 2.0.0 of the vendor_payment_diff_amount module.
|
||||
|
||||
---
|
||||
|
||||
**Remember: Always set the Expense Account before adding deductions!** ⚠️
|
||||
@ -13,12 +13,15 @@ class AccountBatchPayment(models.Model):
|
||||
|
||||
# First, try to use the journal's available payment methods
|
||||
available_payment_methods = self.journal_id._get_available_payment_method_lines(self.batch_type)
|
||||
payment_method_line = available_payment_methods.filtered(lambda x: x.code == 'direct_batch')
|
||||
# Fix: Check payment_method_id.code, not just code
|
||||
payment_method_line = available_payment_methods.filtered(lambda x: x.payment_method_id.code == 'direct_batch')
|
||||
|
||||
if not payment_method_line:
|
||||
# If no direct batch payment method found, use the first available payment method
|
||||
# If no direct batch payment method found, prefer 'manual' method for bank journals
|
||||
if available_payment_methods:
|
||||
payment_method_line = available_payment_methods[0]
|
||||
# Try to find 'manual' payment method (most common for bank transfers)
|
||||
manual_method = available_payment_methods.filtered(lambda x: x.payment_method_id.code == 'manual')
|
||||
payment_method_line = manual_method[:1] if manual_method else available_payment_methods[0]
|
||||
else:
|
||||
# Fallback: try to find or create a direct batch payment method line
|
||||
payment_method_line = self.env['account.payment.method.line'].search([
|
||||
|
||||
Loading…
Reference in New Issue
Block a user