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]17.0-mig-web_search_with_and #2876

Open
wants to merge 29 commits into
base: 17.0
Choose a base branch
from

Conversation

jcadhoc
Copy link

@jcadhoc jcadhoc commented Jul 8, 2024

No description provided.

Andrius Preimantas and others added 29 commits July 8, 2024 12:33
Add README.rst

Too short underline for module title in README.rst

Improving module meta information

Version 1.0

W391 blank line at end of file

Remove module description because README.rst is there

web_search_with_and: Latest OCA conventions
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: web-16.0/web-16.0-web_search_with_and
Translate-URL: https://translation.odoo-community.org/projects/web-16-0/web-16-0-web_search_with_and/
Copy link

@bruno-zanotti bruno-zanotti left a comment

Choose a reason for hiding this comment

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

Technical review LGTM

Copy link
Member

@flotho flotho left a comment

Choose a reason for hiding this comment

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

successfully tested on runboat

@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). 🤖

Copy link

@antoniocanovas antoniocanovas left a comment

Choose a reason for hiding this comment

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

Functiona review OK !!

Copy link
Contributor

@CRogos CRogos left a comment

Choose a reason for hiding this comment

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

import {SearchBar} from "@web/search/search_bar/search_bar";

patch(SearchBar.prototype, {
selectItem(item) {
Copy link
Member

Choose a reason for hiding this comment

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

This method seems to have changed in Odoo 17: https://github.com/odoo/odoo/blob/f1f8cbf/addons/web/static/src/search/search_bar/search_bar.js#L341-L348
Given that the method is overwritten without calling super, you'd have to incorporate the new code in this module.

Copy link
Contributor

Choose a reason for hiding this comment

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

@jcadhoc I think you need to change this, because in Odoo 16 the method looked like this:

    selectItem(item) {
        if (!item.unselectable) {
            const { searchItemId, label, operator, value } = item;
            this.env.searchModel.addAutoCompletionValues(searchItemId, { label, operator, value });
        }
        this.resetState();
    }

And in this module this parameter was added: isShiftKey: this.isShiftKey to the addAutoCompletionValues call.

And because in Odoo 17 the method is like this:

    selectItem(item) {
        const searchItem = this.getSearchItem(item.searchItemId);
        if (
            (searchItem.type === "field" && searchItem.fieldType === "properties") ||
            (searchItem.type === "field_property" && item.unselectable)
        ) {
            this.toggleItem(item, !item.isExpanded);
            return;
        }

        if (!item.unselectable) {
            const { searchItemId, label, operator, value } = item;
            this.env.searchModel.addAutoCompletionValues(searchItemId, { label, operator, value });
        }
        this.resetState();
    }

You need to replace the method with the new code and add the isShiftKey: this.isShiftKey to the addAutoCompletionValues call.

In general overwriting methods without calling super is problematic, but in this case I do not have a better solution. But I am also not a Odoo JS expert.

@CRogos
Copy link
Contributor

CRogos commented Sep 13, 2024

@jcadhoc are you still working on this?

@jcadhoc
Copy link
Author

jcadhoc commented Oct 8, 2024

i`m available again, thanks @CRogos.

@StefanRijnhart Hi Stefan! You mean literally copy and paste that code you shared?

@StefanRijnhart
Copy link
Member

@StefanRijnhart Hi Stefan! You mean literally copy and paste that code you shared?

Well, that depends on whether it affects the functionality of this module.

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.