(self, picking_type_id)
Helper method for computing "show_allocation" value.
        Separated out from _compute function so it can be reused in other models (e.g. batch).
Helper method for computing "show_allocation" value.
        Separated out from _compute function so it can be reused in other models (e.g. batch).
Helper method for computing show_allocation value . Separated out from _compute function so it can be reused in other models ( e . g . batch ) .
def _get_show_allocation(self, picking_type_id):
        """ Helper method for computing "show_allocation" value.
        Separated out from _compute function so it can be reused in other models (e.g. batch).
        """
        if not picking_type_id or picking_type_id.code == 'outgoing':
            return False
        lines = self.move_lines.filtered(lambda m: m.product_id.type == 'product' and m.state != 'cancel')
        if lines:
            allowed_states = ['confirmed', 'partially_available', 'waiting']
            if self[0].state == 'done':
                allowed_states += ['assigned']
            wh_location_ids = self.env['stock.location']._search([('id', 'child_of', picking_type_id.warehouse_id.view_location_id.id), ('usage', '!=', 'supplier')])
            if self.env['stock.move'].search([
                ('state', 'in', allowed_states),
                ('product_qty', '>', 0),
                ('location_id', 'in', wh_location_ids),
                ('picking_id', 'not in', self.ids),
                ('product_id', 'in', lines.product_id.ids),
                '|', ('move_orig_ids', '=', False),
                     ('move_orig_ids', 'in', lines.ids)], limit=1):
                return True
def _get_show_allocation ( self , picking_type_id ) : if not picking_type_id or picking_type_id . code == 'outgoing' : return False lines = self . move_lines . filtered ( lambda m : m . product_id . type == 'product' and m . state != 'cancel' ) if lines : allowed_states = [ 'confirmed' , 'partially_available' , 'waiting' ] if self [ 0 ] . state == 'done' : allowed_states += [ 'assigned' ] wh_location_ids = self . env [ 'stock.location' ] . _search ( [ ( 'id' , 'child_of' , picking_type_id . warehouse_id . view_location_id . id ) , ( 'usage' , '!=' , 'supplier' ) ] ) if self . env [ 'stock.move' ] . search ( [ ( 'state' , 'in' , allowed_states ) , ( 'product_qty' , '>' , 0 ) , ( 'location_id' , 'in' , wh_location_ids ) , ( 'picking_id' , 'not in' , self . ids ) , ( 'product_id' , 'in' , lines . product_id . ids ) , '|' , ( 'move_orig_ids' , '=' , False ) , ( 'move_orig_ids' , 'in' , lines . ids ) ] , limit = 1 ) : return True