Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

198
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda