Skip to Content
Menu
This question has been flagged
1 Reply
5780 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!

Avatar
Discard
Best Answer

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

Avatar
Discard