diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..50b84e4 --- /dev/null +++ b/.gitignore @@ -0,0 +1,66 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ +cover/ + +# Translations +*.pot +*.po + +# Odoo specific +*.log +filestore/ +session/ +.odoo/ + +# System +.DS_Store +Thumbs.db diff --git a/README.md b/README.md new file mode 100644 index 0000000..7c9f934 --- /dev/null +++ b/README.md @@ -0,0 +1,18 @@ +# POS Cash Opening Adjustment + +**Version:** 17.0.1.0.0 +**Author:** Suherdy Yacob +**Category:** Point of Sale +**License:** LGPL-3 + +## Summary +Prevent opening cash journal entries and exclude opening float from closing totals while keeping reconciliation data. + +## Features +- **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). + +## Technical Details +### Zero-Amount Payment Fix +The module overrides `_validate_session` in `pos.session`. Before the standard validation process begins, it iterates through all orders in the session and unlinks any payment lines where the amount is considered zero by the session's currency. diff --git a/__init__.py b/__init__.py old mode 100644 new mode 100755 diff --git a/__manifest__.py b/__manifest__.py old mode 100644 new mode 100755 diff --git a/__pycache__/__init__.cpython-310.pyc b/__pycache__/__init__.cpython-310.pyc old mode 100644 new mode 100755 diff --git a/__pycache__/__init__.cpython-312.pyc b/__pycache__/__init__.cpython-312.pyc index 5ff8e83..ea4bb76 100644 Binary files a/__pycache__/__init__.cpython-312.pyc and b/__pycache__/__init__.cpython-312.pyc differ diff --git a/models/__init__.py b/models/__init__.py old mode 100644 new mode 100755 diff --git a/models/__pycache__/__init__.cpython-310.pyc b/models/__pycache__/__init__.cpython-310.pyc old mode 100644 new mode 100755 diff --git a/models/__pycache__/__init__.cpython-312.pyc b/models/__pycache__/__init__.cpython-312.pyc index 405c781..e3695ad 100644 Binary files a/models/__pycache__/__init__.cpython-312.pyc and b/models/__pycache__/__init__.cpython-312.pyc differ diff --git a/models/__pycache__/pos_session.cpython-310.pyc b/models/__pycache__/pos_session.cpython-310.pyc old mode 100644 new mode 100755 diff --git a/models/__pycache__/pos_session.cpython-312.pyc b/models/__pycache__/pos_session.cpython-312.pyc index c42ab7e..0572ea3 100644 Binary files a/models/__pycache__/pos_session.cpython-312.pyc and b/models/__pycache__/pos_session.cpython-312.pyc differ diff --git a/models/pos_session.py b/models/pos_session.py old mode 100644 new mode 100755 index 4f0ff3f..ce74f67 --- a/models/pos_session.py +++ b/models/pos_session.py @@ -132,4 +132,12 @@ class PosSession(models.Model): "expected_amount": expected_total, "amount": expected_total, }) - return data \ No newline at end of file + return data + + def _validate_session(self, balancing_account=False, amount_to_balance=0, bank_payment_method_diffs=None): + for session in self: + for order in session.order_ids: + for payment in order.payment_ids: + if session.currency_id.is_zero(payment.amount): + payment.unlink() + return super(PosSession, self)._validate_session(balancing_account, amount_to_balance, bank_payment_method_diffs) \ No newline at end of file diff --git a/static/src/xml/closing_popup.xml b/static/src/xml/closing_popup.xml old mode 100644 new mode 100755