Why is the stock quantity entered in decimals being rounded off automatically in invoices?

This occurs when the Number of decimal places is set as zero in the Unit of Measure (UoM) master. You need to specify Number of decimal places while creating a UoM to ensure that the decimals specified in the invoices are retained.

You can also alter the number of decimal places in the alteration mode of the UoM.