Good day, I hope you are doing well.
I am developing a new module in odoo, it's simple Parc Module.
I want to disable the checkboxes when the value of Stock is 0.
I wrote this code :
odoo.define('de_alfa_parc.CustomListRenderer', function (require) {
"use strict";
var ListRenderer = require('web.ListRenderer');
ListRenderer.include({
_renderRow: function (record) {
var self = this;
var tr = this._super(record);
var categ = ['Maintenance','Installation','Transport',"Volume d'impression"]
console.log(record.data.small_category_name_field);
tr.find("input[type='checkbox']").prop('disabled', record.data.stock <= 0 && !categ.includes(record.data.small_category_name_field) == true);
return tr;
},
});
});
it's working well when I open the view and the checkboxes are disabled when the stock value is 0
BUT !!
When I touch any line, or modify any value, all the checkboxes become automatically enabled and I need to refresh the page so the script works again, can you please assit ?
Please to see the screnshots for more details
The code is working here on first load of the page I try to update the line The code stops working After refreshing the page, the code works again
Thank you in advance.
Aucun commentaire:
Enregistrer un commentaire