From 8a57bbd7bb95397a7b0a86f1d596dd7227620a8f Mon Sep 17 00:00:00 2001 From: Suherdy Yacob Date: Mon, 19 Jan 2026 15:41:23 +0700 Subject: [PATCH] fix: Remove zero-amount payments during POS session validation. --- .gitignore | 66 ++++++++++++++++++ README.md | 18 +++++ __init__.py | 0 __manifest__.py | 0 __pycache__/__init__.cpython-310.pyc | Bin __pycache__/__init__.cpython-312.pyc | Bin 233 -> 215 bytes models/__init__.py | 0 models/__pycache__/__init__.cpython-310.pyc | Bin models/__pycache__/__init__.cpython-312.pyc | Bin 245 -> 227 bytes .../__pycache__/pos_session.cpython-310.pyc | Bin .../__pycache__/pos_session.cpython-312.pyc | Bin 7280 -> 7920 bytes models/pos_session.py | 10 ++- static/src/xml/closing_popup.xml | 0 13 files changed, 93 insertions(+), 1 deletion(-) create mode 100644 .gitignore create mode 100644 README.md mode change 100644 => 100755 __init__.py mode change 100644 => 100755 __manifest__.py mode change 100644 => 100755 __pycache__/__init__.cpython-310.pyc mode change 100644 => 100755 models/__init__.py mode change 100644 => 100755 models/__pycache__/__init__.cpython-310.pyc mode change 100644 => 100755 models/__pycache__/pos_session.cpython-310.pyc mode change 100644 => 100755 models/pos_session.py mode change 100644 => 100755 static/src/xml/closing_popup.xml 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 5ff8e830127fc7cc73fed1d2ab54387e346ed6e1..ea4bb762cc8ff77d8f74ccf510821174e518cc90 100644 GIT binary patch delta 37 rcmaFKc%6~^G%qg~0}xEicbdo@#22EUk)NBYUtF4zT9i^bu{H+)$i@rQ delta 55 zcmcc4_>z(PG%qg~0}wnmVVTGsq>!eck)NBYUtF4zT9i_$SDBccpX896Sdf^fmz=Mc JnKCgu2LRLD5<>t0 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 405c7816fc818b88656b0d70dc8a175b1b48c624..e3695ad0205612f297a431097ca824c667b7e036 100644 GIT binary patch delta 37 rcmey$_?VIVG%qg~0}xEgcbdo@&KIqpk)NBYUtF4zT9i^bv8fmU%_R&4 delta 55 zcmaFN_?40SG%qg~0}$Anu}tI+SIE`R$j?pHFD}hUElR1>t4vJJPjbjjEJ)1LOU~EJ JOqp0v3;@5u5zhbs 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 c42ab7e8809f9dba4f05f328253ba335d12bcdc9..0572ea31a6c9256c210238e8bb8a550e169b2564 100644 GIT binary patch delta 744 zcmZWnOHUI~6h3!e6tKlg>ChG|#x9&L!dnpk!8sdrW=p0smANI5`pCl94ueMcbfzI*dfyn97Ya2 zI}P9vhjG|-PcRyOCK-|HX+Os0#(PRGs~NVes}}WPg)Ve^i0Ys$%o-Wpn4#@nrOvAa z<@-uTR~1{6EzPoY(~x{Le9)OtGK!Jbjk~gvPMfoaT@ET)&&#$cSDRWnGNBkV^5M;_ zW>1-_tm>1K78SiMyh#^Sjh5?b6q>-Q<>~6E+9Hi&LNf^SZ8uD7tg7Pdf4ZJ}gE@ph zi%=3{yTH{;OM|6IM=_EtM3TF}`lS`V6i*c6U4?kpE-*o9Ww0ckyj2vF1uE1tJ g#StnjA>=0{3Xs?rh8Z$XR>Es-t8KsFAUU}458DC2YXATM delta 162 zcmexh`@w?mG%qg~0}xby<;^@PF_CW)qs_*J=8Rk&3>Az~BEbxrvYX#A?qpIZ(9g)v zP1P?h%}6ausnn}XOwLbo$W1Ir%+pKG*UL=Vyp?5!D3hk>