import sys # Get the last session session = env['pos.session'].search([('state', '=', 'closed')], order='id desc', limit=1) print(f"Session: {session.name} (ID {session.id})") # Check main POS move print(f"Main POS Move: {session.move_id.name} (ID {session.move_id.id})") for line in session.move_id.line_ids: print(f" Line: {line.name} | Account: {line.account_id.code} | Debit: {line.debit} | Credit: {line.credit} | Reconciled: {line.reconciled}") # Check for Bank Journal moves (these should NOT exist for intercompany PMs) # Bank journal moves usually have payment_method_id set on account.payment payments = env['account.payment'].search([('pos_session_id', '=', session.id)]) print(f"Payment moves found: {len(payments)}") for p in payments: print(f" Payment: {p.name} | Journal: {p.journal_id.name} | Amount: {p.amount}") # Check for Inter-company clearing moves clearing_moves = env['account.move'].search([('ref', 'like', f"Inter-company clearing for {session.name}%")]) print(f"Clearing moves found: {len(clearing_moves)}") for move in clearing_moves: print(f"Move: {move.name} | Ref: {move.ref} | State: {move.state}") for line in move.line_ids: print(f" Line: {line.name} | Account: {line.account_id.code} {line.account_id.name} | Debit: {line.debit} | Credit: {line.credit} | Reconciled: {line.reconciled}")