forked from mozaik-association/mozaik
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'thesaurus_imp' into 8.0.4-next-release refs #15909
- Loading branch information
Showing
18 changed files
with
897 additions
and
429 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
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
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,26 +1,3 @@ | ||
# -*- coding: utf-8 -*- | ||
############################################################################## | ||
# | ||
# This file is part of mozaik_thesaurus, an Odoo module. | ||
# | ||
# Copyright (c) 2015 ACSONE SA/NV (<http://acsone.eu>) | ||
# | ||
# mozaik_thesaurus is free software: | ||
# you can redistribute it and/or | ||
# modify it under the terms of the GNU Affero General Public License | ||
# as published by the Free Software Foundation, either version 3 of | ||
# the License, or (at your option) any later version. | ||
# | ||
# mozaik_thesaurus is distributed in the hope that it will | ||
# be useful but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU Affero General Public License for more details. | ||
# | ||
# You should have received a copy of the | ||
# GNU Affero General Public License | ||
# along with mozaik_thesaurus. | ||
# If not, see <http://www.gnu.org/licenses/>. | ||
# | ||
############################################################################## | ||
|
||
from . import thesaurus | ||
from . import models | ||
from . import wizard |
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,15 @@ | ||
# -*- coding: utf-8 -*- | ||
from openerp.tools import SUPERUSER_ID | ||
from openerp.modules.registry import RegistryManager | ||
|
||
__name__ = "Delete from Table thesaurus_term" | ||
|
||
|
||
def migrate(cr, version): | ||
if not version: | ||
return | ||
|
||
registry = RegistryManager.get(cr.dbname) | ||
thesaurus_term_obj = registry['thesaurus.term'] | ||
thesaurus_term_ids = thesaurus_term_obj.search(cr, SUPERUSER_ID, []) | ||
thesaurus_term_obj.unlink(cr, SUPERUSER_ID, thesaurus_term_ids) |
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,3 @@ | ||
# -*- coding: utf-8 -*- | ||
from . import thesaurus | ||
from . import abstract_term_finder |
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,46 @@ | ||
# -*- coding: utf-8 -*- | ||
############################################################################## | ||
# | ||
# This file is part of mozaik_thesaurus, an Odoo module. | ||
# | ||
# Copyright (c) 2015 ACSONE SA/NV (<http://acsone.eu>) | ||
# | ||
# mozaik_thesaurus is free software: | ||
# you can redistribute it and/or | ||
# modify it under the terms of the GNU Affero General Public License | ||
# as published by the Free Software Foundation, either version 3 of | ||
# the License, or (at your option) any later version. | ||
# | ||
# mozaik_thesaurus is distributed in the hope that it will | ||
# be useful but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU Affero General Public License for more details. | ||
# | ||
# You should have received a copy of the | ||
# GNU Affero General Public License | ||
# along with mozaik_thesaurus. | ||
# If not, see <http://www.gnu.org/licenses/>. | ||
# | ||
############################################################################## | ||
from openerp import models, api | ||
|
||
|
||
class AbstractTermFinder(models.AbstractModel): | ||
|
||
_name = 'abstract.term.finder' | ||
_description = 'Abstract Term Finder' | ||
_terms = [] | ||
|
||
@api.model | ||
@api.returns('self') | ||
def search(self, args, offset=0, limit=None, order=None, count=False): | ||
if self._terms: | ||
args = [ | ||
[ | ||
arg[0], 'in', self.env['thesaurus.term'].browse( | ||
arg[2]).get_children_term() | ||
] if hasattr(arg, '__iter__') and arg[0] in self._terms | ||
else arg for arg in args | ||
] | ||
return super(AbstractTermFinder, self).search( | ||
args, offset=offset, limit=limit, order=order, count=count) |
Oops, something went wrong.