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

web_nocreatedb: Trying to port to v8, unsuccessfully #88

Closed
alejandrosantana opened this issue Mar 2, 2015 · 8 comments
Closed

web_nocreatedb: Trying to port to v8, unsuccessfully #88

alejandrosantana opened this issue Mar 2, 2015 · 8 comments

Comments

@alejandrosantana
Copy link

Hi,

I am trying to port module web_nocreatedb to v8, without success, so far.

I have some doubts regarding the qweb inheritance, as well as I see difference usage in v7 and v8.

  • In v7, the template to inherit and modify (with "Manage Databases" link) is in: web/static/src/xml/base.xml, which is added in 'qweb' within openerp.py
  • In v8, such template is in: web/views/webclient_templates.xml, which is added in 'data' within openerp.py

The exact template to modify in v8 is:

        <template id="web.login_layout" name="Login Layout">

specifically, this part:

                    <div class="oe_single_form_footer" t-if="not disable_footer">
                        <t t-if="not disable_database_manager">
                            <a class="oe_login_manage_db" t-attf-href="/web/database/manager{{ '?debug' if debug else '' }}">Manage Databases</a>
                            <span class="oe_footer_seperator"> | </span>
                        </t>
                        <a href="https://www.odoo.com" target="_blank">Powered by <span>Odoo</span></a>
                    </div>

Previous thoughts:

  • I am running Odoo with:
    openerp-gevent -c my_config_file --load=web,web_nocreatedb --database=my_db
  • 'auto_install' key in openerp.py seems to be ignored.

First I tried to just change what is in web_nocreatedb v7 to point to the new ids, but doesn't seem to work, complaining about not boing within tags.
Then I tried to move it web_nocreatedb/views/webclient_templates.xml, but nothing seems to work either.
Now I have this:

<?xml version="1.0" encoding="UTF-8"?>
<openerp>
    <data>
        <template id="login_layout_no_db" inherit_id="web.login_layout" name="Login Layout">
            <t t-jquery="div[class='oe_single_form_footer']" t-operation="replace">
                <div class="oe_single_form_footer">
                    <a href="https://www.odoo.com" target="_blank">Powered by <span>Odoo</span></a>
                </div>
            </t>
        </template>
    </data>
</openerp>

Also tried with xpath:

<?xml version="1.0" encoding="UTF-8"?>
<openerp>
    <data>
        <template id="login_layout_no_db" inherit_id="web.login_layout" name="Login Layout">
            <xpath expr="//div[class='oe_single_form_footer']" position="replace">
                <div class="oe_single_form_footer">
                    <a href="https://www.odoo.com" target="_blank">Powered by <span>Odoo</span></a>
                </div>
            </xpath>
        </template>
    </data>
</openerp>

But in both cases I get this error:

2015-03-02 12:47:17,822 17312 ERROR forbe__v8_13_clone openerp.addons.base.ir.ir_ui_view: El elemento '<xpath expr="//div[class='oe_single_form_footer']">' cannot be located in parent view

Context error:
View `Login Layout`
[view_id: 870, xml_id: n/a, model: n/a, parent_id: 171]

Any direction to correctly port this module?

@hbrunn
Copy link
Member

hbrunn commented Mar 2, 2015

In xpath, you need to prefix attributes in predicates with an @. Try
<xpath expr="//div[@class='oe_single_form_footer']" position="replace">

But in the template, you'll see that the database manager part is wrapped in
<t t-if="not disable_database_manager">
why don't you simply that this flag from the module?

@alejandrosantana
Copy link
Author

I thought about it, but... how do I set that flag? t-set? Shouldn't it be done inside the t-call (which I do not know how to reference)?

@alejandrosantana
Copy link
Author

@hbrunn Got it!
This is working:

<openerp>
    <data>
        <template id="login_layout_no_db" inherit_id="web.login_layout" name="Login Layout">
            <xpath expr="//div[@class='oe_single_form_footer']" position="before">
                <t t-set="disable_database_manager" t-value="1"/>
            </xpath>
        </template>
    </data>
</openerp>

I will prepare the pull request in the afternoon for review.

@alejandrosantana
Copy link
Author

No, it is not working, though it worked once. But reloading it, just make it reappear.
I will work on it.

@alejandrosantana
Copy link
Author

It is only working if I select the database in which I installed manually the module.
If I choose another database, it shows again.
Therefore, either --load=web,web_nocreatedb or auto_install = True are failling.

Any clue?

@hbrunn
Copy link
Member

hbrunn commented Mar 2, 2015

makes sense: auto_install = True only has an effect if you update your module list and upgrade modules. v8 style templates only live in the database, so they must be installed in every database you want this to be in effect, and --load only causes the code to load, not database changes being done.

What to do? As it's only a cosmetic module anyways (we can still access the database manager by url), it's fine to install this in every database where it's supposed to be effective

@alejandrosantana
Copy link
Author

So auto_install and --load ares almost useless in this situation.
OK, I will explain it in module description.

@alejandrosantana
Copy link
Author

Solved and made a pull request here: #89

BT-fgarbely pushed a commit to BT-fgarbely/web that referenced this issue Apr 3, 2018
Syncing from upstream OCA/web (10.0)
leemannd pushed a commit to camptocamp/web that referenced this issue May 29, 2018
vrenaville pushed a commit to camptocamp/web that referenced this issue Jul 19, 2018
changed SO QWeb report BSMTS-171
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants