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

202
Vistas
override the _render function of listView does't work in odoo

Here is my code. I want to change some fields background color according to the result of a rpc call. But the change only happens when I switch the mode between edit and save.It should be changed when I open this record.

Any idea?

var render = listRender.extend({
        init: function () {
            this._super.apply(this, arguments)
        },
        async _render() {
            const result = this._super.apply(this, arguments);
            var fields = [];
            for (let index in this.arch.children) {
                if (this.arch.children[index].tag === "field") {
                    fields.push({"field_name": this.arch.children[index].attrs.name, "index": index});
                }
            }
            var self = this;
            this.arch.children[36]["attrs"]["class"] = "red_color";
            var infos = await this._rpc({
                model: "purchase.order",
                method: "is_updated",
                args: [{"fields": fields, "id": this.state.res_ids}]
            });
            infos.data.forEach(ele => {
                this.arch.children[parseInt(ele["index"])]["attrs"]["class"] = "red_color";
            })
        },
    });

color doesn't change when I open the record

color changes when I go to the edit mode

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Render overriding is not the right way to deal with your problem. Consider changing the corresponding view : "sale.order.form" instead. You can find it this way : in App Settings, switch to debug mode by adding "?debug=1" in your url, reload the page, then go to the new Technical Menu-tab > View.

enter image description here

and then, search for : sale.order.form

...which corresponds to the following xml files in src/odoo/addons : sale/sale_views.xml or sale_purchase/sale_views.xml and/or website_sale/sale_order_views.xml

The corresponding url must be similar too (but with different id=...):

https://yourodoodomain.com/web#id=949&action=28&model=ir.ui.view&view_type=form&cids=1&menu_id=4

about 4 years ago · Juan Pablo Isaza Denunciar
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