4.1 KiB
4.1 KiB
Testing the Upgrade to v2.0
Pre-Upgrade Checklist
-
Backup your database
pg_dump your_database > backup_before_v2.sql -
Check for existing payments with deductions
# In Odoo shell payments = env['account.payment'].search([ ('amount_substract', '>', 0) ]) print(f"Found {len(payments)} payments with deductions")
Upgrade Steps
1. Update the Module
From Odoo UI:
- Go to Apps
- Remove "Apps" filter
- Search for "Vendor Payment Diff Amount"
- Click "Upgrade"
Or from command line:
./odoo-bin -u vendor_payment_diff_amount -d your_database --stop-after-init
2. Verify Installation
Check that:
- ✅ Module upgraded successfully without errors
- ✅ New model
payment.deduction.lineis created - ✅ Security rules are applied
3. Test Basic Functionality
Test 1: Create Payment with Single Deduction
- Go to Accounting > Vendors > Payments
- Create new outbound payment
- Enter amount: 1000
- Add deduction line:
- Account: Select a tax/expense account
- Amount: 100
- Description: "Withholding Tax"
- Verify:
- Total Deductions: 100
- Final Payment Amount: 900
- Post the payment
- Check journal entry:
- Expense/Payable: Debit 1000
- Tax Account: Credit 100
- Bank: Credit 900
Test 2: Create Payment with Multiple Deductions
- Create new outbound payment
- Enter amount: 2000
- Add first deduction:
- Account: PPh 21 account
- Amount: 100
- Description: "PPh 21"
- Add second deduction:
- Account: PPh 29 account
- Amount: 50
- Description: "PPh 29"
- Verify:
- Total Deductions: 150
- Final Payment Amount: 1850
- Post and verify journal entry:
- Expense/Payable: Debit 2000
- PPh 21: Credit 100
- PPh 29: Credit 50
- Bank: Credit 1850
Test 3: Batch Payment with Deductions
- Go to Accounting > Vendors > Batch Payments
- Create new batch payment
- Add payment line
- Click on the line to open form view
- In "Deductions" section, add deduction lines
- Save the line
- Verify total deductions shown in tree
- Generate payments
- Verify deductions transferred to generated payment
Common Issues and Solutions
Issue: "company_id field missing"
Solution: This was fixed in the latest version. Make sure you have the updated view files.
Issue: "Cannot locate form view"
Solution: The view now includes both tree and form definitions. Upgrade to latest version.
Issue: Existing payments not showing deductions
Solution: Old payments need manual migration. See UPGRADE_TO_V2.md for migration script.
Rollback Procedure
If you need to rollback:
- Stop Odoo
- Restore database:
dropdb your_database createdb your_database psql your_database < backup_before_v2.sql - Checkout previous version of the module
- Restart Odoo
Post-Upgrade Tasks
Migrate Existing Data (if needed)
If you have existing payments with the old single deduction structure, run this migration:
# In Odoo shell: ./odoo-bin shell -d your_database
# Find payments that might need migration
# Note: In v2.0, amount_substract is computed, so we can't query it directly
# Instead, look for payments that should have deductions but don't have deduction lines
# Manual migration example:
payment = env['account.payment'].browse(123) # Replace with actual ID
# Create deduction line
env['payment.deduction.line'].create({
'payment_id': payment.id,
'amount_substract': 100.0, # The old amount
'substract_account_id': 456, # The old account ID
'name': 'Migrated deduction',
'sequence': 10,
})
env.cr.commit()
Verification Checklist
After upgrade, verify:
- Module shows version 2.0.0
- Can create new payments with multiple deductions
- Deductions calculate correctly
- Journal entries are correct
- Batch payments work with deductions
- No errors in log files
- Existing payments still accessible
- Reports show correct amounts
Support
If you encounter issues:
- Check the error log
- Review UPGRADE_TO_V2.md
- Contact module maintainer