in odoo 17 pos, there is a function named set_discount in models.js file , i want to add extra validation in it like this :
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;
}how can i do this (var maxDiscount = this.product.maxDiscount;) in odoo 17 js