Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[15.0][MIG] web_advanced_search: Migration to 15.0 #2153

Merged
merged 65 commits into from
Mar 7, 2022

Conversation

ivantodorovich
Copy link
Contributor

@ivantodorovich ivantodorovich commented Feb 21, 2022

Superseeds #2133

hbrunn and others added 30 commits February 21, 2022 17:40
and replace company icon

[FIX] js syntax

[FIX] move our patched equals operator to top of list

[ADD] support selecting domains on x2x fields

[FIX] eval search view's domain

[IMP] UI fixes

[IMP] reflect recent additions in README.rst

[FIX] typos

[ADD] translations

[FIX] correct js reference

[RFR] rebuild our domains in a different way

this solves timing problems
I could not find the project on Transifex...
- Use the new domain widget.
- Use modules system.
* Make it good-looking
* Update known issues
* Fix templates.
* Make other operators work again
[MIG] web_advanced_search_x2x: Migrated to 10.0 FIX review Remarks
* Ensure that domain field can be evaluated before creating x2x field
* Fixed navigation error after using x2x advanced search
[FIX] StopPropagation when clicking in domain selector.
* Complete migration to v11
* Refactor to use the new v11 decoupled widgets system
* Advanced search is now a high-level feature from the filters menu; it simplifies code a lot, and the UX is even better
* Split README system
* Add fun to ROADMAP
* Addon is renamed to web_advanced_search, since it enhaces the searching experience for all kind of fields now
Currently translated at 100,0% (1 of 1 strings)

Translation: web-11.0/web-11.0-web_advanced_search
Translate-URL: https://translation.odoo-community.org/projects/web-11-0/web-11-0-web_advanced_search/da/
Before this patch, when searching with the "equals to" operator in any
x2many field, the searched parameter was always `undefined`.

The problem was that the underlying field manager implementation was
treating those fields as x2many, while the widget used was the `one2many`
one.

This patch simply mocks the underlying fake record to make think that
any relational field is always a `one2many`. This sets all pieces in
place and makes the field manager work as expected, and thus you can
search as expected too.
Updated by Update PO files to match POT (msgmerge) hook in Weblate.
If we honor the domain value, the user may not be getting all available
records when selecting from an x2many dropdown, or even worse, if the
domain references another field in the view, the user may be getting
an error when opening the field dropdown, like this:

    Error: NameError: name 'company_id' is not defined

    http://localhost/web/static/lib/py.js/lib/py.js:370
    Rastreo de error:
    PY_ensurepy@http://localhost/web/static/lib/py.js/lib/py.js:370:19
    py.evaluate@http://localhost/web/static/lib/py.js/lib/py.js:1340:20
    py.evaluate@http://localhost/web/static/lib/py.js/lib/py.js:1397:35
    py.evaluate@http://localhost/web/static/lib/py.js/lib/py.js:1409:34
    py.eval@http://localhost/web/static/lib/py.js/lib/py.js:1453:16
    eval_domains/<@http://localhost/web/static/src/js/core/pyeval.js:886:39
    _.forEach@http://localhost/web/static/lib/underscore/underscore.js:145:9
    _.mixin/</_.prototype[name]@http://localhost/web/static/lib/underscore/underscore.js:1484:29
    eval_domains@http://localhost/web/static/src/js/core/pyeval.js:877:16
    pyeval@http://localhost/web/static/src/js/core/pyeval.js:988:16
    stringToArray@http://localhost/web/static/src/js/core/domain.js:243:16
    _getDomain@http://localhost/web/static/src/js/views/basic/basic_model.js:3004:24
    _search@http://localhost/web_m2x_options/static/src/js/form.js:139:26
    source@http://localhost/web/static/src/js/fields/relational_fields.js:198:17
    _search@http://localhost/web/static/lib/jquery.ui/jquery-ui.js:6823:3
    $.widget/</proxiedPrototype[prop]</<@http://localhost/web/static/lib/jquery.ui/jquery-ui.js:415:19
    search@http://localhost/web/static/lib/jquery.ui/jquery-ui.js:6815:10
    $.widget/</proxiedPrototype[prop]</<@http://localhost/web/static/lib/jquery.ui/jquery-ui.js:415:19
    $.widget.bridge/$.fn[name]/<@http://localhost/web/static/lib/jquery.ui/jquery-ui.js:508:19
    each@http://localhost/web/static/lib/jquery/jquery.js:383:49
    each@http://localhost/web/static/lib/jquery/jquery.js:136:24
    $.widget.bridge/$.fn[name]@http://localhost/web/static/lib/jquery.ui/jquery-ui.js:494:4
    _onInputClick@http://localhost/web/static/src/js/fields/relational_fields.js:565:13
    proxy/<@http://localhost/web/static/src/js/core/mixins.js:279:20
    dispatch@http://localhost/web/static/lib/jquery/jquery.js:4640:50
    add/elemData.handle@http://localhost/web/static/lib/jquery/jquery.js:4309:41
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: web-12.0/web-12.0-web_advanced_search
Translate-URL: https://translation.odoo-community.org/projects/web-12-0/web-12-0-web_advanced_search/
Currently translated at 100.0% (1 of 1 strings)

