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

[MIG] web_advanced_search: Migration to 16.0 #2357

Merged
merged 76 commits into from
Apr 28, 2023

Conversation

hvgollar
Copy link

@hvgollar hvgollar commented Dec 6, 2022

No description provided.

@hvgollar hvgollar mentioned this pull request Dec 6, 2022
45 tasks
Copy link
Member

@StefanRijnhart StefanRijnhart left a comment

Choose a reason for hiding this comment

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

Runboat seems broken so I had to do a local install of your version of the module but it does not seem to work for me. The Add advanced filter option is missing from the search filter:
image

I'm also getting 'missing dependency' errors in the web developer console about this module:

Debug:                    
Object { "@web_advanced_search/js/legacy/CustomFilterItem.esm": {…}, "@web_advanced_search/js/legacy/FilterMenu.esm": {…}, "@web_advanced_search/js/owl/CustomFilterItem.esm": {…}, "@web_advanced_search/js/owl/FilterMenu.esm": {…} }
​
"@web_advanced_search/js/legacy/CustomFilterItem.esm": Object { dependencies: (3) […], dependents: [], name: "@web_advanced_search/js/legacy/CustomFilterItem.esm", … }
​​
dependencies: Array(3) [ "web.CustomFilterItem", "@web_advanced_search/js/RecordPicker.esm", "@web/core/utils/patch" ]
​​
dependents: Array []
​​​
length: 0
​​​
<prototype>: Array []
​​
missing: Array [ "@web_advanced_search/js/RecordPicker.esm" ]
​​​
0: "@web_advanced_search/js/RecordPicker.esm"
​​​
length: 1
​​​
<prototype>: Array []
​​
name: "@web_advanced_search/js/legacy/CustomFilterItem.esm"
​​
<prototype>: Object { … }
​
"@web_advanced_search/js/legacy/FilterMenu.esm": Object { dependencies: (3) […], dependents: [], name: "@web_advanced_search/js/legacy/FilterMenu.esm", … }
​​
dependencies: Array(3) [ "@web_advanced_search/js/legacy/AdvancedFilterItem.esm", "web.FilterMenu", "@web/core/utils/patch" ]
​​
dependents: Array []
​​
missing: Array [ "@web_advanced_search/js/legacy/AdvancedFilterItem.esm" ]
​​
name: "@web_advanced_search/js/legacy/FilterMenu.esm"
​​
<prototype>: Object { … }
​
"@web_advanced_search/js/owl/CustomFilterItem.esm": Object { dependencies: (3) […], dependents: [], name: "@web_advanced_search/js/owl/CustomFilterItem.esm", … }
​​
dependencies: Array(3) [ "@web/search/filter_menu/custom_filter_item", "@web_advanced_search/js/RecordPicker.esm", "@web/core/utils/patch" ]
​​
dependents: Array []
​​
missing: Array [ "@web_advanced_search/js/RecordPicker.esm" ]
​​
name: "@web_advanced_search/js/owl/CustomFilterItem.esm"
​​
<prototype>: Object { … }
​
"@web_advanced_search/js/owl/FilterMenu.esm": Object { dependencies: (3) […], dependents: [], name: "@web_advanced_search/js/owl/FilterMenu.esm", … }
​​
dependencies: Array(3) [ "@web_advanced_search/js/owl/AdvancedFilterItem.esm", "@web/search/filter_menu/filter_menu", "@web/core/utils/patch" ]
​​
dependents: Array []
​​
missing: Array [ "@web_advanced_search/js/owl/AdvancedFilterItem.esm" ]
​​
name: "@web_advanced_search/js/owl/FilterMenu.esm"
​​
<prototype>: Object { … }
​
<prototype>: Object { … }
boot.js:355

Did this module work for you when you were porting it?

Copy link

@nicolascol nicolascol left a comment

Choose a reason for hiding this comment

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

review functional LGTM

