OpenSur / Odoo_addons

Odoo addons published
23 stars 40 forks source link

website_search error 500: internal server error - Odoo 8 (31/1/2015) #7

Closed akram1 closed 9 years ago

akram1 commented 9 years ago

Your fix on 6/2 fixed the installing problem but the website is now not functional with error: Error: unexpected EOF while parsing (, line 0) QWeb Error: Could not evaluate expression '' Traceback (most recent call last): File "/media/akram/Data/projects/servers/odoo8/source/addons/website/models/ir_http.py", line 204, in _handle_exception response = super(ir_http, self)._handle_exception(exception) File "/media/akram/Data/projects/servers/odoo8/source/openerp/addons/base/ir/ir_http.py", line 100, in _handle_exception return request._handle_exception(exception) File "/media/akram/Data/projects/servers/odoo8/source/openerp/http.py", line 659, in _handle_exception return super(HttpRequest, self)._handle_exception(exception) File "/media/akram/Data/projects/servers/odoo8/source/openerp/http.py", line 1358, in get_response result.flatten() File "/media/akram/Data/projects/servers/odoo8/source/openerp/http.py", line 1231, in flatten self.response.append(self.render()) File "/media/akram/Data/projects/servers/odoo8/source/openerp/http.py", line 1225, in render context=request.context) File "/media/akram/Data/projects/servers/odoo8/source/openerp/api.py", line 241, in wrapper return old_api(self, _args, _kwargs) File "/media/akram/Data/projects/servers/odoo8/source/addons/website/models/ir_ui_view.py", line 172, in render return super(view, self).render(cr, uid, id_or_xml_id, values=values, engine=engine, context=context) File "/media/akram/Data/projects/servers/odoo8/source/openerp/api.py", line 241, in wrapper return old_api(self, _args, _kwargs) File "/media/akram/Data/projects/servers/odoo8/source/openerp/addons/base/ir/ir_ui_view.py", line 1015, in render return self.pool[engine].render(cr, uid, id_or_xml_id, qcontext, loader=loader, context=context) File "/media/akram/Data/projects/servers/odoo8/source/openerp/api.py", line 241, in wrapper return old_api(self, _args, _kwargs) File "/media/akram/Data/projects/servers/odoo8/source/openerp/addons/base/ir/ir_qweb.py", line 253, in render return self.render_node(self.get_template(id_or_xml_id, qwebcontext), qwebcontext) File "/media/akram/Data/projects/servers/odoo8/source/openerp/addons/base/ir/ir_qweb.py", line 294, in render_node result = self.render_element(element, template_attributes, generated_attributes, qwebcontext) File "/media/akram/Data/projects/servers/odoo8/source/openerp/addons/base/ir/ir_qweb.py", line 315, in render_element g_inner.append(self.render_node(current_node, qwebcontext)) File "/media/akram/Data/projects/servers/odoo8/source/openerp/addons/base/ir/ir_qweb.py", line 292, in render_node result = self._render_tag[t_render](self, element, template_attributes, generated_attributes, qwebcontext) File "/media/akram/Data/projects/servers/odoo8/source/openerp/addons/base/ir/ir_qweb.py", line 439, in render_tag_call return self.render(cr, uid, template, d) File "/media/akram/Data/projects/servers/odoo8/source/openerp/api.py", line 241, in wrapper return old_api(self, _args, _kwargs) File "/media/akram/Data/projects/servers/odoo8/source/openerp/addons/base/ir/ir_qweb.py", line 253, in render return self.render_node(self.get_template(id_or_xml_id, qwebcontext), qwebcontext) File "/media/akram/Data/projects/servers/odoo8/source/openerp/addons/base/ir/ir_qweb.py", line 294, in render_node result = self.render_element(element, template_attributes, generated_attributes, qwebcontext) File "/media/akram/Data/projects/servers/odoo8/source/openerp/addons/base/ir/ir_qweb.py", line 315, in render_element g_inner.append(self.render_node(current_node, qwebcontext)) File "/media/akram/Data/projects/servers/odoo8/source/openerp/addons/base/ir/ir_qweb.py", line 294, in render_node result = self.render_element(element, template_attributes, generated_attributes, qwebcontext) File "/media/akram/Data/projects/servers/odoo8/source/openerp/addons/base/ir/ir_qweb.py", line 315, in render_element g_inner.append(self.render_node(current_node, qwebcontext)) File "/media/akram/Data/projects/servers/odoo8/source/openerp/addons/base/ir/ir_qweb.py", line 294, in render_node result = self.render_element(element, template_attributes, generated_attributes, qwebcontext) File "/media/akram/Data/projects/servers/odoo8/source/openerp/addons/base/ir/ir_qweb.py", line 315, in render_element g_inner.append(self.render_node(current_node, qwebcontext)) File "/media/akram/Data/projects/servers/odoo8/source/openerp/addons/base/ir/ir_qweb.py", line 294, in render_node result = self.render_element(element, template_attributes, generated_attributes, qwebcontext) File "/media/akram/Data/projects/servers/odoo8/source/openerp/addons/base/ir/ir_qweb.py", line 315, in render_element g_inner.append(self.render_node(current_node, qwebcontext)) File "/media/akram/Data/projects/servers/odoo8/source/openerp/addons/base/ir/ir_qweb.py", line 294, in render_node result = self.render_element(element, template_attributes, generated_attributes, qwebcontext) File "/media/akram/Data/projects/servers/odoo8/source/openerp/addons/base/ir/ir_qweb.py", line 315, in render_element g_inner.append(self.render_node(current_node, qwebcontext)) File "/media/akram/Data/projects/servers/odoo8/source/openerp/addons/base/ir/ir_qweb.py", line 294, in render_node result = self.render_element(element, template_attributes, generated_attributes, qwebcontext) File "/media/akram/Data/projects/servers/odoo8/source/openerp/addons/base/ir/ir_qweb.py", line 315, in render_element g_inner.append(self.render_node(current_node, qwebcontext)) File "/media/akram/Data/projects/servers/odoo8/source/openerp/addons/base/ir/ir_qweb.py", line 294, in render_node result = self.render_element(element, template_attributes, generated_attributes, qwebcontext) File "/media/akram/Data/projects/servers/odoo8/source/openerp/addons/base/ir/ir_qweb.py", line 315, in render_element g_inner.append(self.render_node(current_node, qwebcontext)) File "/media/akram/Data/projects/servers/odoo8/source/openerp/addons/base/ir/ir_qweb.py", line 294, in render_node result = self.render_element(element, template_attributes, generated_attributes, qwebcontext) File "/media/akram/Data/projects/servers/odoo8/source/openerp/addons/base/ir/ir_qweb.py", line 315, in render_element g_inner.append(self.render_node(current_node, qwebcontext)) File "/media/akram/Data/projects/servers/odoo8/source/openerp/addons/base/ir/ir_qweb.py", line 294, in render_node result = self.render_element(element, template_attributes, generated_attributes, qwebcontext) File "/media/akram/Data/projects/servers/odoo8/source/openerp/addons/base/ir/ir_qweb.py", line 315, in render_element g_inner.append(self.render_node(current_node, qwebcontext)) File "/media/akram/Data/projects/servers/odoo8/source/openerp/addons/base/ir/ir_qweb.py", line 275, in render_node for att, val in attrs: File "/media/akram/Data/projects/servers/odoo8/source/addons/website/models/ir_qweb.py", line 61, in render_att_att for att, val in super(QWeb, self).render_att_att(element, attribute_name, attribute_value, qwebcontext): File "/media/akram/Data/projects/servers/odoo8/source/openerp/addons/base/ir/ir_qweb.py", line 351, in render_att_att return [(attribute_name[6:], self.eval(attribute_value, qwebcontext))] File "/media/akram/Data/projects/servers/odoo8/source/openerp/addons/base/ir/ir_qweb.py", line 197, in eval raise_qweb_exception(message="Could not evaluate expression %r" % expr, expression=expr, template=template) File "/media/akram/Data/projects/servers/odoo8/source/openerp/addons/base/ir/ir_qweb.py", line 194, in eval return qwebcontext.safe_eval(expr) File "/media/akram/Data/projects/servers/odoo8/source/openerp/addons/base/ir/ir_qweb.py", line 80, in safe_eval return eval(expr, None, locals_dict, nocopy=True, locals_builtins=True) File "/media/akram/Data/projects/servers/odoo8/source/openerp/tools/safe_eval.py", line 312, in safe_eval c = test_expr(expr, _SAFE_OPCODES, mode=mode) File "/media/akram/Data/projects/servers/odoo8/source/openerp/tools/safe_eval.py", line 167, in test_expr code_obj = compile(expr, "", mode) QWebException: unexpected EOF while parsing (, line 0)

