blooparksystems / website

Odoo Website builder related addons
GNU Affero General Public License v3.0
10 stars 33 forks source link

[FIX] missing render_tail in website_compress_html issue #70 #71

Closed ateijelo closed 7 years ago

ateijelo commented 7 years ago

Hi, @rruebner Hi @kaerdsar

I made this module work, but I'm not sure why QWeb was extended in two places (in website_compress_html/ir/ir_qweb.py and website_compress_html/models/ir_qweb.py). I moved the code from ir to models. Maybe @Benniphx could comment.

Thanks.

rruebner commented 7 years ago

Hi @ateijelo, I looked at your changes and talked to @Benniphx.

First, this module was build for odoo v8 based on the commit https://github.com/odoo-dev/odoo/commit/3f6ad35ed1dfc5c2cb4139e5c6abfdf578ef3669. So "website_compress_html/ir/ir_qweb.py" overwrites the model ir.qweb in the base module and "website_compress_html/models/ir_qweb.py" overwrites the model website.qweb in the website module.

So the different overwriting is important, please change back the ir.qweb merge. But I agree, you should do both overwriting in "website_compress_html/models/ir_qweb.py". Here you can overwrite the two models ir.qweb and website.qweb.

To fix the error in #70 you have to add the function render_tail() in the model ir.qweb (see the commit above), it was somehow forgotten or we needn't it in the past, I don't know.

ateijelo commented 7 years ago

Thanks @rruebner

Just to be sure of one thing, in "website_compress_html/ir/ir_qweb.py" the class QWeb inherited from ir_qweb.QWeb (from openerp.addons.base.ir) but didn't have an _inherit attribute. Does that replace ir.qweb as well? Or was _inherit missing?

rruebner commented 7 years ago

@ateijelo You should use "_inherit" for ir.qweb too, like it is done for website.qweb.

ateijelo commented 7 years ago

@rruebner I took some time to carefully read the odoo-dev commit and as you suggested, all that was needed was to add render_tail in website_compress_html/ir/ir_qweb.py.

I still don't understand, however, how do the methods in website_compress_ir/ir_qweb.py get called, since the class QWeb in that file doesn't use _inherit. And they do get called. I print'd some messages, I set breakpoints, etc. I even tried renaming the class to something random, hoping to see an error in the place where it was being instantiated, but it just worked.

Sorry to bother with my rookie questions and thanks for your patience.

rruebner commented 7 years ago

@ateijelo The inheritance in "website_compress_html/ir/ir_qweb.py" is the normal Python inheritance, see An Introduction to Classes and Inheritance as an example. We should rewrite it later to use the odoo "_inherit attribute".