Let’s say we want count of all manufacturing orders in progress state and then display that count in menu for user understanding.

Steps To Follow:-

1.Inherit manufacturing class and IrNeedactionMixin class (class used to get count on menu) and define the state field.

class mrp_production(models.Model):

_name = ‘mrp.production’

_inherit = [‘mrp.production’,’ir.needaction_mixin’]

state = fields.Selection([(‘draft’,’New’),(‘picking_except’, ‘Picking Exception’),                                                                      (‘confirmed’,’Waiting Goods’),(‘in_production’,’In Progress’),                                                   (‘cancel’,’Cancelled’),(‘done’,’Manufacturing Completed’),                                                                  (‘under_inspection’,’Under Inspection’)],’State’, readonly=True)

2.Define def _needaction_domain_get and set the domain for the count(For our exmaple state = ‘in_production’)

@api.model

def _needaction_domain_get(self):

return [(‘state’, ‘=’,’in_production’)]

This will display total number of manufacturing orders “In progress” state.

Contact Nevpro Business Solutions for more information.

Like us on Facebook to know more.