OpenSur commented 9 years ago

Can you tell me steps to reproduce the problem?

akram1 commented 9 years ago

1- I use GreenOdoo on Ubuntu 14.04 64bit. 2- Extract green odoo then extract your module into the addons directory 3- Start GreenOdoo 4- After installing a new database, I install Website Builder module then your modules 5- I install website_search and Restart server 6- I get the error then uninstall 7- I install website_lang_flags 8- Install new language (Arabic) with Overwrite Existing Terms option. 9- Add a flag to English. The website still has no flags 10- Restart server 11- lang_flags works but no flags shown only a down arrow on the right of side. 12- Everything works with the down arrow (showing flags and switching langs) but no flag indecator shown on the website.

OpenSur commented 9 years ago

Let me confirm if I understood correctly: you see flags when open drop down menu, but not see flag for current website language. Is that right?

akram1 commented 9 years ago

Yes this is correct for lang_flags. I hope you were able to reproduce the issues.

Thanks for your fast reply and your work.

On 06 فبر, 2015 ص 04:04, Dev Team wrote:

Let me confirm if I understood correctly: you see flags when open drop down menu, but not see flag for current website language. Is that right?

— Reply to this email directly or view it on GitHub https://github.com/OpenSur/Odoo_addons/issues/7#issuecomment-73163027.

