diff --git a/.gitignore b/.gitignore index 50b84e4..16bb03e 100644 --- a/.gitignore +++ b/.gitignore @@ -64,3 +64,8 @@ session/ # System .DS_Store Thumbs.db + +# Editors +.vscode/ +.idea/ +*.swp diff --git a/README.md b/README.md index 7c9f934..ccdc095 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # POS Cash Opening Adjustment -**Version:** 17.0.1.0.0 +**Version:** 17.0.1.1.0 **Author:** Suherdy Yacob **Category:** Point of Sale **License:** LGPL-3 @@ -12,6 +12,7 @@ Prevent opening cash journal entries and exclude opening float from closing tota - **Opening Cash Adjustment:** Modifies how opening cash is handled to prevent unwanted journal entries. - **Closing Totals:** Excludes opening float from closing totals calculation. - **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). +- **Negative Cash Closing Adjustment:** Automatically overrides the cashier's input to match the expected closing balance if a negative difference is detected, logging the action in the chatter and preventing a loss journal entry. ## Technical Details ### Zero-Amount Payment Fix diff --git a/__manifest__.py b/__manifest__.py index 4274fe5..cfbc726 100755 --- a/__manifest__.py +++ b/__manifest__.py @@ -1,7 +1,7 @@ { "name": "POS Cash Opening Adjustment", "summary": "Prevent opening cash journal entries and exclude opening float from closing totals while keeping reconciliation data.", - "version": "17.0.1.0.0", + "version": "17.0.1.1.0", "category": "Point of Sale", "author": "Suherdy Yacob", "depends": ["point_of_sale"], diff --git a/__pycache__/__init__.cpython-310.pyc b/__pycache__/__init__.cpython-310.pyc deleted file mode 100755 index 4f113cb..0000000 Binary files a/__pycache__/__init__.cpython-310.pyc and /dev/null differ diff --git a/__pycache__/__init__.cpython-312.pyc b/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index ea4bb76..0000000 Binary files a/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/models/__pycache__/__init__.cpython-310.pyc b/models/__pycache__/__init__.cpython-310.pyc deleted file mode 100755 index dc8c53e..0000000 Binary files a/models/__pycache__/__init__.cpython-310.pyc and /dev/null differ diff --git a/models/__pycache__/__init__.cpython-312.pyc b/models/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index e3695ad..0000000 Binary files a/models/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/models/__pycache__/pos_session.cpython-310.pyc b/models/__pycache__/pos_session.cpython-310.pyc deleted file mode 100755 index 36f8a79..0000000 Binary files a/models/__pycache__/pos_session.cpython-310.pyc and /dev/null differ diff --git a/models/__pycache__/pos_session.cpython-312.pyc b/models/__pycache__/pos_session.cpython-312.pyc deleted file mode 100644 index 0572ea3..0000000 Binary files a/models/__pycache__/pos_session.cpython-312.pyc and /dev/null differ diff --git a/models/pos_session.py b/models/pos_session.py index ce74f67..e92519d 100755 --- a/models/pos_session.py +++ b/models/pos_session.py @@ -136,6 +136,18 @@ class PosSession(models.Model): def _validate_session(self, balancing_account=False, amount_to_balance=0, bank_payment_method_diffs=None): for session in self: + if session.config_id.cash_control: + difference = session.cash_register_balance_end_real - session.cash_register_balance_end + if session.currency_id.compare_amounts(difference, 0.0) < 0: + session.message_post(body="Auto-adjustment: Cashier input %s overridden to expected %s to suppress negative difference of %s." % ( + session.currency_id.format(session.cash_register_balance_end_real), + session.currency_id.format(session.cash_register_balance_end), + session.currency_id.format(difference) + )) + session.write({'cash_register_balance_end_real': session.cash_register_balance_end}) + if amount_to_balance: + amount_to_balance -= difference + for order in session.order_ids: for payment in order.payment_ids: if session.currency_id.is_zero(payment.amount):