In odoo you can add easily menu badges on menu items. Odoo provides a best and very easy way to do that. You can add numeric values next to the menu items through few lines of code.



How to show menu badge in odoo

What are menu badges in odoo


Menu badges are nothing just numeric values (1,2,3..) next to the menu items. The question is why we need these menu badges. The answer is we want to show the user that, following number of task(s)/work has been pending in the following "state" or "workflow".
Read More: How to Create Workflow Process in Odoo

Adding menu badges in odoo


You do not need to do anything more than what's shown in the post. You just need to inheriting from the "mixin" and "defining the method" named "_needaction_domain_get" is all that you need. Odoo will automatically pick it up and display next to all menu items pointing to actions for this particular model. Below are the code snippet, that you just need to copy and paste.

display_notification_menu_badges_odoo.py

Code Description

To use badges in our menu we just need to inherit "ir.needaction_mixin". After inheriting, just define a method named "_needaction_domain_get" this method will return a domain that selects these states value that should be counted towards the number on the badge. In our case it would be "Submitted".