Skip to content

[website_event_excerpt_img] Better layout for website events. - #41

Merged
rafaelbn merged 6 commits into
OCA:8.0from
yajo:website_event_excerpt_img
Sep 10, 2016
Merged

[website_event_excerpt_img] Better layout for website events.#41
rafaelbn merged 6 commits into
OCA:8.0from
yajo:website_event_excerpt_img

Conversation

@yajo

@yajo yajo commented Mar 22, 2016

Copy link
Copy Markdown
Member

This displays an image taken from the event description and an excerpt in the events page, making it more attractive.

This one is quite similar to OCA/website#163, but for events.

This is WIP because it will not work until these are merged:

The final result:

@rafaelbn @dgzurita

@yajo

yajo commented Apr 1, 2016

Copy link
Copy Markdown
Member Author

New commit allows to enable events occupying half or full row, like here:

captura de pantalla de 2016-04-01 18-08-17

Not perfect, but as close as I can get without fully overwriting the much improvable default design from core.

@yajo

yajo commented Apr 4, 2016

Copy link
Copy Markdown
Member Author

Since core Odoo's layout was so unworkable, I remade it. Less options, easier, beautier:

@rafaelbn

Copy link
Copy Markdown
Member

cc @antespi

@rafaelbn rafaelbn added this to the 8.0 milestone Apr 12, 2016
@coveralls

coveralls commented May 5, 2016

Copy link
Copy Markdown

Coverage Status

Coverage decreased (-4.3%) to 88.276% when pulling 7a8dbb5 on Yajo:website_event_excerpt_img into 355be86 on OCA:8.0.

@pedrobaeza

Copy link
Copy Markdown
Member

👍

@rafaelbn

Copy link
Copy Markdown
Member

Functional tested

  • Go to runbot (all modules)
  • Create an Event
  • Go to website yo Event's page
  • 500: Internal Server Error
  • The error could come when using toguether this module and website_event_filter_selector, in a base database this error occurs after installing website_event_filter_selector.
500: Internal Server Error
Error

Error message:

"'bool' object has no attribute '__getitem__'" while evaluating
"type['type'][0]"

QWeb
Traceback

