'Return the list of products that apply to this document.
If the document has a parent, it inherits the parent\'s products.'

def get_products(self):

    if self.parent:
        return self.parent.get_products()
    return Product.objects.filter(document=self)
