'Apply all the (directly and indirectly) inheriting views.
:param source: a parent architecture to modify (with parent modifications already applied)
:param source_id: the database view_id of the parent view
:param model: the original model for which we create a view (not
necessarily the same as the source\'s model); only the inheriting
views with that specific model will be applied.
:return: a modified source where all the modifying architecture are applied'

@api.model
def apply_view_inheritance(self, source, source_id, model, root_id=None):

    if (root_id is None):
        root_id = source_id
    sql_inherit = self.get_inheriting_views_arch(source_id, model)
    for (specs, view_id) in sql_inherit:
        specs_tree = etree.fromstring(specs.encode('utf-8'))
        if self._context.get('inherit_branding'):
            self.inherit_branding(specs_tree, view_id, root_id)
        source = self.apply_inheritance_specs(source, specs_tree, view_id)
        source = self.apply_view_inheritance(source, view_id, model, root_id=root_id)
    return source
