# Vendor Batch Payment Merge - User Guide ## Overview The Vendor Batch Payment Merge addon enhances Odoo's batch payment functionality by allowing users to create payment lines directly within the batch payment form, rather than having to create individual payments first. It also provides the ability to specify an expense or income account for each payment line that will be used in the journal entry instead of the default payable or receivable account. ## Installation 1. Copy the `vendor_batch_payment_merge` folder to your Odoo addons directory. 2. Update the Apps list in Odoo (Settings > Activate the developer mode > Apps > Update Apps List). 3. Search for "Vendor Batch Payment Merge" and install the addon. ## Features ### Direct Payment Line Creation Instead of creating individual payments and then adding them to a batch, you can now create payment lines directly within the batch payment form. ### Expense/Income Account Specification Each payment line can have a specific expense (for vendor payments) or income (for customer payments) account that will be used in the journal entry. ### Support for Both Inbound and Outbound Payments The addon works with both vendor (outbound) and customer (inbound) batch payments. ### Smart Partner Filtering The partner field automatically shows appropriate partners based on the batch type: - For vendor payments (outbound): Shows partners with supplier_rank > 0 - For customer payments (inbound): Shows partners with customer_rank > 0 ## Usage ### Creating Vendor Batch Payments 1. Navigate to **Accounting > Vendors > Batch Payments**. 2. Click **Create** to create a new batch payment. 3. Fill in the batch payment details: - Set **Batch Type** to "Vendor Payments" (Outbound) - Select the appropriate **Bank Journal** - Set the **Date** 4. Go to the **Direct Payment Lines** tab. 5. Add payment lines by clicking **Add a line**: - Select the **Vendor** (only suppliers will be shown) - Enter the **Amount** - Select the **Expense Account** (optional but recommended) - Add a **Memo** (optional) - Set the **Payment Date** (optional) 6. Click **Generate Payments** to create the actual payment records. 7. Validate the batch payment as usual. ### Creating Customer Batch Payments 1. Navigate to **Accounting > Customers > Batch Payments**. 2. Click **Create** to create a new batch payment. 3. Fill in the batch payment details: - Set **Batch Type** to "Customer Payments" (Inbound) - Select the appropriate **Bank Journal** - Set the **Date** 4. Go to the **Direct Payment Lines** tab. 5. Add payment lines by clicking **Add a line**: - Select the **Customer** (only customers will be shown) - Enter the **Amount** - Select the **Income Account** (optional but recommended) - Add a **Memo** (optional) - Set the **Payment Date** (optional) 6. Click **Generate Payments** to create the actual payment records. 7. Validate the batch payment as usual. ## How It Works ### Payment Line Creation When you add payment lines in the "Direct Payment Lines" tab, you're creating records that will be used to generate actual payment records. These lines are not payments themselves but templates for creating payments. ### Payment Generation When you click "Generate Payments", the addon: 1. Validates that all lines have a partner selected 2. Creates actual payment records based on your direct payment lines 3. Posts these payments 4. Adds them to the batch payment 5. Links each direct payment line to its generated payment ### Journal Entries When the payments are posted, the journal entries will use the specified expense/income account instead of the default payable/receivable account: - For vendor payments: The expense account is credited (instead of the vendor's payable account being debited) - For customer payments: The income account is debited (instead of the customer's receivable account being credited) ## Benefits 1. **Streamlined Workflow**: No need to create individual payments before adding them to a batch. 2. **Flexible Accounting**: Use specific expense/income accounts for better financial tracking. 3. **Time Saving**: Create multiple payments and add them to a batch in one step. 4. **Better Organization**: Keep all payment information in one place. 5. **Smart Partner Filtering**: Automatically shows appropriate partners based on payment type. ## Troubleshooting ### Payment Method Not Found If you get an error about the direct batch payment method not being found: 1. Ensure the addon is properly installed 2. Check that the payment methods were created (Settings > Technical > Accounting > Payment Methods) 3. Verify that the journal supports the direct batch payment method 4. The addon will now automatically create payment method lines if they don't exist ### Missing Partner Error If you get an error about missing partners when generating payments: 1. Ensure all payment lines have a partner selected 2. Check that the partner field is not empty for any line ### Journal Entry Issues If the journal entries are not using the specified expense/income accounts: 1. Make sure the payments are posted after generation 2. Check that the expense/income accounts were correctly specified in the payment lines 3. Verify that the accounts are of the correct type (expense for vendors, income for customers) ## Best Practices 1. **Use Descriptive Memos**: Add clear memos to payment lines for better tracking. 2. **Specify Accounts**: Always specify the appropriate expense/income account for better financial reporting. 3. **Review Before Generation**: Double-check all payment lines before clicking "Generate Payments". 4. **Regular Validation**: Validate batch payments regularly to ensure proper accounting. ## Technical Details ### Models - `account.batch.payment`: Extended to include direct payment lines - `account.batch.payment.line`: New model for direct payment lines - `account.payment`: Extended to include expense account field ### Views - Added "Direct Payment Lines" tab to batch payment form - Added expense account field to payment form - Restored smart partner filtering based on batch type ### Data - Created direct batch payment methods for both inbound and outbound payments ## Recent Improvements - Fixed partner field constraint issues - Improved error handling for missing partners - Restored smart partner filtering based on batch type - Fixed payment method line search to properly find direct batch payment methods - Added automatic creation of payment method lines when they don't exist - Fixed domain context for proper partner filtering in payment lines ## Support For issues or questions about this addon, please contact your Odoo administrator or the addon developer.