Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
2138 Widoki

In Odoo 17, I used the bus_service to listen for custom notifications and fetch user information. However, after upgrading to Odoo 18 (which uses OWL), my existing logic for listening to the "notification" event does not work as expected.
===================================================================
patch(ProductsWidget.prototype, {

    setup() {

        super.setup(...arguments);

        onMounted(this.onMounted);

    },

    onMounted() {

        var self = this;

        const notification = ({ detail: notifications }) => {

            self.fetchUserName(notifications);

        };

        self.env.services["bus_service"].addEventListener("notification", notification);

    },

    fetchUserName(notifications) {

        console.log("notifications==>", notifications)

    },

});

=====================================================================

def fetchUserName(self):

    for user in self:

        invite_partner = user.create_uid.partner_id

        if invite_partner:

            self.env['bus.bus']._sendone(invite_partner, 'res.users/connection', {

                'username': user.name,

                'partnerId': user.partner_id.id,

            })


Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
1
wrz 23
7909
2
lut 18
11155
0
cze 17
4318
3
lut 25
16126
2
sie 23
5620