Guidelines vary, so you should consult your doctor, the airline, and also check with any insurer you have. One of the main medical risks is a thrombosis which a risk following any surgery and also a risk in any long haul flight. In the case of abdominal surgery, airlines are concerned about your ability to move about without hindering other passengers and to react during emergency situations. Typical guidelines suggest 7-10 days minimum following this type of surgery.
On top of that is when you feel up to doing it. Knowing what I know now, I wouldn't dream of flying for that far even a week after my surgery. Not so much diarrhoea since that can be controlled, but the pain, discomfort, and general fatigue. Perhaps in first class with more room and the ability to lie down it would be more bearable.