commit 8180e4277424dd40c9de39544e35621c010c91ef Author: Suherdy Yacob Date: Thu May 28 16:58:55 2026 +0700 first commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4abddf2 --- /dev/null +++ b/.gitignore @@ -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 +*~ diff --git a/README.md b/README.md new file mode 100644 index 0000000..59d95f9 --- /dev/null +++ b/README.md @@ -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 -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. diff --git a/__init__.py b/__init__.py new file mode 100644 index 0000000..cde864b --- /dev/null +++ b/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- + +from . import models diff --git a/__manifest__.py b/__manifest__.py new file mode 100644 index 0000000..2a5dad3 --- /dev/null +++ b/__manifest__.py @@ -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', +} diff --git a/__pycache__/__init__.cpython-312.pyc b/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000..45b7fa7 Binary files /dev/null and b/__pycache__/__init__.cpython-312.pyc differ diff --git a/models/__init__.py b/models/__init__.py new file mode 100644 index 0000000..a5ac9a2 --- /dev/null +++ b/models/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- + +from . import account_journal diff --git a/models/__pycache__/__init__.cpython-312.pyc b/models/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000..ffef90c Binary files /dev/null and b/models/__pycache__/__init__.cpython-312.pyc differ diff --git a/models/__pycache__/account_journal.cpython-312.pyc b/models/__pycache__/account_journal.cpython-312.pyc new file mode 100644 index 0000000..43b0ced Binary files /dev/null and b/models/__pycache__/account_journal.cpython-312.pyc differ diff --git a/models/account_journal.py b/models/account_journal.py new file mode 100644 index 0000000..0275758 --- /dev/null +++ b/models/account_journal.py @@ -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()