'Delivery (MTS) route'

def _create_or_update_delivery_route(self, routes_data):

    routes_data = (routes_data or self.get_routes_dict())
    for warehouse in self:
        if warehouse.delivery_route_id:
            delivery_route = warehouse.delivery_route_id
            delivery_route.write({'name': warehouse._format_routename(route_type=warehouse.delivery_steps)})
            delivery_route.pull_ids.unlink()
        else:
            delivery_route = self.env['stock.location.route'].create(warehouse._get_reception_delivery_route_values(warehouse.delivery_steps))
        routings = routes_data[warehouse.id][warehouse.delivery_steps]
        (dummy, pull_rules_list) = warehouse._get_push_pull_rules_values(routings, values={'active': True, 'route_id': delivery_route.id})
        for pull_vals in pull_rules_list:
            self.env['procurement.rule'].create(pull_vals)
    return delivery_route
