I will link you to an existing answer which breaks down the process nicely:
Essentially, you want to solve the order by abstracting the search logic and then re-adding your details afterwards.
I think (I have not tested) your search would break down to:
AND AND OR A B OR C D OR E F
Once I substitute your values back in, you would be left with:
'&', '&', '|', (saleorders ID in m2m), (all ID), '|', (customers ID in m2m), (all ID), '|', (salespersons in m2m), (all ID)
Again, I'm not certain that logic will work, but you should be able to come close with the process described in the link above.