Traceback (most recent call last):
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3146717-41-7a8dbb/openerp/addons/website/models/ir_http.py", line 199, in _handle_exception
    response = super(ir_http, self)._handle_exception(exception)
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3146717-41-7a8dbb/openerp/addons/base/ir/ir_http.py", line 145, in _handle_exception
    return request._handle_exception(exception)
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3146717-41-7a8dbb/openerp/http.py", line 668, in _handle_exception
    return super(HttpRequest, self)._handle_exception(exception)
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3146717-41-7a8dbb/openerp/http.py", line 1372, in get_response
    result.flatten()
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3146717-41-7a8dbb/openerp/http.py", line 1243, in flatten
    self.response.append(self.render())
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3146717-41-7a8dbb/openerp/http.py", line 1237, in render
    context=request.context)
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3146717-41-7a8dbb/openerp/api.py", line 268, in wrapper
    return old_api(self, *args, **kwargs)
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3146717-41-7a8dbb/openerp/addons/website/models/ir_ui_view.py", line 173, in render
    return super(view, self).render(cr, uid, id_or_xml_id, values=values, engine=engine, context=context)
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3146717-41-7a8dbb/openerp/api.py", line 268, in wrapper
    return old_api(self, *args, **kwargs)
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3146717-41-7a8dbb/openerp/addons/base/ir/ir_ui_view.py", line 1022, in render
    return self.pool[engine].render(cr, uid, id_or_xml_id, qcontext, loader=loader, context=context)
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3146717-41-7a8dbb/openerp/api.py", line 268, in wrapper
    return old_api(self, *args, **kwargs)
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3146717-41-7a8dbb/openerp/addons/base/ir/ir_qweb.py", line 263, in render
    return self.render_node(self.get_template(id_or_xml_id, qwebcontext), qwebcontext)
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3146717-41-7a8dbb/openerp/addons/base/ir/ir_qweb.py", line 302, in render_node
    result = self.render_element(element, template_attributes, generated_attributes, qwebcontext)
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3146717-41-7a8dbb/openerp/addons/base/ir/ir_qweb.py", line 323, in render_element
    g_inner.append(self.render_node(current_node, qwebcontext))
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3146717-41-7a8dbb/openerp/addons/base/ir/ir_qweb.py", line 300, in render_node
    result = self._render_tag[t_render](self, element, template_attributes, generated_attributes, qwebcontext)
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3146717-41-7a8dbb/openerp/addons/base/ir/ir_qweb.py", line 438, in render_tag_call
    d[0] = self.render_element(element, template_attributes, generated_attributes, d)
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3146717-41-7a8dbb/openerp/addons/base/ir/ir_qweb.py", line 323, in render_element
    g_inner.append(self.render_node(current_node, qwebcontext))
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3146717-41-7a8dbb/openerp/addons/base/ir/ir_qweb.py", line 302, in render_node
    result = self.render_element(element, template_attributes, generated_attributes, qwebcontext)
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3146717-41-7a8dbb/openerp/addons/base/ir/ir_qweb.py", line 323, in render_element
    g_inner.append(self.render_node(current_node, qwebcontext))
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3146717-41-7a8dbb/openerp/addons/base/ir/ir_qweb.py", line 302, in render_node
    result = self.render_element(element, template_attributes, generated_attributes, qwebcontext)
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3146717-41-7a8dbb/openerp/addons/base/ir/ir_qweb.py", line 323, in render_element
    g_inner.append(self.render_node(current_node, qwebcontext))
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3146717-41-7a8dbb/openerp/addons/base/ir/ir_qweb.py", line 302, in render_node
    result = self.render_element(element, template_attributes, generated_attributes, qwebcontext)
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3146717-41-7a8dbb/openerp/addons/base/ir/ir_qweb.py", line 323, in render_element
    g_inner.append(self.render_node(current_node, qwebcontext))
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3146717-41-7a8dbb/openerp/addons/base/ir/ir_qweb.py", line 302, in render_node
    result = self.render_element(element, template_attributes, generated_attributes, qwebcontext)
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3146717-41-7a8dbb/openerp/addons/base/ir/ir_qweb.py", line 323, in render_element
    g_inner.append(self.render_node(current_node, qwebcontext))
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3146717-41-7a8dbb/openerp/addons/base/ir/ir_qweb.py", line 300, in render_node
    result = self._render_tag[t_render](self, element, template_attributes, generated_attributes, qwebcontext)
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3146717-41-7a8dbb/openerp/addons/base/ir/ir_qweb.py", line 447, in render_tag_call
    return self.render(cr, uid, template, d)
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3146717-41-7a8dbb/openerp/api.py", line 268, in wrapper
    return old_api(self, *args, **kwargs)
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3146717-41-7a8dbb/openerp/addons/base/ir/ir_qweb.py", line 263, in render
    return self.render_node(self.get_template(id_or_xml_id, qwebcontext), qwebcontext)
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3146717-41-7a8dbb/openerp/addons/base/ir/ir_qweb.py", line 302, in render_node
    result = self.render_element(element, template_attributes, generated_attributes, qwebcontext)
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3146717-41-7a8dbb/openerp/addons/base/ir/ir_qweb.py", line 323, in render_element
    g_inner.append(self.render_node(current_node, qwebcontext))
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3146717-41-7a8dbb/openerp/addons/base/ir/ir_qweb.py", line 300, in render_node
    result = self._render_tag[t_render](self, element, template_attributes, generated_attributes, qwebcontext)
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3146717-41-7a8dbb/openerp/addons/base/ir/ir_qweb.py", line 438, in render_tag_call
    d[0] = self.render_element(element, template_attributes, generated_attributes, d)
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3146717-41-7a8dbb/openerp/addons/base/ir/ir_qweb.py", line 323, in render_element
    g_inner.append(self.render_node(current_node, qwebcontext))
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3146717-41-7a8dbb/openerp/addons/base/ir/ir_qweb.py", line 302, in render_node
    result = self.render_element(element, template_attributes, generated_attributes, qwebcontext)
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3146717-41-7a8dbb/openerp/addons/base/ir/ir_qweb.py", line 323, in render_element
    g_inner.append(self.render_node(current_node, qwebcontext))
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3146717-41-7a8dbb/openerp/addons/base/ir/ir_qweb.py", line 300, in render_node
    result = self._render_tag[t_render](self, element, template_attributes, generated_attributes, qwebcontext)
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3146717-41-7a8dbb/openerp/addons/base/ir/ir_qweb.py", line 424, in render_tag_foreach
    ru.append(self.render_element(element, template_attributes, generated_attributes, copy_qwebcontext))
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3146717-41-7a8dbb/openerp/addons/base/ir/ir_qweb.py", line 323, in render_element
    g_inner.append(self.render_node(current_node, qwebcontext))
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3146717-41-7a8dbb/openerp/addons/base/ir/ir_qweb.py", line 285, in render_node
    for att, val in attrs:
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3146717-41-7a8dbb/openerp/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 "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3146717-41-7a8dbb/openerp/addons/base/ir/ir_qweb.py", line 359, in render_att_att
    return [(attribute_name[6:], self.eval(attribute_value, qwebcontext))]
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3146717-41-7a8dbb/openerp/addons/base/ir/ir_qweb.py", line 207, in eval
    raise_qweb_exception(message="Could not evaluate expression %r" % expr, expression=expr, template=template)
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3146717-41-7a8dbb/openerp/addons/base/ir/ir_qweb.py", line 204, in eval
    return qwebcontext.safe_eval(expr)
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3146717-41-7a8dbb/openerp/addons/base/ir/ir_qweb.py", line 89, in safe_eval
    return eval(expr, None, locals_dict, nocopy=True, locals_builtins=True)
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3146717-41-7a8dbb/openerp/tools/safe_eval.py", line 314, in safe_eval
    return eval(c, globals_dict, locals_dict)
  File "", line 1, in <module>
