Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

190
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!