I created a custom field in sale.order.line
_inherit = "sale.order.line"
maximum_quantity = fields.Float (string = 'Maximum Quantity', default = check_max_quan)
# then i called this method to fetch product available quantity and pass it to maximum quantity by default
def check_max_quan (self):
max_quan = self.env ['product.template']. search ([['product_id', '=', self.product_id]]). qty_available
return max_quan
# But this logic is not working i am unable to pass qty_available value of product to my custom created field