[Python] switch company trigger in odoo 17

Discussão em 'Python' iniciado por Stack, Junho 15, 2025.

  1. Stack

    Stack Membro Participativo

    suit to my work i need to trigger a method when the user switch company , i tried overrideing the write method in res.user model but i didn't work i tried with js like this :

    /** @odoo-module **/

    import { rpc } from "@web/core/network/rpc_service";

    document.addEventListener("click", function (event) {
    if (event.target.closest(".o_switch_company_menu .dropdown-item[data-company-id]")) {
    const companyId = event.target.closest(".dropdown-item").dataset.companyId;
    rpc("/dashboard_commission/switch_company", {
    company_id: companyId,
    }).then(function () {
    alert("hello world");
    });
    }
    });


    but still i didn't acheive my goal ... if any one have an idea how to trigger a method when the user switch company i would be thankful.

    Continue reading...

Compartilhe esta Página