'Validate architecture of all the views of a given module'

@api.model
def _validate_module_views(self, module):

    assert ((not self.pool._init) or (module in self.pool._init_modules))
    xmlid_filter = ''
    params = (module,)
    if self.pool._init:
        xmlid_filter = 'AND    md.name    IN    %s'
        names = tuple((name for ((xmod, name), (model, res_id)) in self.pool.model_data_reference_ids.items() if ((xmod == module) and (model == self._name))))
        if (not names):
            return
        params += (names,)
    query = "SELECT    max(v.id)\n                                                                                    FROM    ir_ui_view    v\n                                                                LEFT    JOIN    ir_model_data    md    ON    (md.model    =    'ir.ui.view'    AND    md.res_id    =    v.id)\n                                                                                WHERE    md.module    =    %s    {0}\n                                                                    GROUP    BY    coalesce(v.inherit_id,    v.id)".format(xmlid_filter)
    self._cr.execute(query, params)
    for (vid,) in self._cr.fetchall():
        try:
            self.browse(vid)._check_xml()
        except Exception as e:
            self.raise_view_error(("Can't    validate    view:\n%s" % (e.message or repr(e))), vid)
