first commit
This commit is contained in:
commit
8180e42774
125
.gitignore
vendored
Normal file
125
.gitignore
vendored
Normal file
@ -0,0 +1,125 @@
|
||||
# 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
|
||||
|
||||
# Installer logs
|
||||
pip-log.txt
|
||||
pip-delete-this-directory.txt
|
||||
|
||||
# Unit test / coverage reports
|
||||
htmlcov/
|
||||
.tox/
|
||||
.nosenv/
|
||||
.pytest_cache/
|
||||
.mypy_cache/
|
||||
.pyre/
|
||||
.pytype/
|
||||
nosetests.xml
|
||||
coverage.xml
|
||||
*.cover
|
||||
*.py,cover
|
||||
.hypothesis/
|
||||
|
||||
# Translations
|
||||
*.mo
|
||||
*.pot
|
||||
|
||||
# Django stuff (not Odoo, but good to have)
|
||||
*.log
|
||||
local_settings.py
|
||||
db.sqlite3
|
||||
db.sqlite3-journal
|
||||
|
||||
# Sphinx documentation
|
||||
docs/_build/
|
||||
|
||||
# PyBuilder
|
||||
.pybuilder/
|
||||
target/
|
||||
|
||||
# Jupyter Notebook
|
||||
.ipynb_checkpoints
|
||||
|
||||
# IPython
|
||||
profile_default/
|
||||
ipython_config.py
|
||||
|
||||
# pyenv
|
||||
# For a library or package, you might want to ignore these files since the code is
|
||||
# intended to run in multiple environments; otherwise, check them in:
|
||||
# .python-version
|
||||
|
||||
# pipenv
|
||||
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
||||
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
||||
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
||||
# install all needed dependencies.
|
||||
#Pipfile.lock
|
||||
|
||||
# poetry
|
||||
# Similar to Pipfile.lock, poetry.lock contains the resolved dependencies and should be tracked
|
||||
# unless you have platform-specific dependencies.
|
||||
#poetry.lock
|
||||
|
||||
# pdm
|
||||
# Similar to Pipfile.lock, pdm.lock contains the resolved dependencies and should be tracked
|
||||
# unless you have platform-specific dependencies.
|
||||
#pdm.lock
|
||||
|
||||
# virtualenv
|
||||
.env
|
||||
.venv
|
||||
env/
|
||||
venv/
|
||||
ENV/
|
||||
env.bak/
|
||||
venv.bak/
|
||||
|
||||
# Spyder project settings
|
||||
.spyderproject
|
||||
.spyproject
|
||||
|
||||
# Rope project settings
|
||||
.ropeproject
|
||||
|
||||
# mkdocs documentation
|
||||
/site
|
||||
|
||||
# mypy
|
||||
.mypy_cache/
|
||||
.dmypy.json
|
||||
dmypy.json
|
||||
|
||||
# Pyre type checker
|
||||
.pyre/
|
||||
|
||||
# Editors
|
||||
.vscode/
|
||||
.idea/
|
||||
*.swp
|
||||
*.swo
|
||||
*~
|
||||
39
README.md
Normal file
39
README.md
Normal file
@ -0,0 +1,39 @@
|
||||
# Account Online Synchronization Patch
|
||||
|
||||
This module is a clean customization designed to prevent the Odoo single-threaded Werkzeug server from freezing, hanging, or entering infinite loops when accessing the Accounting Dashboard in non-production, testing, staging, or local development environments.
|
||||
|
||||
## Problem Statement
|
||||
|
||||
When the Odoo Accounting App/Dashboard is loaded, the frontend makes standard RPC requests to the `fetch_online_sync_favorite_institutions` method on the `account.journal` model for each cash/bank journal. By default, Odoo's core `account_online_synchronization` module executes synchronous HTTP calls to `odoofin.com` with a 60-second timeout.
|
||||
|
||||
On testing, staging, or duplicated local database instances, or in environments with restricted external internet access:
|
||||
1. These synchronous requests hang.
|
||||
2. Because Odoo runs single-threaded in standard development and test modes, the entire server process blocks.
|
||||
3. This creates sequential gateway timeouts (HTTP 502/504), heavy browser lags, and infinite loading loops.
|
||||
|
||||
## Solution
|
||||
|
||||
To resolve this issue cleanly **without modifying core/enterprise source code**, this module applies standard Odoo model inheritance:
|
||||
* **Inherited Model**: `account.journal`
|
||||
* **Mechanism**: Overrides `fetch_online_sync_favorite_institutions()`.
|
||||
* **Behavior**: Checks the `database.is_neutralized` configuration parameter. If the database is neutralized (which is typical for test/staging clones), it returns an empty list `[]` immediately without making any outbound external network requests. If the database is not neutralized (i.e. production), it forwards the execution to the parent module (`super()`).
|
||||
|
||||
## Installation
|
||||
|
||||
### Dependencies
|
||||
* `account_online_synchronization` (Enterprise module)
|
||||
|
||||
### Auto-installation
|
||||
This module is configured with `'auto_install': True` and `'depends': ['account_online_synchronization']`. It will automatically install and activate as soon as the base online sync module is present in the database registry.
|
||||
|
||||
### Manual CLI Installation
|
||||
To explicitly register and install the module via command line:
|
||||
```bash
|
||||
./odoo-bin -c odoo.conf -d <your_database> -i account_online_sync_patch --stop-after-init
|
||||
```
|
||||
|
||||
## Changelog
|
||||
|
||||
### v19.0.1.0.0
|
||||
* Initial release.
|
||||
* Added `account.journal` override for `fetch_online_sync_favorite_institutions` to bypass external connections on neutralized databases.
|
||||
3
__init__.py
Normal file
3
__init__.py
Normal file
@ -0,0 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from . import models
|
||||
18
__manifest__.py
Normal file
18
__manifest__.py
Normal file
@ -0,0 +1,18 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
{
|
||||
'name': 'Account Online Synchronization Patch',
|
||||
'version': '19.0.1.0.0',
|
||||
'category': 'Accounting',
|
||||
'summary': 'Patch account online synchronization to prevent infinite loops and hangs on neutralized databases.',
|
||||
'description': """
|
||||
This module overrides the `fetch_online_sync_favorite_institutions` method on `account.journal`
|
||||
to immediately return empty list `[]` if the database is neutralized (`database.is_neutralized` is true),
|
||||
avoiding external requests that lock up Odoo's single-threaded Werkzeug server.
|
||||
""",
|
||||
'author': 'Suherdy Yacob',
|
||||
'depends': ['account_online_synchronization'],
|
||||
'data': [],
|
||||
'installable': True,
|
||||
'auto_install': True,
|
||||
'license': 'LGPL-3',
|
||||
}
|
||||
BIN
__pycache__/__init__.cpython-312.pyc
Normal file
BIN
__pycache__/__init__.cpython-312.pyc
Normal file
Binary file not shown.
3
models/__init__.py
Normal file
3
models/__init__.py
Normal file
@ -0,0 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from . import account_journal
|
||||
BIN
models/__pycache__/__init__.cpython-312.pyc
Normal file
BIN
models/__pycache__/__init__.cpython-312.pyc
Normal file
Binary file not shown.
BIN
models/__pycache__/account_journal.cpython-312.pyc
Normal file
BIN
models/__pycache__/account_journal.cpython-312.pyc
Normal file
Binary file not shown.
12
models/account_journal.py
Normal file
12
models/account_journal.py
Normal file
@ -0,0 +1,12 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from odoo import models
|
||||
|
||||
class AccountJournal(models.Model):
|
||||
_inherit = 'account.journal'
|
||||
|
||||
def fetch_online_sync_favorite_institutions(self):
|
||||
# Prevent hangs/infinite loops on neutralized databases by bypassing external API calls.
|
||||
if self.env['ir.config_parameter'].sudo().get_param('database.is_neutralized'):
|
||||
return []
|
||||
return super(AccountJournal, self).fetch_online_sync_favorite_institutions()
|
||||
Loading…
Reference in New Issue
Block a user