pos_cash_opening_adjustment/README.md

1.7 KiB

POS Cash Opening Adjustment

Version: 17.0.1.1.0
Author: Suherdy Yacob
Category: Point of Sale
License: LGPL-3

Summary

Prevents unwanted journal entries by handling zero-amount payments and automatically adjusting negative cash differences during POS session closing.

Features

  • Negative Cash Closing Adjustment: Automatically overrides the cashier's inputted cash amount to match the expected closing balance if a cash shortage (negative difference) is detected. This silently prevents Odoo from generating a Cash Difference Loss journal entry, and logs the auto-adjustment in the session's chatter instead.
  • Zero-Amount Payment Cleanup: Automatically removes pos.payment lines with 0.00 amount during session verification. This prevents the creation of "Difference at closing PoS session" journal items triggered by empty payments (e.g., from 100% discount or external payment edge cases).
  • Phantom Difference Prevention: Relies on standard Odoo mechanisms to ensure no journal items are created when the expected cash mathematically matches the inputted cash (e.g. opening with 150k and closing with 150k, or opening with 200k, selling 100k, and closing with 300k).

Technical Details

Validation Override

The module overrides _validate_session in pos.session:

  1. Auto-Adjustment: Detects if cash_register_balance_end_real is less than cash_register_balance_end. If so, it overrides the real balance to match the expected balance before standard accounting lines are generated, avoiding the creation of loss lines.
  2. Zero-Amount Fix: Iterates through all orders in the session and unlinks any payment lines where the amount is considered zero by the session's currency.