lukebranch commented 9 years ago

@OpenSur ,

Awesome work on these modules, unfortunately I cannot get website_search to work. I get the following traceback:

Steps to reproduce:

1) create clean Ubuntu 14.04 install 2) install Odoo using this script: https://github.com/lukebranch/odoo-install-scripts/blob/master/odoo-saas4/ubuntu-14-04/odoo_install.sh 3) create fresh clean database 4) clone from 8.0 branch for this repo 5) make a symbolic link for website_search to the odoo addons directory: /opt/odoo/custom/addons/website_search 6) Install module (module installs without traceback error on install) 7) go to home page 8) Error as seen above in image.

This seems to be something to do with syntax, although I can't pinpoint exactly where. Do you think it has something to do with the way html2text.py and it's syntax?

I've posted on the forum on this post:

https://www.odoo.com/forum/help-1/question/enhanced-improved-front-end-e-commerce-cms-search-module-57233

and this one:

https://www.odoo.com/forum/help-1/question/how-works-search-on-website-69352

regarding your module, as I believe there will be a huge amount of interest in this particular module once it is stable for 8.0.

lukebranch commented 9 years ago

@OpenSur ,

Further to my post above i've noticed that the snippet from line 41-56 in:

/website_search/views/website_search.xml

is throwing the traceback.

The snippet of code is as follows:

<template id="top_menu_search_field" inherit_id="website.layout" customize_show="True" name="Search field on menu">
    <xpath expr="//ul[@id='top_menu']" position="after">
        <form class="navbar-form navbar-right" t-attf-action="/search_results" method="get" >
            <div class="input-group" style="width: 12em;" t-att-data-editable=''>
                <input type="search" t-att-value="search or ''" name="search" class="form-control input-sm" placeholder="Search" t-att-data-editable=''/>
                <span class="input-group-btn" t-att-data-editable=''>
                    <button class="btn btn-default btn-xs" t-att-data-editable='' t-attf-href="/search_results?{{keep_query('sorting', 'search_on_pages', 'search_on_blogposts', 'search_on_comments', 'search_on_customers', 'search_on_jobs', 'search_on_products', 'case_sensitive', search=search, search_advanced='0')}}" >
                            <span class="fa fa-search"></span>
                    </button>
                    <a class="btn btn-default btn-xs" contenteditable="false" t-attf-href="/search_advanced"><span class="fa fa-wrench"></span></a>
                </span>
            </div>
        </form>

    </xpath>
</template>

Commenting out this particular snippet resolves this particular issue as a temporary workaround. @akram1 , this may help you in terms of testing the module to begin with.

OpenSur commented 9 years ago

Thanks akram1, will review this week...

OpenSur commented 9 years ago

I fixed the snippet, please check and confirm. Can you evaluate this addon in Odoo site?

akram1 commented 9 years ago

The fix fixed the 500 internal error. Good work, now I can test it. Couple of issues appeared: 1- The search feature is repeated 3 times in the navbar. It should appear as the last item on the right. 2- From left to right: search box: works fine search button: always shows search page with no result search button: expands as search box but nothing is working. 3- Advanced search shows: Page, Blogs, Comments, Clients, Jobs, Products. I think Events, Forum, News should be included. Also it should detect witch website module installed and index it. 4- Searching sometimes not correct: I searched event with (Los Angeles) but no result while (Technical Training) is good. I installed English DB with demo data as shown in the pictures. 5 For enhancing the module: search on search results is a good feature just like Odoo search. Save searches. Tested on Ubuntu 14.04 Chromium 39

