Odoo Help

0

How to execute a function everytime an odoo page is loaded/requested

By
Tran Ngoc Tuan
on 7/1/15, 10:33 AM 520 views

Hello,

I want to execute a piece of code on every page load, no matter what url is. Could anyone please help?

Thank you in advance!

0
MIADI
On 6/15/17, 5:40 AM

Hi,

I don't know if it's all you need but to begin, you can use ir.actions.server. I give you an example from my XML :

<record id="action_chargement_ratio" model="ir.actions.server">
    <field name="name">Chargement Ratio</field>
    <field name="type">ir.actions.server</field>
    <field name="model_id" ref="model_miadi_poidsconditionnement"/>
    <field name="code">action = env['miadi.poidsconditionnement'].chargement_ratio()</field>
</record>

In the <field name="code">, you can call a function or directly write you python code.

Regards,

MIADI

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

Asked: 7/1/15, 10:33 AM
Seen: 520 times
Last updated: 6/15/17, 5:40 AM