تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
7 الردود
5364 أدوات العرض

Hello all,

How could I unfold, by default, this advanced search view in a particular view? It is not displayed by default.

Thanks

Update :

In the file /addons/web/static/src/xml/base.xml, even with this, the drawer only appears when we click. Not by default :

<div t-name="SearchViewDrawer" class="oe_searchview_drawer" style="display:block;">
    <div class="col-md-7"></div>
    <div class="col-md-5"></div>
</div>

???

الصورة الرمزية
إهمال
الكاتب

still not found.

الكاتب

Somebody has a solution for this?

أفضل إجابة

Hello Pascal,

Your problem is very easy to deal with.

Here I am giving the place where you need to change. However you need to extend the code yourself in your custom module. (I guess you know how to build custom web module)

Step 1 : Go to web/static/src/js folder and open search.js file

In class instance.web.SearchView there is one function named as start. You need to change your code here.

Step 2 : Little change in start function. 

From line no. 440 to 445 (this the updated Odoo of july 11, 2015 from github) you will find this code block,

        if (view_manager) {
            this.view_manager = view_manager;
            view_manager.on('switch_mode', this, function (e) {
                self.drawer.toggle(e === 'graph');
            });
        }

You just need to replace following line,

self.drawer.toggle(e === 'graph'); 

with this line, 

self.drawer.toggle(e!=='form'); 

So finally that code block will look like as follows,

        if (view_manager) {
this.view_manager = view_manager;
view_manager.on('switch_mode', this, function (e) {
//self.drawer.toggle(e === 'graph');
self.drawer.toggle(e!=='form');
});
}


Reason of why I replaced line :  By default only at "graph" view, search view was showing unfolded. I made search view unfolded in every view except "form" view.

Perfact Solution : You can make your custom web module, extend the class instance.web.SearchView & override the function "start". It is very easy. 

Suggetion : Never do direct change on base addons of Odoo. Once you update from git, all your custom changes will be deleted.

Finally I hope this post will help you to achieve exactly what you want.  "(whew):skype"

Latest update : This module is freely available at this link .

الصورة الرمزية
إهمال
الكاتب

You are great. I will try it soon!!!!1

Hello Pascal, Empiro Tech... this is a related question: https://www.odoo.com/forum/help-1/question/expand-search-results-by-default-83657 .... if possible, could you please have a look at this and let me know in case you have some idea? I think some JS tweaking should do the trick for my question as well, but I'm not able to get it right.

Hello Shawn, Already that module is available at Odoo shop. https://www.odoo.com/apps/modules/8.0/web_search_results_unfold/

Oh ok. Thanks !

أفضل إجابة

UPDATE: I removed my answer

PS. If you have edited and changed the question after answer, my answer has become stupid. It is not fair.

 

الصورة الرمزية
إهمال
الكاتب

ok. I try it an I come back here. THANKS

الكاتب

With this tip, the advanced search view will be expanded?

الكاتب

sorry zbik. 1000 excuses. It won't arrive anymore.