Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d2cac42d47 | |||
| 8a57bbd7bb |
68
.gitignore
vendored
68
.gitignore
vendored
@ -1,15 +1,71 @@
|
|||||||
# Python
|
# Byte-compiled / optimized / DLL files
|
||||||
__pycache__/
|
__pycache__/
|
||||||
*.py[cod]
|
*.py[cod]
|
||||||
*$py.class
|
*$py.class
|
||||||
|
|
||||||
# OS
|
# 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
|
.DS_Store
|
||||||
Thumbs.db
|
Thumbs.db
|
||||||
|
|
||||||
# Editor
|
# Editors
|
||||||
.vscode/
|
.vscode/
|
||||||
.idea/
|
.idea/
|
||||||
|
*.swp
|
||||||
# Odoo
|
|
||||||
*.pot
|
|
||||||
|
|||||||
19
README.md
Normal file
19
README.md
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
# POS Cash Opening Adjustment
|
||||||
|
|
||||||
|
**Version:** 17.0.1.1.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).
|
||||||
|
- **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
|
||||||
|
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.
|
||||||
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "POS Cash Opening Adjustment",
|
"name": "POS Cash Opening Adjustment",
|
||||||
"summary": "Prevent opening cash journal entries and exclude opening float from closing totals while keeping reconciliation data.",
|
"summary": "Prevent opening cash journal entries and exclude opening float from closing totals while keeping reconciliation data.",
|
||||||
"version": "19.0.1.0.0",
|
"version": "17.0.1.1.0",
|
||||||
"category": "Point of Sale",
|
"category": "Point of Sale",
|
||||||
"author": "Suherdy Yacob",
|
"author": "Suherdy Yacob",
|
||||||
"depends": ["point_of_sale"],
|
"depends": ["point_of_sale"],
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -133,3 +133,23 @@ class PosSession(models.Model):
|
|||||||
"amount": expected_total,
|
"amount": expected_total,
|
||||||
})
|
})
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
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):
|
||||||
|
payment.unlink()
|
||||||
|
return super(PosSession, self)._validate_session(balancing_account, amount_to_balance, bank_payment_method_diffs)
|
||||||
Loading…
Reference in New Issue
Block a user