Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

224
Vistas
Odoo Uncaught Promise > You can only instanciate objects with the 'new' operator

I'm working with Odoo, I'm trying to write a javascript file to create a new widget. I inherited the many2many_avatar_user widget, in the project/task (kanban view) with the expectation that when clicking on the user's avatar, the template I wrote will appear. I have written a python file to render that template, and I will want to call that python function in the js file. I am getting this error when I click on any project:

In the original js file, they are having the _onAvatarClick event, and I am overriding that event, and they have the supportedModels variable,

Can someone help me to solve this problem? any answer would be appreciated.Thank you!

Uncaught Promise > You can onError: You can only instanciate objects with the 'new' operator
    at new Class (http://localhost:8020/web/assets/1093-9077a9d/web.assets_common.min.js:4715:629)
    at Class._processWidget (http://localhost:8020/web/assets/1094-3c79b70/web.assets_backend.min.js:5202:326)
    at HTMLUnknownElement.<anonymous> (http://localhost:8020/web/assets/1094-3c79b70/web.assets_backend.min.js:5201:491)
    at Function.each (http://localhost:8020/web/assets/1093-9077a9d/web.assets_common.min.js:1482:170)
    at jQuery.fn.init.each (http://localhost:8020/web/assets/1093-9077a9d/web.assets_common.min.js:1473:192)
    at Class._processFields (http://localhost:8020/web/assets/1094-3c79b70/web.assets_backend.min.js:5201:201)
    at Class._render (http://localhost:8020/web/assets/1094-3c79b70/web.assets_backend.min.js:5208:6)
    at Class.start (http://localhost:8020/web/assets/1094-3c79b70/web.assets_backend.min.js:5195:1453)
    at prototype.<computed> [as start] (http://localhost:8020/web/assets/1093-9077a9d/web.assets_common.min.js:4715:488)
    at http://localhost:8020/web/assets/1093-9077a9d/web.assets_common.min.js:5055:52ly instanciate objects with the 'new' operator```

Here is my js code
/** @odoo-module **/
import fieldRegistry from 'web.field_registry';
import { M2MAvatarMixin } from '@mail/js/m2x_avatar_user';
import { Many2ManyAvatarUser, KanbanMany2ManyAvatarUser } from '@mail/js/m2x_avatar_user';
import { KanbanMany2ManyTagsAvatar, ListMany2ManyTagsAvatar, FieldMany2ManyTagsAvatar } from 'web.relational_fields';
//import core from 'web.core';
//import session from 'web.session';
//const { Component } = owl;

export const Many2ManyAvatarUserTask = FieldMany2ManyTagsAvatar.extend(KanbanMany2ManyAvatarUser, {
    supportedModels: ['project.task'],

    _onAvatarClicked(ev) {
        ev.stopPropagation(); // in list view, prevent from opening the record
        const userId = parseInt(ev.target.getAttribute('data-id'), 10);
        var rpc = require('web.rpc');
        return rpc.query({model: 'project.task', method: 'render', kwargs: {},
        args: [template='bh_project.task_popup_when_click_assignee_avatar', qcontext=None, lazy=True]})
//        const userId = parseInt(ev.target.getAttribute('data-id'), 10);
//        this._openProfile({ userId: userId });
    },
});

fieldRegistry.add('many2many_avatar_task', Many2ManyAvatarUserTask)```




about 4 years ago · Santiago Gelvez
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda