-
-
Notifications
You must be signed in to change notification settings - Fork 700
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by pedrobaeza
- Loading branch information
Showing
4 changed files
with
68 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
from . import addons, models, modules | ||
from . import addons, api, models, modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Copyright Odoo Community Association (OCA) | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
import logging | ||
|
||
from odoo.api import Environment | ||
|
||
_logger = logging.getLogger(__name__) | ||
|
||
|
||
class FakeRecord: | ||
"""Artificial construct to handle delete(records) submethod """ | ||
|
||
def __new__(cls): | ||
return object.__new__(cls) | ||
|
||
def __init__(self): | ||
self._name = "ir.model.data" | ||
self.ids = [] | ||
self.browse = lambda l: None | ||
|
||
def __isub__(self, other): | ||
return None | ||
|
||
|
||
def __getitem__(self, model_name): | ||
"""This is used to bypass the call self.env[model] | ||
(and other posterior calls) from _module_data_uninstall method of ir.model.data | ||
""" | ||
if ( | ||
hasattr(self, "context") | ||
and isinstance(model_name, str) | ||
and self.context.get("missing_model", False) | ||
): | ||
if not self.registry.models.get(model_name, False): | ||
new_env = lambda: None # noqa: E731 | ||
new_env._fields = {} | ||
new_env.browse = lambda i: FakeRecord() | ||
return new_env | ||
return Environment.__getitem__._original_method(self, model_name) | ||
|
||
|
||
__getitem__._original_method = Environment.__getitem__ | ||
Environment.__getitem__ = __getitem__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,3 @@ | ||
# copy pasted from openupgrade project | ||
# TODO: explain why odoorpc is pinned | ||
odoorpc==0.7.0 | ||
|
||
# We allways want to have the latest version of openupgradelib | ||
# more information : https://github.com/OCA/OpenUpgrade/pull/2194 | ||
git+https://github.com/OCA/openupgradelib.git@master |