@rven
Copy link
Contributor

rven commented Dec 15, 2022

@StefanRijnhart Can you verify if everything is fine now?

@pablontura
Copy link

review functional LGTM

Copy link
Member

@chienandalu chienandalu left a comment

Choose a reason for hiding this comment

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

The many2one custom filter is equal to doesn't work:

Peek 13-01-2023 17-35

Full traceback:

OwlError: An error occured in the owl lifecycle (see this Error's "cause" property)
    at handleError (http://oca-web-16-0-pr2357-28f8ea5b62bd.runboat.odoo-community.org/web/assets/debug/web.assets_common.js:16294:35) (/web/static/lib/owl/owl.js:124)
    at owl.App.handleError (http://oca-web-16-0-pr2357-28f8ea5b62bd.runboat.odoo-community.org/web/assets/debug/web.assets_common.js:21844:20) (/web/static/lib/owl/owl.js:5674)
    at Fiber._render (http://oca-web-16-0-pr2357-28f8ea5b62bd.runboat.odoo-community.org/web/assets/debug/web.assets_common.js:17794:30) (/web/static/lib/owl/owl.js:1624)
    at Fiber.render (http://oca-web-16-0-pr2357-28f8ea5b62bd.runboat.odoo-community.org/web/assets/debug/web.assets_common.js:17783:18) (/web/static/lib/owl/owl.js:1613)
    at ComponentNode.updateAndRender (http://oca-web-16-0-pr2357-28f8ea5b62bd.runboat.odoo-community.org/web/assets/debug/web.assets_common.js:18607:19) (/web/static/lib/owl/owl.js:2437)

Caused by: TypeError: Cannot read properties of undefined (reading 'detail')
    at CustomFilterItem.onRelationalChanged (http://oca-web-16-0-pr2357-28f8ea5b62bd.runboat.odoo-community.org/web/assets/debug/web.assets_backend.js:175070:16) (/web_advanced_search/static/src/js/owl/CustomFilterItem.esm.js:75)
    at CustomFilterItem.slot2 (eval at compile (http://oca-web-16-0-pr2357-28f8ea5b62bd.runboat.odoo-community.org/web/assets/debug/web.assets_common.js:21606:16), <anonymous>:136:52) (/web/static/lib/owl/owl.js:5436)
    at callSlot (http://oca-web-16-0-pr2357-28f8ea5b62bd.runboat.odoo-community.org/web/assets/debug/web.assets_common.js:19053:37) (/web/static/lib/owl/owl.js:2883)
    at Dropdown.template (eval at compile (http://oca-web-16-0-pr2357-28f8ea5b62bd.runboat.odoo-community.org/web/assets/debug/web.assets_common.js:21606:16), <anonymous>:33:18) (/web/static/lib/owl/owl.js:5436)
    at Fiber._render (http://oca-web-16-0-pr2357-28f8ea5b62bd.runboat.odoo-community.org/web/assets/debug/web.assets_common.js:17791:38) (/web/static/lib/owl/owl.js:1621)
    at Fiber.render (http://oca-web-16-0-pr2357-28f8ea5b62bd.runboat.odoo-community.org/web/assets/debug/web.assets_common.js:17783:18) (/web/static/lib/owl/owl.js:1613)
    at ComponentNode.updateAndRender (http://oca-web-16-0-pr2357-28f8ea5b62bd.runboat.odoo-community.org/web/assets/debug/web.assets_common.js:18607:19) (/web/static/lib/owl/owl.js:2437)

@rven rven force-pushed the 16.0-mig-web_advanced_search branch 2 times, most recently from 27189d1 to cc89e88 Compare January 24, 2023 15:00
@rven
Copy link
Contributor

rven commented Jan 24, 2023

The error is fixed, but the filter's dropdown will be closed after a selection.

Could anyone suggest what needs to be changed to prevent this?

This does not work anymore

    /**
     * Stop propagation of the autocompleteselect event.
     * Otherwise, the filter's dropdown will be closed after a selection.
     *
     * @override to stop propagating autocompleteselect event
     */
    start: function () {
        this._super(...arguments);
        this.$input.on("autocompleteselect", (event) => event.stopPropagation());
    },

@rven rven force-pushed the 16.0-mig-web_advanced_search branch from cc89e88 to da85bfb Compare February 3, 2023 13:25
@dynapps
Copy link

dynapps commented Feb 3, 2023

I figured out after long investigation why the Filter menu was closed after selecting a value in the RecordPicker Component.
The selection values are added at this place
image
This causes the filter menu to be closed, when selecting a value, because it reaches this code in Odoo
https://github.com/odoo/odoo/blob/16.0/addons/web/static/src/core/dropdown/dropdown.js#L277-L305
gotClickedInside results in false, because the ul element doesn't belong to the o_add_custom_filter_menu
image
If somebody knows a better solution than patching the dropDown component please let me know!

patch(Dropdown.prototype, "dropdown", {
    onWindowClicked(ev) {
        // This patch is created to prevent the closing of the Filter menu
        // when a selection is made in the RecordPicker
        if (
            $(ev.target.closest("ul.dropdown-menu")).attr("id") !== undefined &&
            $(ev.target.closest("ul.dropdown-menu")).attr("id") ===
                $("body > ul.dropdown-menu").attr("id")
        ) {
            return;
        }
        this._super(ev);
    },
});

But for now the solution is working fine!

@kmagusiak
Copy link

In debug mode, inputting the domain in the editor seems to have no effect. It was a very handy feature if you copy-paste a domain.
image

@pedrobaeza
Copy link
Member

But that's something of this module, or something of the domain editor widget of Odoo core?

@rven
Copy link
Contributor

rven commented Feb 17, 2023

But that's something of this module, or something of the domain editor widget of Odoo core?

I think this is something that is fixed by this odoo/odoo#109238

odoo/odoo@a29691b

@liebana
Copy link

liebana commented Mar 7, 2023

There's a weird behaviour searching in one 2 many fields in custom filter (not in advanced). For example, filtering products that contains product category "furniture" it makes the search, but replaces the text string by "e" in the filter bar.

image

hbrunn and others added 13 commits March 7, 2023 14:45
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.
@pedrobaeza
Copy link
Member

@StefanRijnhart is it ok for you?

@pedrobaeza
Copy link
Member

/ocabot migration web_advanced_search

@OCA-git-bot OCA-git-bot added this to the 16.0 milestone Mar 14, 2023
@StephaneMangin
Copy link
Contributor

@StefanRijnhart Can you update your review please to go further ? Thanks

@vib-adhoc
Copy link

Hi @rven , I detected an error with the Odoo Enterprise Timesheets application.

Odoo - My Timesheets

Full traceback:

UncaughtPromiseError > OwlError Uncaught Promise > Cannot find the definition of component "AdvancedFilterItem" OwlError: Cannot find the definition of component "AdvancedFilterItem" at http://16.odoo.localhost/web/assets/409-49aa605/web.assets_common.min.js:2073:33 at FilterMenu.slot2 (eval at compile (http://16.odoo.localhost/web/assets/409-49aa605/web.assets_common.min.js:2040:370), <anonymous>:69:11) at callSlot (http://16.odoo.localhost/web/assets/409-49aa605/web.assets_common.min.js:1652:25) at Dropdown.template (eval at compile (http://16.odoo.localhost/web/assets/409-49aa605/web.assets_common.min.js:2040:370), <anonymous>:33:18) at RootFiber._render (http://16.odoo.localhost/web/assets/409-49aa605/web.assets_common.min.js:1477:96) at RootFiber.render (http://16.odoo.localhost/web/assets/409-49aa605/web.assets_common.min.js:1476:6) at ComponentNode.render (http://16.odoo.localhost/web/assets/409-49aa605/web.assets_common.min.js:1562:56)

Could you review this before merging?

@chienandalu
Copy link
Member

@vib-adhoc the compatibility scope for OCA modules is limited to Odoo core (CE) and optionally other OCA modules. Enterprise or other private modules compatibility should be non blocking IMO.

@rafaelbn
Copy link
Member

Thank you for this great work @hvgollar @rven ! 😄 ❤️

@modon MT-2797

Copy link

@fcvalgar fcvalgar left a comment

Choose a reason for hiding this comment

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

Functional review.
LGTM, Thank you @hbrunn @StefanRijnhart and all maintainers.

@yajo
Copy link
Member

yajo commented Apr 27, 2023

I detected an error with the Odoo Enterprise Timesheets application

It turns out that Odoo 16 is still using the web.FilterMenu legacy widget for the also legacy web.ControlPanel widget. Also turns out that the timesheets app uses those legacy widgets.

This PR is removing legacy widget support (which was included for v15). Thus, that app breaks.

This can be considered a regression, because that support was there in the previous version. Happens in the timesheet app, but chances are that it happens on any other custom apps that use legacy widgets too.

A good solution, to avoid supporting those legacy widgets, is to disable the feature on legacy contexts. A better one would be to not remove the files and update them instead.

@rven
Copy link
Contributor

rven commented Apr 27, 2023

I detected an error with the Odoo Enterprise Timesheets application

It turns out that Odoo 16 is still using the web.FilterMenu legacy widget for the also legacy web.ControlPanel widget. Also turns out that the timesheets app uses those legacy widgets.

This PR is removing legacy widget support (which was included for v15). Thus, that app breaks.

This can be considered a regression, because that support was there in the previous version. Happens in the timesheet app, but chances are that it happens on any other custom apps that use legacy widgets too.

A good solution, to avoid supporting those legacy widgets, is to disable the feature on legacy contexts. A better one would be to not remove the files and update them instead.

Ok, I didn't know why those files were in there, I'll have a closer look at them

@rven rven force-pushed the 16.0-mig-web_advanced_search branch from 989a042 to dba9530 Compare April 27, 2023 14:41
@rven
Copy link
Contributor

rven commented Apr 27, 2023

Hi @vib-adhoc, I solved the error with the Odoo Enterprise Timesheets application. I also verified it already.

Can you re-test this?

@rven rven force-pushed the 16.0-mig-web_advanced_search branch from dba9530 to c77f504 Compare April 27, 2023 14:45
@vib-adhoc
Copy link

Hi, @rven it works fine!
Thank you

Copy link
Member

@yajo yajo left a comment

Choose a reason for hiding this comment

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

Tested it on Timesheets too, and elsewhere. Thanks!

/ocabot merge patch

@hbrunn
Copy link
Member

hbrunn commented Apr 28, 2023

I just want to say thank you to everyone involved for how you carried what I once started through all the Odoo versions so far, and making it better on the way 🍰

@OCA-git-bot
Copy link
Contributor

Hey, thanks for contributing! Proceeding to merge this for you.
Prepared branch 16.0-ocabot-merge-pr-2357-by-yajo-bump-patch, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit 8b93352 into OCA:16.0 Apr 28, 2023
@OCA-git-bot
Copy link
Contributor

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

@augusto-weiss
Copy link

augusto-weiss commented May 23, 2023

Hi everyone!! I notice an error selecting many2one fields in the Custom filter.
When select to add a field "is equal to" and adding an extra condition like the first one, the filter disappears!
Whats about that ?? Somebody know??

@rven @chienandalu @pedrobaeza

Odoo.-.Customers.webm

@rven
Copy link
Contributor

rven commented May 23, 2023

@augusto-weiss please check #2513 if this is ok for you?

@augusto-weiss
Copy link

Hi @rven! Works as expected!! Thanks a lot! i will comment on PR

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.