(self)
return most_specific_views
Filter current recordset only keeping the most suitable view per distinct key.
            Every non-accessible view will be removed from the set:
              * In non website context, every view with a website will be removed
              * In a website context, every view from another website
Filter current recordset only keeping the most suitable view per distinct key.
            Every non-accessible view will be removed from the set:
              * In non website context, every view with a website will be removed
              * In a website context, every view from another website
Filter current recordset only keeping the most suitable view per distinct key . Every non - accessible view will be removed from the set : * In non website context every view with a website will be removed * In a website context every view from another website
def filter_duplicate(self):
        """ Filter current recordset only keeping the most suitable view per distinct key.
            Every non-accessible view will be removed from the set:
              * In non website context, every view with a website will be removed
              * In a website context, every view from another website
        """
        current_website_id = self._context.get('website_id')
        most_specific_views = self.env['ir.ui.view']
        if not current_website_id:
            return self.filtered(lambda view: not view.website_id)

        for view in self:
            # specific view: add it if it's for the current website and ignore
            # it if it's for another website
            if view.website_id and view.website_id.id == current_website_id:
                most_specific_views |= view
            # generic view: add it only if, for the current website, there is no
            # specific view for this view (based on the same `key` attribute)
            elif not view.website_id and not any(view.key == view2.key and view2.website_id and view2.website_id.id == current_website_id for view2 in self):
                most_specific_views |= view

        return most_specific_views
def filter_duplicate ( self ) : current_website_id = self . _context . get ( 'website_id' ) most_specific_views = self . env [ 'ir.ui.view' ] if not current_website_id : return self . filtered ( lambda view : not view . website_id ) for view in self : # specific view: add it if it's for the current website and ignore # it if it's for another website if view . website_id and view . website_id . id == current_website_id : most_specific_views |= view # generic view: add it only if, for the current website, there is no # specific view for this view (based on the same `key` attribute) elif not view . website_id and not any ( view . key == view2 . key and view2 . website_id and view2 . website_id . id == current_website_id for view2 in self ) : most_specific_views |= view return most_specific_views