Client script for the sales order form

As i have customised this sales order form .I am facing one issue .


For example consider one customer1 wants to book property on a particular location from 6th of december to 12th of december and other customer2 wants to book the same property at a same location from 7th of dec to 10th of dec .System allows this to save but logically its incorrect.System should display message property is already booked ,plus submit button must be disabled . I want to know custom script for this problem .

You have to write python script to validate this function

Thanks.but for this case i want to know the python script

exists = frappe.db.get_all(“Sales Order”, filters={
“name”: [“!=”, self.name],
{{your date filters. etc}}
}, pluck=“name”)

if exists:
frappe.throw(f"Already Booked in sales order {*exists}"
This is the basic python logic u need to apply

thank you so much but Can you plz explain me this code …partially i understood .
exists = frappe.db.get_all(“Sales Order”, filters={
“name”: [“!=”, self.name],
{{your date filters. etc}}
}, pluck=“name”)


this is how i customised my sales order form.Likes these are the names of my fields

This code check other sales orders with same field value you put in filter
if any match found then its show error while saving

:saluting_face: You are writing python code in js file.:cold_face: