добавьте некоторую проверку в функцию point_of_sale set_discount в odoo 17 в файле models.js
в odoo 17 pos в файле models.js есть функция с именем set_discount, я хочу добавить в нее дополнительную проверку следующим образом:
set_discount(discount) {
var parsed_discount =
typeof discount === "number"
? discount
: isNaN(parseFloat(discount))
? 0
: oParseFloat("" + discount);
var disc = Math.min(Math.max(parsed_discount || 0, 0), 100);this.product.id });
//here i want to get max discount from product.product
//var maxDiscount = this.product.maxDiscount;
//if(disc > maxDiscount){
//alert("discount > max discount");
//return;
//}
this.discount = disc;
this.discountStr = "" + disc;
}
как я могу это сделать (var maxDiscount = this.product.maxDiscount;) в odoo 17 js