# Split Pendapatan Payment - Configuration Guide ## Issue Fixed The module had a logic issue where it wasn't properly applying income accounts from payment methods for regular (non-discount) products when a discount product was configured in the POS. ## Root Cause The original code used `elif` logic which meant: - IF discount product exists AND current sale is for discount product → use discount_account_id - ELIF discount product exists BUT current sale is NOT discount → use income_account_id - However, the ELIF was actually inside the discount check, causing it to skip for regular products ## Solution Applied Fixed the logic flow to properly check: 1. Is this a discount product sale? → Use `discount_account_id` from payment method (or product default) 2. Is this a regular product sale? → Use `income_account_id` from payment method (or product default) 3. No discount product configured? → Use `income_account_id` from payment method (or product default) ## Required Configuration To use this module properly, you MUST configure the income accounts in your payment methods: ### Step 1: Configure Payment Method Income Accounts 1. Go to **Point of Sale → Configuration → Payment Methods** 2. For each payment method (Cash, Bank, Credit Card, etc.), open the form 3. Fill in the following fields: - **Income Account**: The account to use for regular product sales with this payment method - **Discount Account**: The account to use for discount product sales with this payment method (if you use POS discounts) ### Step 2: Important Notes - If you don't configure these fields, the module will fall back to using the product's default income account - For discount products, if `discount_account_id` is not set in the payment method, it will use the discount product's configured account - For regular products, if `income_account_id` is not set in the payment method, it will use the product's configured income account (from product or product category) ### Example Configuration **Cash Payment Method:** - Income Account: 4000 - Sales Revenue (Cash) - Discount Account: 4100 - Sales Discounts (Cash) **Bank Payment Method:** - Income Account: 4010 - Sales Revenue (Bank) - Discount Account: 4110 - Sales Discounts (Bank) **Credit Card Payment Method:** - Income Account: 4020 - Sales Revenue (Credit Card) - Discount Account: 4120 - Sales Discounts (Credit Card) ## Error Messages If you see an error saying "need to define the income account at product level", it means: 1. The payment method doesn't have `income_account_id` configured, AND 2. The product doesn't have a valid income account defined **Solution**: Configure the income account in either: - The payment method form (recommended), OR - The product form or product category ## Diagnostic Logging The module now includes detailed logging to help diagnose issues. Check your Odoo logs for entries starting with `=== SPLIT PENDAPATAN DEBUG ===` to see: - Which payment method is being processed - What accounts are configured - Which account is being used for each sale line ## Module Behavior This module splits income journal entries by payment method. For example, if you have a sale with: - Total: 100,000 - Payment: 60,000 Cash + 40,000 Bank Instead of one income line of 100,000, you'll get: - Income (Cash): 60,000 - Income (Bank): 40,000 This allows you to track income separately by payment method for better financial reporting.