2015-02-09-212303_1366x768_scrot 2015-02-09-212306_1366x768_scrot 2015-02-09-212327_1366x768_scrot 2015-02-09-212338_1366x768_scrot

OpenSur commented 9 years ago

Answers:

1- The search feature is repeated 3 times in the navbar. It should appear as the last item on the right.

Answer - Didn't find a way to appear only one of the options after you install. You just need to go to customize options, and select which option you will use (reasonable to use only one option).

2- From left to right: search box: works fine

search button: always shows search page with no result Answer - this options is intended to only open search page (if you use this option, you don't have a way to enter search term from icon), can be used when navbar is crowded and you don't want to have a dropdown search.

search button: expands as search box but nothing is working.

Answer - third option is search field, in case you want a search field always visible in navbar. Please select only one option and retest.

3- Advanced search shows: Page, Blogs, Comments, Clients, Jobs, Products. I think Events, Forum, News should be included. Also it should detect witch website module installed and index it.

Answer - As I understand, News are implemented using blogs, so it already checks if blog is installed and search over blog posts. Let me know otherwise...

4- Searching sometimes not correct: I searched event with (Los Angeles) but no result while (Technical Training) is good. I installed English DB with demo data as shown in the pictures.

Answer: It will search according to language selected in your website at the moment of search. So if you select a language that is not base language, will search on translations. Probably you didn't get a result because is not searching on events contents, that could be something to add in the future...

5 For enhancing the module: search on search results is a good feature just like Odoo search. Save searches.

Answer: Yes, can be considered for future versions. In this first version, we assumed that visitor searching is just a temporal website visitor

OpenSur commented 9 years ago

Search in Events and Forum are features to add in future versions...

akram1 commented 9 years ago

1- I see how I can choose one search option. First and second options are working fine. Third one is not. Seach button not working while Advanced button works. You have to hit Enter to make it search.

2- Searching sometimes not correct: I searched event with (Los Angeles) but no result while (Technical Training) is good. There is only one langauge installed. The first word found in title only while the second one found in the title and body content, so search module is probably searching contents not titles.

OpenSur commented 9 years ago

1- will review

2 - it does not search on events, so it's correct that you don't find "Los Angeles". The result you obtained for "technical training" comes from a customer reference

lukebranch commented 9 years ago

@OpenSur ,

Thank you for responding and issuing a fix so quickly. I'll try installing again on a fresh database after a git pull and will report back if I run into any issues. This fills a huge hole in Odoo 8.0 - the lack of a good quality search engine (especially a fully-integrated one that covers both content and product searches) - and I think this will be incredibly popular once the community catches on.

In regards to features requests, would you prefer that I create a github issue labelled [FEATURE REQUEST], or some other means to provide feature requests to you?

I have been using a (third-party) SaaS search engine that runs on Sphinx Search for Magento:

http://demo.searchanise.com/magento/

and some of the features are quite useful (eg. AJAX autocomplete preview from search bar).

lukebranch commented 9 years ago

@akram1 ,

You can choose the options through the Customize menu on the frontend:

just select these different options according to what views you want displayed. This is done in the XML through an option in the XHTML customize_show="True" (have this set to true adds these tickboxes to the customise menu to allow you to switch views on and off).

By default when installed all views are set to display. You can choose to switch them off as you need from this menu.

akram1 commented 9 years ago

Dropdown search button is not working: I changed line 68 in /views/website_search.xml from

akram1 commented 9 years ago

I mean To button class="btn btn-default btn-xs" t-attf-href="/search_results?{{keep_query('sorting', 'search_on_pages', 'search_on_blogposts', 'search_on_comments', 'search_on_customers', 'search_on_jobs', 'search_on_products', 'case_sensitive', search=search, search_advanced='0')}}"

OpenSur commented 9 years ago

Ok, will try it and update github, thanks for your collaboration...

akram1 commented 9 years ago

I think it is better to make drop down search field little longer. So same file above and line 63: ul class="dropdown-menu" style="padding:10px; width: 16em;"

OpenSur commented 9 years ago

Will do. Somebody posted a comment on odoo apps that this module broke his website. I think should be first version that had error on install. Can you evaluate to help improve stars?