Translation: web-12.0/web-12.0-web_advanced_search
Translate-URL: https://translation.odoo-community.org/projects/web-12-0/web-12-0-web_advanced_search/fr/
Currently translated at 100.0% (1 of 1 strings)

Translation: web-12.0/web-12.0-web_advanced_search
Translate-URL: https://translation.odoo-community.org/projects/web-12-0/web-12-0-web_advanced_search/es/
Currently translated at 100.0% (1 of 1 strings)

Translation: web-12.0/web-12.0-web_advanced_search
Translate-URL: https://translation.odoo-community.org/projects/web-12-0/web-12-0-web_advanced_search/pt/
@ivantodorovich

This comment was marked as resolved.

@@ -4,7 +4,7 @@ env:

# See https://github.com/OCA/odoo-community.org/issues/37#issuecomment-470686449
parserOptions:
ecmaVersion: 2017
ecmaVersion: 2019
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ivantodorovich ivantodorovich force-pushed the 15.0-mig-web_advanced_search branch 2 times, most recently from 6249b8a to f4dd577 Compare February 22, 2022 12:05
@onurugur
Copy link

@ivantodorovich when pressing the filter

UncaughtPromiseError
Uncaught Promise > Cannot find the definition of component "AdvancedFilterItem"

Error: Cannot find the definition of component "AdvancedFilterItem"
    at QWeb.eval (eval at _compile (http://localhost:9090/web/assets/debug/web.assets_common.js:10280:28), <anonymous>:140:27) (/web/static/lib/owl/owl.js:1795)
    at QWeb.eval (eval at _compile (http://localhost:9090/web/assets/debug/web.assets_common.js:10280:28), <anonymous>:58:21) (/web/static/lib/owl/owl.js:1795)
    at QWeb.render (http://localhost:9090/web/assets/debug/web.assets_common.js:10201:32) (/web/static/lib/owl/owl.js:1716)
    at Dropdown.__render (http://localhost:9090/web/assets/debug/web.assets_common.js:13055:37) (/web/static/lib/owl/owl.js:4570)
    at http://localhost:9090/web/assets/debug/web.assets_common.js:12800:26 (/web/static/lib/owl/owl.js:4315) 

also in console

2VM3596:140 Uncaught (in promise) Error: Cannot find the definition of component "AdvancedFilterItem"
    at QWeb.eval (eval at _compile (owl.js:1795:1), <anonymous>:140:27)
    at QWeb.eval (eval at _compile (owl.js:1795:1), <anonymous>:58:21)
    at QWeb.render (owl.js:1716:1)
    at Dropdown.__render (owl.js:4570:1)
    at owl.js:4315:1
   

Would you check these?

@ivantodorovich
Copy link
Contributor Author

@ivantodorovich when pressing the filter

Would you check these?

Sorry about this. It's fixed now.
I forgot to rename the imports after renaming the files to have pre-commit pass 😅

@onurugur
Copy link

Thank you. It working. Well done.

Copy link
Contributor

@celm1990 celm1990 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

functional testing OK

ivantodorovich added a commit to camptocamp/web that referenced this pull request Feb 24, 2022
Steps to reproduce:

1. Install Sales app
2. Go to Sales > Reporting > Sales
3. Add Custom Filter > Product > Is equal to

Without this fix an error is raised:

relational.js:39 Uncaught (in promise)
TypeError: Cannot read properties of undefined (reading 'endsWith')
    at Class.init (relational.js:39:28)

---

This is a backport of a refactor made in Migration to 15.0
OCA#2153

The code is a bit simpler an less hacky now, respecting widgets
hierarchy and responsibilities.
@pedrobaeza
Copy link
Member

A missing gap that I have always missed is that on advanced filter, on a many2one, there's no option of searching "is equal to" but the many2one widget. Only to put the exact text or the ID.

@ivantodorovich
Copy link
Contributor Author

A missing gap that I have always missed is that on advanced filter, on a many2one, there's no option of searching "is equal to" but the many2one widget. Only to put the exact text or the ID.

What do you mean? 🤔

@pedrobaeza
Copy link
Member

I mean to have this:

Selección_016

here:

Selección_017

@HaraldPanten
Copy link

Hi, any news about this PR?

THX!

@OCA-git-bot
Copy link
Contributor

This PR has the approved label and has been created more than 5 days ago. It should therefore be ready to merge by a maintainer (or a PSC member if the concerned addon has no declared maintainer). 🤖

@ghost
Copy link

ghost commented Mar 7, 2022

@yajo can you please merge this PR?

@yajo
Copy link
Member

yajo commented Mar 7, 2022

/ocabot merge nobump

@OCA-git-bot
Copy link
Contributor

What a great day to merge this nice PR. Let's do it!
Prepared branch 15.0-ocabot-merge-pr-2153-by-Yajo-bump-nobump, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit 0f8dc0c into OCA:15.0 Mar 7, 2022
@OCA-git-bot
Copy link
Contributor

Congratulations, your PR was merged at 8d02103. Thanks a lot for contributing to OCA. ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.