In case of Income tax Act , Depreciation is allowed if the asset is held by the assessee on 31st March of the Financial Year, therefore no depreciation will be allowed in the year of sale of asset, with a few exceptions
In Case of Companies Act , depreciation is allowed on pro rata basis i.e. on proportionate basis
therefore depreciation for proportionate period will be available in year of sale