What is the story with this? I was not aware about if you sold having to pay this back?"
This is a good question and one that deserves more explanation.
How depreciation works
If a building has been depreciated and it is sold in some way, then the depreciation is clawed back, assuming that the building is now worth more than its book value. The sale value of chattels also needs to be calculated and, if they are worth more than their depreciated value, that difference will be clawed back. If some of the chattels are worth less than their depreciated value, you can deduct that difference. However, in practice, by the time your rental property is sold, the chattels may well have little or no value in either real or in book terms (unless its something like a swimming pool!)
NB: (1) If the property goes through a change of use - for example, the landlord moves into the rental property - this is a deemed to be a sale and a clawback of depreciation may be triggered. (2) We are not talking about the situation where the owner moves back into the property temporarily to fix it up then rent it out again, as this does not (generally) change the permanent long-term use of the property and therefore does not (generally) trigger a depreciation clawback. (3) The 2010 Budget set the annual depreciation rate for buildings to 0% if they have estimated useful lives of 50 years or more. (4) Depreciation cannot be claimed in the year of sale.
How do you tell?
When a property is sold, you need to get a proper valuation done (see here for more info). Work out the difference between their current value and their book value and that will give you the figure that is either clawed back or deducted.
When do you need to work this all out?
If a property is being sold, things are reckoned on the day of sale. If you're moving into your rental property, then you use the first day of the next income year (usually 1 April).
That's not fair!
It might seem that way, especially if you're moving into your rental. However, keep in mind that for years you have likely been deducting an expense that hasn't involved any cash outlay. So, it is fair after all.
Is there any way I can get around this?
Well, yes. IRD allows you to elect not to depreciate property and chattels that would otherwise be depreciable. This could be particularly useful if you rent out your property for short periods then move back into it, e.g., those who go overseas a lot. However, if you have already started depreciating your chattels, you can't "un-depreciate them"
Mary Holm's article on the subject is well worth reading. To find out how to determine what is depreciable and what is not, see this article. You might also find this post useful, as it outlines the benefits of getting a proper valuation.