"Article (54)
In addition to any sums to which the worker is entitled to upon the expiry of his service, the employer shall pay the end of service gratuity to the worker who has completed employment of one year or more. This gratuity shall be agreed upon by the two parties, provided that it is not less than a three-week wage for every year of employment. The worker shall be entitled to gratuity for the fractions of the year in proportion to the duration of employment.

The worker's service shall be considered continuous if it is terminated in cases other than those stipulated in article 61 of this Law and is returned to service within two months of its termination.

The last basic wage shall be the base for the calculation of the gratuity.

The employer is entitled to deduct from the service gratuity the amount due to him by the worker."

No conditions are mentioned so it is compulsory. If you have the balls you can take them to labour court. Just remember though, that the labour law does not apply to certain categories of people:

"Article (3)
Except as otherwise provided for in any other law the provisions of this law shall not apply to the following categories:¬
The employees and workers of the Ministries and other governmental organs, public institutions, corporations and companies which are established by Qatar Petroleum by itself or with others, and the workers whose employment affairs are regulated by special laws.
The Officers and members of the armed forces and police and the workers employed at sea.
The workers employed in casual works.
The persons employed in domestic employment such as drivers, nurses, cooks, gardeners and similar workers.
Working members of employer's family. These are the wife, ascendants and descendants who are residing with and wholly dependent on him.
The workers employed in agriculture and grazing other than the persons employed in the agricultural establishments processing and marketing their own products or those who are permanently employed in the operation or repair of the necessary agricultural mechanical appliances.
The provisions of this law or any part thereof may by a resolution of the Council of Ministers upon the recommendation of the Minister be applied to categories 3,4,5 & 6 referred to in this Article."

____________________________________________________
It is better to keep silent and be thought a fool than to speak and remove all doubt