I'm planning a trip Shanghai to Sri Lanka. I just bought a new laptop as a gift to a friend. Also I have my laptop as well.
I'm wondering whether I'm allowed to carry two of them with me or not?
By the way, I'm flying with AirAsia.
You can have twenty laptops, if you want, as long as you follow the airlines restrictions on weight, size, etc.
You will have to pay duty at customs for anything above a certain limit that stays in the destination country, including gifts you are giving.
You typically pay no duty for personal use items that you take back with you - but it might be difficult to convince the customs agent that you use twenty laptops and will take them all back - he will assume you are selling or gifting them.
Two laptops are arguable; I often travel with two, a personal and a company laptop. However, as you are planning to gift one, you would be lying if you claim this, so you shouldn't do that. Also, if the laptop is new and in the box, you will not be very convincing.
The correct approach is to check the limits of what you can bring, and if the gift's value is over the limit, go to customs at arrival, tell them, and pay the duty. Take the gift's receipt as proof even if it is under the limit.
Visitors are normally allowed for an exemption of Customs duties on personal belongings such as clothing, cosmetics and gifts up to a value of US$ 250/- and 1 1/2 lit. of liquor and 2 bottles of wine.
You can find more information here.