1. Foreign deductions are taxed based on the difference between the locale where the earnings are made and the locale the service/product is provided from. Where the sales division is located has no relevance to taxability, and deductions for sales costs are treated as any other internal service.
2. IP is enforced on the national level, and should not be eligible as a foreign deduction. Good-will also follows the local market.
3. Documentation should be provided that foreign costs are real, and that they are actually taxed. Tax agreements should be null and void if systematic abuse is uncovered.
The problem right now is that no company can compete against these cheats.
Personally, I think Ireland has scammed the rest of Europe for long enough by now.
Likewise, I wouldn't be surprised if a large part of India's competitiveness in asses-in-seats outsourcing is created by artificial tax rule phenomena - and various constructs to exploit these.