o.purchases[0].product.category.code
Traceback (most recent call last):
File "", line 1, in
AttributeError: 'NoneType' object has no attribute 'code'
This is because access to the category property which is set on the class does not trigger fetching of full object in the lazy-loaded product.