If you want to show a menu badge in OpenERP/Odoo then you should follow the below code:
 
class Shiva(models.Model):
    _name = 'Shiva'
    _inherit = ['ir.needaction_mixin']
    STATES = [
        ('healthy', "Healthy Shiva"),
        ('sick', "Sick Shiva"),
    ]
    name = fields.Char(required=True)
    state = fields.Selection(STATES, default='healthy')
    @api.model
    def _needaction_domain_get(self):
        """
        Show a count of sick horses on the menu badge.
        An exception: don't show the count to Bob,
        because he worries too much!
        """
        if self.env.user.name == "Bob":
            return False  # don't show to Bob!
        return [('state', '=', 'sick')]
After that making use of the domain argument in this file.
def _needaction_count(self, domain=None):
    """
    Count all objects in a view, deducting a dozen
    before displaying on the badge
    (we don't want to alarm people with big numbers)
    """
    return self.search_count(domain or []) - 12
 
Note- Rather than defining domain_get method you can alternatively define a count method, it will return a number of your choice directly in odoo. As shown in screenshot below:

                       
                    
0 Comment(s)