|
4 | 4 | import base64 |
5 | 5 | from typing import Optional # noqa # pylint: disable=unused-import |
6 | 6 |
|
7 | | -from odoo import _, http |
| 7 | +from odoo import http |
| 8 | +from odoo.fields import Domain |
8 | 9 | from odoo.http import content_disposition, request |
9 | | -from odoo.osv.expression import OR |
10 | 10 |
|
11 | 11 | from odoo.addons.portal.controllers.portal import CustomerPortal |
12 | 12 | from odoo.addons.web.controllers.utils import ensure_db |
@@ -64,12 +64,12 @@ def portal_my_dms( |
64 | 64 | sortby, |
65 | 65 | ) = self._searchbar_data(filterby, sortby) |
66 | 66 | # domain |
67 | | - domain = [ |
68 | | - ("id", "in", request.env["dms.directory"]._get_own_root_directories()), |
69 | | - ] |
| 67 | + domain = Domain( |
| 68 | + [("id", "in", request.env["dms.directory"]._get_own_root_directories())] |
| 69 | + ) |
70 | 70 | # search |
71 | 71 | if search and search_in == "name": |
72 | | - domain += OR([[], [("name", "ilike", search)]]) |
| 72 | + domain = Domain.AND([domain, Domain.OR([[], [("name", "ilike", search)]])]) |
73 | 73 | # content according to pager and archive selected |
74 | 74 | items = request.env["dms.directory"].search(domain, order=sort_order) |
75 | 75 | request.session["my_dms_folder_history"] = items.ids |
@@ -235,14 +235,16 @@ def _searchbar_data(self, filterby, sortby): |
235 | 235 | sortby |
236 | 236 | :rtype: tuple[str, dict, dict, str, str] |
237 | 237 | """ |
238 | | - searchbar_sortings = {"name": {"label": _("Name"), "order": "name asc"}} |
| 238 | + searchbar_sortings = { |
| 239 | + "name": {"label": request.env._("Name"), "order": "name asc"} |
| 240 | + } |
239 | 241 | # default sortby |
240 | 242 | if not sortby: |
241 | 243 | sortby = "name" |
242 | 244 | sort_order = searchbar_sortings[sortby]["order"] |
243 | 245 | # search |
244 | 246 | searchbar_inputs = { |
245 | | - "name": {"input": "name", "label": _("Name")}, |
| 247 | + "name": {"input": "name", "label": request.env._("Name")}, |
246 | 248 | } |
247 | 249 | if not filterby: |
248 | 250 | filterby = "name" |
|
0 commit comments