QWebException: "'bool' object has no attribute '__getitem__'" while evaluating
"type['type'][0]"

@rafaelbn

Copy link
Copy Markdown
Member

This module https://github.com/OCA/event/tree/8.0/event_multi_image add a field image_main to event.event

2016-05-11_2-32-58

Are both modules compatibles? Must we have any caution in the README?

@rafaelbn

Copy link
Copy Markdown
Member

I have found an error with images when using more than 1 translation in website.

  • Go to runbot and install 2 more languages (Spanish and German for ex.)
  • Set 1 language as default, for ex. Spanish
  • Disable in setting -> website setting language "English"
  • Create an Event and publish
  • Go to website -> events and insert a block with image, save
  • Check both translations Spanish and German, you will check both have same image
  • Now go to Spanish and change image
  • Check both transltation, check the error, the image are differents

2016-05-11_3-21-55

This force the user to change the image as many times as languages per each event

yajo added 4 commits May 11, 2016 16:34
This displays an image taken from the event description and an excerpt in the events page, making it more attractive.

Add event priority to display them as half or full row on website.

Simplify dramatically removing options. All or nothing now.

This rewrites completely the event index layout, but it was impossible to get the desired effect without that due to core design, so I simplified everything.
@yajo

yajo commented May 11, 2016

Copy link
Copy Markdown
Member Author

Hi @rafaelbn.

@coveralls

coveralls commented May 11, 2016

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.08%) to 88.428% when pulling a22c408 on Yajo:website_event_excerpt_img into 629e9b7 on OCA:8.0.

"version": "8.0.1.0.0",
"category": "Website",
"website": "http://www.antiun.com",
"author": "Antiun Ingeniería S.L., Odoo Community Association (OCA)",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Put here Tecnativa

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Tecnativa

@pedrobaeza

Copy link
Copy Markdown
Member

cc @Tecnativa

@carlosdauden

Copy link
Copy Markdown

Attend #41 (comment)
👍

Comment thread website_event_excerpt_img/README.rst Outdated
Contributors
------------

* Rafael Blasco <rafabn@antiun.com>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@rafaelbn

Copy link
Copy Markdown
Member

Thanks

@rafaelbn
rafaelbn merged commit 49cbe44 into OCA:8.0 Sep 10, 2016
@yajo
yajo deleted the website_event_excerpt_img branch September 12, 2016 07:23
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.

5 participants