(self)
Compute the production state. This uses a similar process to stock
        picking, but has been adapted to support having no moves. This adaption
        includes some state changes outside of this compute.

        There exist 3 extra steps for production:
        - progress: At least one item is produced or consumed.
        - to_close: The quantity produced is greater than the quantity to
        produce and all work orders has been finished.
Compute the production state. This uses a similar process to stock
        picking, but has been adapted to support having no moves. This adaption
        includes some state changes outside of this compute.
Compute the production state . This uses a similar process to stock picking but has been adapted to support having no moves . This adaption includes some state changes outside of this compute .
def _compute_state(self):
        """ Compute the production state. This uses a similar process to stock
        picking, but has been adapted to support having no moves. This adaption
        includes some state changes outside of this compute.

        There exist 3 extra steps for production:
        - progress: At least one item is produced or consumed.
        - to_close: The quantity produced is greater than the quantity to
        produce and all work orders has been finished.
        """
        for production in self:
            if not production.state:
                production.state = 'draft'
            elif production.state == 'cancel' or (production.move_finished_ids and all(move.state == 'cancel' for move in production.move_finished_ids)):
                production.state = 'cancel'
            elif production.state == 'done' or (production.move_raw_ids and all(move.state in ('cancel', 'done') for move in production.move_raw_ids)):
                production.state = 'done'
            elif production.workorder_ids and all(wo_state in ('done', 'cancel') for wo_state in production.workorder_ids.mapped('state')):
                production.state = 'to_close'
            elif not production.workorder_ids and production.qty_producing >= production.product_qty:
                production.state = 'to_close'
            elif any(wo_state in ('progress', 'done') for wo_state in production.workorder_ids.mapped('state')):
                production.state = 'progress'
            elif production.product_uom_id and not float_is_zero(production.qty_producing, precision_rounding=production.product_uom_id.rounding):
                production.state = 'progress'
            elif any(not float_is_zero(move.quantity_done, precision_rounding=move.product_uom.rounding or move.product_id.uom_id.rounding) for move in production.move_raw_ids):
                production.state = 'progress'
def _compute_state ( self ) : for production in self : if not production . state : production . state = 'draft' elif production . state == 'cancel' or ( production . move_finished_ids and all ( move . state == 'cancel' for move in production . move_finished_ids ) ) : production . state = 'cancel' elif production . state == 'done' or ( production . move_raw_ids and all ( move . state in ( 'cancel' , 'done' ) for move in production . move_raw_ids ) ) : production . state = 'done' elif production . workorder_ids and all ( wo_state in ( 'done' , 'cancel' ) for wo_state in production . workorder_ids . mapped ( 'state' ) ) : production . state = 'to_close' elif not production . workorder_ids and production . qty_producing >= production . product_qty : production . state = 'to_close' elif any ( wo_state in ( 'progress' , 'done' ) for wo_state in production . workorder_ids . mapped ( 'state' ) ) : production . state = 'progress' elif production . product_uom_id and not float_is_zero ( production . qty_producing , precision_rounding = production . product_uom_id . rounding ) : production . state = 'progress' elif any ( not float_is_zero ( move . quantity_done , precision_rounding = move . product_uom . rounding or move . product_id . uom_id . rounding ) for move in production . move_raw_ids ) : production . state = 'progress'